From patchwork Tue Dec 18 21:04:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 30739 Received: (qmail 57508 invoked by alias); 18 Dec 2018 21:05:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 57161 invoked by uid 89); 18 Dec 2018 21:05:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=bld, 216, 2112 X-HELO: smtprelay.synopsys.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1545167123; bh=lNAN9nd7/ZHk6r90zsK7J7biUNkYb5pemMPrrDIua0I=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=E12YEWixak7939gqzA9znW9zVeEV+EcV/e4B8VFavCLq6ELQsRY+O8TE2v2k+q1qe geA+yB7rO/NRnTw2jbyUhsXR28qu/7mdYmo27OgJIhdiT9GUSB/yZ5RA/k2B3dWl3E 0PVgTWB89yH2a3YqmJpyuKMnbygLEyWiNbptROgJyIsmsPhxaG8a9h23fAptmF4y8v 639VeZtV4J3lf/KW+0vS3fwtgCSm5RJD9qyNEsEJLmXESIa9Tayp0oTZt13s1mCmSJ Ycb+RUzxeJGtwv85Yzp30gA09E2TQL04WDrhlQQ/b1kgguMWPH+ifkOMxX6GdN72g3 PDjsDggGO3k6A== From: Vineet Gupta To: CC: , Vineet Gupta Subject: [PATCH 14/21] ARC: Enable __start as entry point vs. canonical _start Date: Tue, 18 Dec 2018 13:04:36 -0800 Message-ID: <1545167083-16764-15-git-send-email-vgupta@synopsys.com> In-Reply-To: <1545167083-16764-1-git-send-email-vgupta@synopsys.com> References: <1545167083-16764-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 ARC linker scripts have defined __start as entry point so to not break ABI for uClibc et al we allow __start for glibc as well Signed-off-by: Vineet Gupta --- ChangeLog | 3 +++ sysdeps/arc/dl-machine.h | 14 ++++++++++---- sysdeps/arc/entry.h | 5 +++++ sysdeps/arc/start.S | 14 +++++++++++--- 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 sysdeps/arc/entry.h diff --git a/ChangeLog b/ChangeLog index 6628960c487e..86e4db890850 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,9 @@ * sysdeps/unix/sysv/linux/arc/configure: New file. * sysdeps/unix/sysv/linux/arc/configure.ac: New file. * sysdeps/unix/sysv/linux/arc/shlib-versions: New file. + * sysdeps/arc/dl-machine.h: replace _start with __start. + * sysdeps/arc/start.S: likewise. + * sysdeps/arc/entry.h: Add ENTRY_POINT define check. 2018-12-17 Joseph Myers diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h index da1aef79152d..02727a3a4d47 100644 --- a/sysdeps/arc/dl-machine.h +++ b/sysdeps/arc/dl-machine.h @@ -21,6 +21,12 @@ #define ELF_MACHINE_NAME "arc" +#include + +#ifndef ENTRY_POINT +#error ENTRY_POINT needs to be defined for ARC +#endif + #include #include #include @@ -150,9 +156,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) #define RTLD_START asm ("\ .text \n\ -.globl _start \n\ -.type _start, @function \n\ -_start: \n\ +.globl __start \n\ +.type __start, @function \n\ +__start: \n\ ; (1). bootstrap ld.so \n\ bl.d _dl_start \n\ mov_s r0, sp ; pass ptr to aux vector tbl \n\ @@ -182,7 +188,7 @@ _start: \n\ add r0, pcl, _dl_fini@pcl \n\ j [r13] \n\ \n\ - .size _start,.-_start \n\ + .size __start,.-__start \n\ .previous \n\ "); diff --git a/sysdeps/arc/entry.h b/sysdeps/arc/entry.h new file mode 100644 index 000000000000..adb01d981afd --- /dev/null +++ b/sysdeps/arc/entry.h @@ -0,0 +1,5 @@ +#ifndef __ASSEMBLY__ +extern void __start (void) attribute_hidden; +#endif + +#define ENTRY_POINT __start diff --git a/sysdeps/arc/start.S b/sysdeps/arc/start.S index 119d596db07f..79e73e27d00d 100644 --- a/sysdeps/arc/start.S +++ b/sysdeps/arc/start.S @@ -34,7 +34,14 @@ . */ +#define __ASSEMBLY__ 1 +#include +#ifndef ENTRY_POINT +#error ENTRY_POINT needs to be defined for ARC +#endif + /* When we enter this piece of code, the program stack looks like this: + argc argument counter (integer) argv[0] program name (pointer) argv[1...N] program args (pointers) @@ -45,9 +52,9 @@ */ .text .align 4 - .global _start - .type _start,@function -_start: + .global __start + .type __start,@function +__start: mov fp, 0 ld_s r1, [sp] ; argc @@ -71,6 +78,7 @@ _start: /* Should never get here.... */ flag 1 + .size __start,.-__start /* Define a symbol for the first piece of initialized data. */ .data