From patchwork Sat Feb 14 09:55:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 439722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id CA4C01402A9 for ; Sat, 14 Feb 2015 20:56:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4F5FA33CAF; Sat, 14 Feb 2015 09:56:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xqBanFVUXFwF; Sat, 14 Feb 2015 09:56:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id A424733A06; Sat, 14 Feb 2015 09:56:11 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id C74CB1C22B5 for ; Sat, 14 Feb 2015 09:56:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C3E79A3B76 for ; Sat, 14 Feb 2015 09:56:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1f8om0HiCNzZ for ; Sat, 14 Feb 2015 09:56:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by fraxinus.osuosl.org (Postfix) with ESMTPS id A72C4A3B92 for ; Sat, 14 Feb 2015 09:56:09 +0000 (UTC) Received: from dc8secmta1.synopsys.com (dc8secmta1.synopsys.com [10.13.218.200]) by smtprelay.synopsys.com (Postfix) with ESMTP id 1EA7C10C04FB for ; Sat, 14 Feb 2015 01:56:09 -0800 (PST) Received: from dc8secmta1.internal.synopsys.com (dc8secmta1.internal.synopsys.com [127.0.0.1]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 1106327113 for ; Sat, 14 Feb 2015 01:56:09 -0800 (PST) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id C897727102 for ; Sat, 14 Feb 2015 01:56:08 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id B9CF82C3 for ; Sat, 14 Feb 2015 01:56:08 -0800 (PST) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id B34332C2 for ; Sat, 14 Feb 2015 01:56:08 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 01:56:08 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 15:26:06 +0530 Received: from vineetg-E7440.internal.synopsys.com (10.12.196.223) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 15:26:05 +0530 From: Vineet Gupta To: Subject: [PATCH 1/8] ARC: Conditionalise certain relocations as provided by TLS tools only Date: Sat, 14 Feb 2015 15:25:37 +0530 Message-ID: <1423907744-2394-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423907744-2394-1-git-send-email-vgupta@synopsys.com> References: <1423907744-2394-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.196.223] Cc: Vineet Gupta , Alexey.Brodkin@synopsys.com X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" uClibc mainline supports NPTL which in turns depends on TLS support in the tools (gcc/binutils), which is yet to be merged in dev branches. However there is some non NPTL code in uClibc, added as part of NPTL effort, which relies on certain relocations only provided by NPTL binutils. As a result building the current upstream even for LT.old breaks. So conditionalize that code on tools, bu tin lack of specific versions, we use NPTL enabling as a sign the tools are equipped to handle those relos. Signed-off-by: Vineet Gupta --- extra/Configs/defconfigs/arc/defconfig | 2 +- ldso/ldso/arc/dl-startup.h | 7 +++++++ ldso/ldso/arc/dl-sysdep.h | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/extra/Configs/defconfigs/arc/defconfig b/extra/Configs/defconfigs/arc/defconfig index 840c59f0e519..db4308f22951 100644 --- a/extra/Configs/defconfigs/arc/defconfig +++ b/extra/Configs/defconfigs/arc/defconfig @@ -6,7 +6,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%" # LDSO_CACHE_SUPPORT is not set LDSO_RUNPATH=y # LDSO_SAFE_RUNPATH is not set -UCLIBC_HAS_THREADS_NATIVE=y +LINUXTHREADS_OLD=y PTHREADS_DEBUG_SUPPORT=y UCLIBC_HAS_OBSTACK=y UCLIBC_SUSV2_LEGACY=y diff --git a/ldso/ldso/arc/dl-startup.h b/ldso/ldso/arc/dl-startup.h index 8e26ae8d9947..ef89b5317216 100644 --- a/ldso/ldso/arc/dl-startup.h +++ b/ldso/ldso/arc/dl-startup.h @@ -33,9 +33,16 @@ __asm__( " ; If ldso ran as cmd with executable file nm as arg \n" " ; skip the extra args calc by dl_start() \n" " ld_s r1, [sp] ; orig argc from aux-vec Tbl \n" + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ " ld r12, [pcl, _dl_skip_args@pcl] \n" " add r2, pcl, _dl_fini@pcl ; finalizer \n" +#else + " add r12, pcl, _dl_skip_args-.+(.&2) \n" + " ld r12, [r12] \n" + " add r2, pcl, _dl_fini-.+(.&2) ; finalizer \n" +#endif " add2 sp, sp, r12 ; discard argv entries from stack\n" " sub_s r1, r1, r12 ; adjusted argc, on stack \n" diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h index d71e16b3234e..08b3bade8b09 100644 --- a/ldso/ldso/arc/dl-sysdep.h +++ b/ldso/ldso/arc/dl-sysdep.h @@ -127,6 +127,7 @@ static __always_inline Elf32_Addr elf_machine_dynamic(void) /* Return the run-time load address of the shared object. */ static __always_inline Elf32_Addr elf_machine_load_address(void) { +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ /* To find the loadaddr we subtract the runtime addr of a non-local symbol * say _DYNAMIC from it's build-time addr. * N.B., gotpc loads get optimized by the linker if it finds the symbol @@ -144,6 +145,15 @@ static __always_inline Elf32_Addr elf_machine_load_address(void) "sub %0, %0, %1 ;delta" "\n" : "=&r" (addr), "=r"(tmp) ); +#else + Elf32_Addr addr, tmp; + __asm__ ( + "ld %1, [pcl, _dl_start@gotpc] ;build addr of _dl_start \n" + "add %0, pcl, _dl_start-.+(.&2) ;runtime addr of _dl_start \n" + "sub %0, %0, %1 ;delta \n" + : "=&r" (addr), "=r"(tmp) + ); +#endif return addr; }