From patchwork Mon Oct 25 14:53:08 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: 46621 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 2899F3858433 for ; Mon, 25 Oct 2021 14:53:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2899F3858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635173613; bh=35LSHTiwPpnUjt8m80L0kpP6IJWRwWybcaWp7uHN75M=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=K1YUkcXTG2fV0oXgjZohq2OqlkVWcOacqrhea7mfqQh6ZQl6aPPyshVOhqIxzfUwm zudp5MRbKmkjIr9vG/g747CR2O87aneLYNyEPRYZnDI7sU3McADxl/mmzwtUts6zue VBHYbZnwNRsEKIwCfqluq6I74EdMkZrLxwU01AmQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by sourceware.org (Postfix) with ESMTPS id 7BC0B3858C27 for ; Mon, 25 Oct 2021 14:53:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7BC0B3858C27 Received: by mail-ua1-x92d.google.com with SMTP id u9so12691707uac.8 for ; Mon, 25 Oct 2021 07:53:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:content-transfer-encoding; bh=35LSHTiwPpnUjt8m80L0kpP6IJWRwWybcaWp7uHN75M=; b=SH/HPzLJTE3a/Pr9xytEMMA4H/2g2e/7u1Q7DX/qMxDY+xapuvrbsEU0bLUTiy0HhE fTkcxUuWlPoy/aDRtuhSY3gnHOTnbRpZmo8CmH1e0zQNRtd0Mw3fRUDTrWYMBJE+liO5 4STFKVuGnF6WUFCWfxLaHEHOoQ2ELpDk6AnqA61pMiIlDXsczWpjAJV7IsvJxAB6soAT 1AitvgMhrQ0fZQAcPwY7RrCFpzMZAqr7pWUxhPIgd2b91TEEM7nuGta5D2qjF4iaHmYx m4n6ml6KHjeKcDWJU5bhOW7qfjQrSeRvMSZr8xhn0DCAxS5dwkyCpCf0s0NR0ouqdYCH eOIA== X-Gm-Message-State: AOAM533A/hv8YR5eJphcKcRBJmggeazAlSYH/B8XFWCt0ksdhDUvlTa6 zGSdp8Jp9eA0DbBMSffOAH5giA== X-Google-Smtp-Source: ABdhPJzl4JTt+2j//ITnTnOMeRJ9AkmAJpA9VZ3//b0Oeut9MzJEGui+sDPsy9qkCH8zzNDzHwDUBQ== X-Received: by 2002:ab0:6808:: with SMTP id z8mr15074141uar.130.1635173590921; Mon, 25 Oct 2021 07:53:10 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:2654:4c60:ad20:95b6:1d6c? ([2804:431:c7ca:2654:4c60:ad20:95b6:1d6c]) by smtp.gmail.com with ESMTPSA id d22sm10512668uan.15.2021.10.25.07.53.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 07:53:10 -0700 (PDT) Message-ID: Date: Mon, 25 Oct 2021 11:53:08 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Content-Language: en-US To: Fangrui Song , "H.J. Lu" , Libc-alpha Subject: LLD and glibc X-Spam-Status: No, score=-12.7 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" I tracked down the issues with lld on glibc and it seems slight better than my previous attempt. To use lld without having to mess with my toolchain installation, I was trying to use -fuse-ld=lld plus -B option. However it does not work correctly with the LIBC_PROG_BINUTILS macro, since it issues the passed CC with -print-prog-name=ld. In this case gcc will always dump the ld path, not the lld (it does work if I use -print-prog-name=lld). I think this is a gcc issue since it should be agnostic whether -fuse-ld is used, but I think we can try to workaround it on glibc configure (use the -fuse-ld argument on -print-prog-name if the former is presented). So to actually use lld I had to adjust the links on my build-many-glibcs built toolchain to explicit point to lld (both bin/x86_64-glibc-linux-gnu-ld and x86_64-glibc-linux-gnu/bin/ld). The new issue is the same H.J has reported some time earlier: ld: error: cannot preempt symbol: foo_protected >>> defined in /home/azanella/Projects/glibc/build/x86_64-linux-gnu-lld/elf/ifuncmod5.so >>> referenced by ifuncmain5.c:22 (/home/azanella/Projects/glibc/glibc-git/elf/ifuncmain5.c:22) >>> /home/azanella/Projects/glibc/build/x86_64-linux-gnu-lld/elf/ifuncmain5.o:(get_foo_protected) I think we should just disable the tests ldd does not support (with the patch below) instead of get back of the discussion whether it should be supported or not. The good news is with release clang+llvm 13 and with the testcase patch I could build and run make check successfully without any regression. I am writing this because we need to fix both issues (configure with -fuse-ld and the failure on make check) so we can start review the DT_RELR patchset [1] [1] https://patchwork.sourceware.org/project/glibc/list/?series=3895 Reviewed-by: Fangrui Song diff --git a/elf/Makefile b/elf/Makefile index bdcf4cb885..7ddc4b39a3 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 \ + ifuncmain5pic ifuncmain5staticpic \ ifuncmain7 ifuncmain7pic +ifeq (no,$(with-lld)) +test-internal += ifuncmain1 ifuncmain5 +endif ifeq (yes,$(have-gcc-ifunc)) tests-internal += ifuncmain9 ifuncmain9pic endif @@ -451,7 +454,10 @@ 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