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: 653893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s0mgG6W4Gz9t29 for ; Fri, 29 Jul 2016 08:26:48 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id EB1551012E; Fri, 29 Jul 2016 00:26:43 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org 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 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 Subject: Re: [uclibc-ng-devel] [PATCH 2/2] ARC: Add new compiler define to indicate @pcl relocation support X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" 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>