From patchwork Tue Oct 26 20:03:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 46671 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 04C34385843C for ; Tue, 26 Oct 2021 20:05:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04C34385843C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635278737; bh=0ijNRb9UORPveq+1F5wDZqSSH6U3myI+eHGWNOF8wk4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iErHrJXJCRZFqP6EMoBrZcDKB3FdwdDO3qnUHE382pEygwx9Fisg3W2hN3jreIiXf HQobJD85N+s7i3tFuxYlvhuxCtKW9K3aAhgATIsmjU+/puggp/tdkb7lMtLxIRKNOB AZSkipKzwUoWWI7+Xsz51yDp7KT3y+GtorsgdBMY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id 687403858410 for ; Tue, 26 Oct 2021 20:03:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 687403858410 Received: by mail-oi1-x22d.google.com with SMTP id r6so280641oiw.2 for ; Tue, 26 Oct 2021 13:03:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0ijNRb9UORPveq+1F5wDZqSSH6U3myI+eHGWNOF8wk4=; b=jXKUlFyixvXW/wSqTrgKkPS58D3+h9p9TaQ1lxuOO3wjwBVdcPZwYvyHzcz3H2xFCR wd5VK3XvhDMD632f3ZKjxxL88QzqkXZ98aaSP2bfc431RemsST/QvhEW9fZ6sfOfZQ30 /hi0d7UYaNC21z5DDGDpUYsq+4oBFZ8Y+0bxkGNMwI37IDb3dD5xzFANhyx4CFYpVrys r6QhMZId0dkZZWj2XKYC55hJGd7MGlkyhvXesCdjTe1YD2uWTN6h3cCim9izXsiR5NyQ 4k3/s52srxd1g7iCiACXAXnc7NBUuLMw8UzsY/cTGXD7tYt9wib+lGMXV9j+HxGuSTTV hrKg== X-Gm-Message-State: AOAM5327wktihYo3Th7non10aokVTwKW0V4oZYq8/47D5a2qKcBakqUe e0dMZsGOQv0tIXQvRxge1752+PRSK7Myeg== X-Google-Smtp-Source: ABdhPJxFYU668TiF/FvXanDEHgKD/zrz92PxpMtwu81UHQSrp5gg0C7SCK4NQDfQ9CdUx78imb30Fw== X-Received: by 2002:a05:6808:f0e:: with SMTP id m14mr639545oiw.67.1635278631668; Tue, 26 Oct 2021 13:03:51 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:6672:308c:d549:2f1f:5bb6]) by smtp.gmail.com with ESMTPSA id l3sm2689062otu.6.2021.10.26.13.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 13:03:51 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 1/3] elf: Disable ifuncmain{1,5,5pic,5pie} when using LLD Date: Tue, 26 Oct 2021 17:03:44 -0300 Message-Id: <20211026200346.3371750-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> References: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" These tests takes the address of a protected symbol (foo_protected) and lld does not support copy relocations on protected data symbols. Checked on x86_64-linux-gnu. Reviewed-by: Fangrui Song --- elf/Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/elf/Makefile b/elf/Makefile index bdcf4cb885..477207a297 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -427,11 +427,14 @@ ifeq (yes,$(build-shared)) tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8. tests-internal += \ - ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ + ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ ifuncmain1staticpic \ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \ - ifuncmain5 ifuncmain5pic ifuncmain5staticpic \ + ifuncmain5staticpic \ ifuncmain7 ifuncmain7pic +ifeq (no,$(with-lld)) +tests-internal += ifuncmain1 ifuncmain5 ifuncmain5pic +endif ifeq (yes,$(have-gcc-ifunc)) tests-internal += ifuncmain9 ifuncmain9pic endif @@ -441,17 +444,23 @@ extra-test-objs += $(ifunc-test-modules:=.o) test-internal-extras += $(ifunc-test-modules) ifeq (yes,$(have-fpie)) ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \ - ifuncmain5pie ifuncmain6pie ifuncmain7pie + ifuncmain6pie ifuncmain7pie ifeq (yes,$(have-gcc-ifunc)) ifunc-pie-tests += ifuncmain9pie endif +ifeq (no,$(with-lld)) +ifunc-pie-tests += ifuncmain5pie +endif ifeq (yes,$(have-textrel_ifunc)) ifunc-pie-tests += tst-ifunc-textrel endif tests-internal += $(ifunc-pie-tests) tests-pie += $(ifunc-pie-tests) endif -modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6 +modules-names += ifuncmod1 ifuncmod3 ifuncmod6 +ifeq (no,$(with-lld)) +modules-names += ifuncmod5 +endif endif endif From patchwork Tue Oct 26 20:03:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 46673 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B13F3858014 for ; Tue, 26 Oct 2021 20:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B13F3858014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635278826; bh=W3PKblVMl6yVhQIsUckj5HLhbIXsHi+jvHyAvCVADqQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kys/pBg9dRuogyHfyFg66N/vjADCYZIN9xtdu9v1tsRmpkV1RSoylYITqEtJbV5m7 DkNaehm6XIJPXADd8GXC12DsxJXPlKDEnM79DyxD7aFtAQProxnAhl/jNOulhFtfVB +WylYO/7FbzqwiWYPC2Ws9R185fOhvnRlclyXqAQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id AD5283858405 for ; Tue, 26 Oct 2021 20:03:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AD5283858405 Received: by mail-oi1-x231.google.com with SMTP id z126so206102oiz.12 for ; Tue, 26 Oct 2021 13:03:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W3PKblVMl6yVhQIsUckj5HLhbIXsHi+jvHyAvCVADqQ=; b=2CfFwH6KaltWVXOT7Rk3fR/B+zI/UCT0Slsjr7ZLQbNz9TmtpRcZ2LUQmyoSSMlPzm O6TRkzbEIcbqLZsVnXT7QfRcrwKAzA2uSR2QB0DjcfcrdHT2OFOd3X9Xn/5KxKzAdmSw 3PGk9cWX9V8uQ7r+Avff00y4IoHQcC4/j1ZWoTzqJScU49GGxc3KlqJACKFv0S6AUFO8 4LbOPcwOrg9I8Xc4P9ePXdD9nRltNdg0wa+l812gi1c92nyC4XIwoCjYbtnDKAMnQJiE uKVk1ImlJV2Mm8dm8A8ERp2Brxf5pTc9N3ZwfC11YwAQmxmnuPuKLsrEFhAdUiY7fkbG W7Vw== X-Gm-Message-State: AOAM5307ozCcrBwIBZHniEt8A1L9KKZXCdxa4xzxNgYn675Zfen3zgOH 4e4uMtR2bwn9nU6NIj3J6ADzIbqpsy0mXw== X-Google-Smtp-Source: ABdhPJxZt64lAbVrlIW8k2XDppHbfRVnQSI38wX2tJvYswrfg/vcW/HwpspczffoOiY3I+khVQ9i6A== X-Received: by 2002:a05:6808:1287:: with SMTP id a7mr624836oiw.45.1635278632994; Tue, 26 Oct 2021 13:03:52 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:6672:308c:d549:2f1f:5bb6]) by smtp.gmail.com with ESMTPSA id l3sm2689062otu.6.2021.10.26.13.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 13:03:52 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 2/3] Fix LIBC_PROG_BINUTILS for -fuse-ld=lld Date: Tue, 26 Oct 2021 17:03:45 -0300 Message-Id: <20211026200346.3371750-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> References: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC does not print the correct linker when -fuse-ld=lld is used with the -print-prog-name=ld: $ gcc -v 2>&1 | tail -n 1 gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2) $ gcc ld This is different than for gold: $ gcc -fuse-ld=gold -print-prog-name=ld ld.gold Using ld.lld as the static linker name prints the expected result. This is only required when -fuse-ld=lld is used, if lld is used as the 'ld' programs (through a symlink) LIBC_PROG_BINUTILS works as expected. Checked on x86_64-linux-gnu. --- aclocal.m4 | 6 +++++- configure | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index c195c4db56..83da631822 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -114,8 +114,12 @@ if test -n "$path_binutils"; then path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'` CC="$CC -B$path_binutils" fi +case "$CC" in + *fuse-ld=lld*) LDNAME=ld.lld;; + *) LDNAME=ld;; +esac AS=`$CC -print-prog-name=as` -LD=`$CC -print-prog-name=ld` +LD=`$CC -print-prog-name=$LDNAME` AR=`$CC -print-prog-name=ar` AC_SUBST(AR) OBJDUMP=`$CC -print-prog-name=objdump` diff --git a/configure b/configure index 39d75eb4ed..2a28c58cd6 100755 --- a/configure +++ b/configure @@ -4549,8 +4549,12 @@ if test -n "$path_binutils"; then path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'` CC="$CC -B$path_binutils" fi +case "$CC" in + *fuse-ld=lld*) LDNAME=ld.lld;; + *) LDNAME=ld;; +esac AS=`$CC -print-prog-name=as` -LD=`$CC -print-prog-name=ld` +LD=`$CC -print-prog-name=$LDNAME` AR=`$CC -print-prog-name=ar` OBJDUMP=`$CC -print-prog-name=objdump` From patchwork Tue Oct 26 20:03:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 46674 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A8A23858010 for ; Tue, 26 Oct 2021 20:07:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A8A23858010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635278868; bh=dBhXg/IzEAC7Qt+sCmLNZtGNwv8YHB6h8laPj96Pe64=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NTub5LhTPz72CeBTZj4Ml1IC7x5qNkp9CHy5Q99g2OdUNB1bHTZOp6rFHsqh75N8x k1hHoqazwSVUa4ZAyE2koSEgpN00WJQKjatxB1yMmuFdz6tm0on9uPQC93B9c8k4oQ /9DU+KzczS4cZ7tLad9ZLkl+RM+UnAjvYLB7/6ew= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 2E59C385802E for ; Tue, 26 Oct 2021 20:03:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E59C385802E Received: by mail-ot1-x331.google.com with SMTP id s18-20020a0568301e1200b0054e77a16651so305116otr.7 for ; Tue, 26 Oct 2021 13:03:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dBhXg/IzEAC7Qt+sCmLNZtGNwv8YHB6h8laPj96Pe64=; b=tcX7qOQzyCJ9qlzYYTObU25tdoPRF9m3l/rQ86StmIqV/Wtbj0kkEzNytBRFyMVkQr 2a5UZFjsYKh3rjBJ2/DnIuugz+9+VJZn/dgoqenNO1HlQAruA7z/CXDPyL0Lc/16V5jT QpzD0h15n9RmAQjGjhCMTvPFNi+06yUj4ivo0st1XSgIgSYpwU2uPXG97QrZBKiyDMiJ KaZex3mfzmKNghTLujPepiSJUoXa3WJDFm5P+aP4m+pBvcFI3bQOEXVSJYpSd1YwtIhD b3Aa9AHE9+MYpN5EbSegZSdN5IhlW4tTYfh0wZmmx4j2lWQ/IzBKaSDHQv/AjuZLdusa 3zPA== X-Gm-Message-State: AOAM532Mf2a3NEoewjSlOESjh+zmr+q2SpwCNfcIuUigIpV/6+A0z2li 3CSc8pTd+iagCXcHXXdcjR1ZmPRxWQpNAw== X-Google-Smtp-Source: ABdhPJyHoZnlSnSFNiYWstrb10gqC6RKShg62AWJ6tgMmnHnWUxZATmKc3EHxtrTcaO/5VfNTAyAug== X-Received: by 2002:a05:6830:4487:: with SMTP id r7mr21215531otv.251.1635278634384; Tue, 26 Oct 2021 13:03:54 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:6672:308c:d549:2f1f:5bb6]) by smtp.gmail.com with ESMTPSA id l3sm2689062otu.6.2021.10.26.13.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 13:03:54 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 3/3] Check if linker also support -mtls-dialect=gnu2 Date: Tue, 26 Oct 2021 17:03:46 -0300 Message-Id: <20211026200346.3371750-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> References: <20211026200346.3371750-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Since some linkers (for instance lld for i386) does not support it for all architectures. Checked on i686-linux-gnu. Reviewed-by: Fangrui Song --- configure | 4 ++-- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 2a28c58cd6..c66082232e 100755 --- a/configure +++ b/configure @@ -6324,8 +6324,8 @@ void foo (void) i = 10; } EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2 - conftest.c 1>&5' +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles + conftest.c -o conftest 1>&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? diff --git a/configure.ac b/configure.ac index 00f49f09f7..7eb4239359 100644 --- a/configure.ac +++ b/configure.ac @@ -1493,8 +1493,8 @@ void foo (void) i = 10; } EOF -if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2 - conftest.c 1>&AS_MESSAGE_LOG_FD]) +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles + conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD]) then libc_cv_mtls_dialect_gnu2=yes else