From patchwork Thu Jul 28 22:26:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waldemar Brodkorb X-Patchwork-Id: 653892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s0mgC4BMwz9t2B for ; Fri, 29 Jul 2016 08:26:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 471F8C0948; Thu, 28 Jul 2016 22:26:44 +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 g8tKH1iQeqte; Thu, 28 Jul 2016 22:26:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id AF59CC0942; Thu, 28 Jul 2016 22:26:42 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 05CBB1C1035 for ; Thu, 28 Jul 2016 22:26:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id F05213146A for ; Thu, 28 Jul 2016 22:26:41 +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 w6namn7s+X3F for ; Thu, 28 Jul 2016 22:26:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) by silver.osuosl.org (Postfix) with ESMTPS id 1E14331415 for ; Thu, 28 Jul 2016 22:26:38 +0000 (UTC) Received: by helium.openadk.org (Postfix, from userid 1000) id 5091F1012E; Fri, 29 Jul 2016 00:26:35 +0200 (CEST) Date: Fri, 29 Jul 2016 00:26:35 +0200 From: Waldemar Brodkorb To: Andrew Burgess Subject: Re: [PATCH 2/2] ARC: Add new compiler define to indicate @pcl relocation support Message-ID: <20160728222634.GH22524@waldemar-brodkorb.de> References: <1469730034-8068-1-git-send-email-andrew.burgess@embecosm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1469730034-8068-1-git-send-email-andrew.burgess@embecosm.com> X-Operating-System: Linux 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Cc: uclibc@uclibc.org, Vineet.Gupta1@synopsys.com, noamca@mellanox.com, Alexey.Brodkin@synopsys.com, devel@uclibc-ng.org 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" Hi Andrew, Andrew Burgess wrote, > Some old versions of binutils did not support @pcl relocations. This > commit adds a new flag to the uClibc configuration system that detects > if the toolchain supports @pcl relocations or not. > > If this relocation is supported then the define ARC_HAS_AT_PCL_RELOC > will be passed to the compiler, which is then used in the arc ldso to > choose between generating old or new style code. > > This commit addresses and issue that was worked around in commit > 181d410ad00cddd1d6c9f4835e129136b74c5187 (ARC: Conditionalise certain > relocations as provided by TLS tools only). In this commit the choice > between old or new style relocations was made based on whether uClibc > was configured with native threads or not. The problem is that a user > of a new toolchain might choose to configure without native threads. > --- > Rules.mak | 2 ++ > ldso/ldso/arc/dl-startup.h | 2 +- > ldso/ldso/arc/dl-sysdep.h | 4 ++++ > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/Rules.mak b/Rules.mak > index 3c80016..04ff02f 100644 > --- a/Rules.mak > +++ b/Rules.mak > @@ -507,9 +507,11 @@ ifeq ($(TARGET_ARCH),c6x) > endif > > ifeq ($(TARGET_ARCH),arc) > + ARC_HAS_AT_PCL_RELOC:=$(shell echo -e "\t.text\n\tadd r0,pcl,_symbol@pcl" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n) > CPU_CFLAGS-y += -mlock -mswape > CPU_CFLAGS-$(CONFIG_ARC_CPU_700) += -mA7 > CPU_CFLAGS-$(CONFIG_ARC_CPU_HS) += -mcpu=archs > + CPU_CFLAGS-$(ARC_HAS_AT_PCL_RELOC) += -DARC_HAS_AT_PCL_RELOC > CPU_LDFLAGS-y += $(CPU_CFLAGS) -marclinux > endif I tried the patch, but get this with arc 2016.03 (ARC700, LE): /home/wbx/embedded-test/openadk/toolchain_nsim-arcv1_uclibc-ng_arc700/usr/bin/arc-openadk-linux-uclibc-gcc -c libc/sysdeps/linux/common/pause.c -o libc/sysdeps/linux/common/pause.os -Wall -Wstrict-prototypes -Wstrict-aliasing -funsigned-char -fno-builtin -fno-asm -fmerge-all-constants -std=gnu99 -mlock -mswape -mA7 -fno-stack-protector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/arc -I./libc/sysdeps/linux -I./ldso/ldso/arc -I./ldso/include -I. -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=arc700 -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -D__USE_STDIO_FUTEXES__ -DHAVE_FORCED_UNWIND -D_LIBC_REENTRANT -I./libpthread/nptl -I./libpthread/nptl -I./libpthread/nptl/sysdeps/unix/sysv/linux/arc -I./libpthread/nptl/sysdeps/arc -I./libpthread/nptl/sysdeps/arc -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/pthread -I./libpthread/nptl/sysdeps/pthread/bits -I./libpthread/nptl/sysdeps/generic -I./libc/sysdeps/linux/common -isystem /home/wbx/embedded-test/openadk/toolchain_nsim-arcv1_uclibc-ng_arc700/usr/lib/gcc/arc-openadk-linux-uclibc/4.8.5/include-fixed -isystem /home/wbx/embedded-test/openadk/toolchain_nsim-arcv1_uclibc-ng_arc700/usr/lib/gcc/arc-openadk-linux-uclibc/4.8.5/include -I/home/wbx/embedded-test/openadk/target_nsim-arcv1_uclibc-ng_arc700/usr/include/ -DNDEBUG -DIN_LIB=libc -fPIC -fexceptions -fasynchronous-unwind-tables -MT libc/sysdeps/linux/common/pause.os -MD -MP -MF libc/sysdeps/linux/common/.pause.os.dep {standard input}: Assembler messages: {standard input}:15: Error: invalid operands (.bss and .text sections) for `-' {standard input}:15: Error: invalid operands (.text and *ABS* sections) for `&' {standard input}:17: Error: invalid operands (.text.exit and .text sections) for `-' {standard input}:17: Error: invalid operands (.text and *ABS* sections) for `&' Makerules:385: recipe for target 'ldso/ldso/ldso.oS' failed make[6]: *** [ldso/ldso/ldso.oS] Error 1 It seems ARC_HAS_AT_PCL_RELOC isn't set. I tracked it down, it seems a combination of my shell and echo -e usage. I know there is another echo -e usage in Rules.mak and I will fix it later. Can you please resend the patch with printf instead of echo -e, if the Synopsis ARC developers agree on this patch? I added the trailing "\n" to avoid a unnecessary warning when trying just the command in a shell, sth like that: /dev/null && echo -n y || echo -n n) CPU_CFLAGS-y += -mlock -mswape CPU_CFLAGS-$(CONFIG_ARC_CPU_700) += -mA7 CPU_CFLAGS-$(CONFIG_ARC_CPU_HS) += -mcpu=archs Otherwise looks good to me and fixes my problem with a nothread build :) thanks Waldemar diff --git a/Rules.mak b/Rules.mak index 04ff02f..8b962b4 100644 --- a/Rules.mak +++ b/Rules.mak @@ -507,7 +507,7 @@ ifeq ($(TARGET_ARCH),c6x) endif ifeq ($(TARGET_ARCH),arc) - ARC_HAS_AT_PCL_RELOC:=$(shell echo -e "\t.text\n\tadd r0,pcl,_symbol@pcl" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n) + ARC_HAS_AT_PCL_RELOC:=$(shell printf "\t.text\n\tadd r0,pcl,_symbol@pcl\n" | $(CC) -c -x assembler -o /dev/null - 2>