From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 604B6388C035 for ; Tue, 5 Jan 2021 22:58:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 604B6388C035 Received: by mail-pj1-x1036.google.com with SMTP id z12so551364pjn.1 for ; Tue, 05 Jan 2021 14:58:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yYhA3EOliyP8qt/jM0ZTUQLK8rfl8k8MGjpYb6WafAw=; b=NUXO3wkSO/n+fOzy4jvBecqu6kAJ6eB61fZd9sghAzCU8hMmWH9EOYOU+ok5SmH8JE /OgC5rCW5/GyaEX/CLKi9NIRgo6yC2yDCbdjsvmaHTZW15sIRJ3m73s9ZDEXrYGqS8Ny IiO35SxDIbubEvm7V9IfB4S7QbGErXoMqHLjSo1Xec3BZn6LFAmhjKZC9H47RJJpln9D dYj7dl6OjS5c6hYwY/dFIOS+y/brymbXBZEhLqGPY9syGHcvG1+BpaVzVR4L0fW6A7Ls E/2PNiSKqTJEgg89HLnrVFtd7ctKp1+AOVqRxvAOw7tGDfsOHnzUUiRm8k95P1G3VW5p 3I0Q== X-Gm-Message-State: AOAM530HQac+jiVLrlIahfrZgdr1u7VwSIzgBeE5EbF9DbWtqcfcZNxI 7q6r2Xqw/+/W+MCzs8FoGZ4/qe9rxueJufrgGmCWJQ== X-Google-Smtp-Source: ABdhPJypp+TzB6ttRCsLUmwXYoVO6K3Uk36sOOZ8ZPqHTBqPyEyMANdv5YBFY2UkmAf6c7eauzqrVbJ3bZ4pmeOGsRc= X-Received: by 2002:a17:90a:bc01:: with SMTP id w1mr1323105pjr.173.1609887490419; Tue, 05 Jan 2021 14:58:10 -0800 (PST) MIME-Version: 1.0 References: <20201228194855.510315-1-maskray@google.com> <20201228214541.phbfjgv2ft3mgikj@google.com> In-Reply-To: From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Tue, 5 Jan 2021 14:57:59 -0800 Message-ID: Subject: Re: [PATCH 0/3] Make glibc build with LLD To: "H.J. Lu" Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Tue, 05 Jan 2021 22:58:13 -0000 On Mon, Dec 28, 2020 at 1:50 PM H.J. Lu wrote: > > On Mon, Dec 28, 2020 at 1:45 PM Fangrui Song wrote: > > > > On 2020-12-28, H.J. Lu wrote: > > >On Mon, Dec 28, 2020 at 11:49 AM Fangrui Song via Libc-alpha > > > wrote: > > >> > > >> I sent the first two in April. Resending in a patch series to be > > >> clearer. > > >> > > >> install: Replace scripts/output-format.sed with objdump -f > > >> > > >> replaced https://sourceware.org/pipermail/libc-alpha/2020-April/112733.html > > >> by leveraging objdump -f. > > >> > > >> With this patch series (available in https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/lld), > > >> `make` with ld pointing to ld.lld (LLVM linker) works. > > > > > >I tried your branch with "LLD 11.0.0 (compatible with GNU linkers)" on > > >Fedora 33/x86-64, > > >"make check" generated: > > > > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod2.so] > > >Error 1 > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod4.so] > > >Error 1 > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-absolute-sym-lib.so] > > >Error 1 > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-absolute-zero-lib.so] > > >Error 1 > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod6.so] > > >Error 1 > > >make[4]: *** [../Makerules:767: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod5.so] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-audit16] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-audit14] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-audit15] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tls1] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/ifuncmain5] > > >Error 1 > > >make[4]: *** [../Rules:226: > > >/export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/ifuncmain1] > > >Error 1 > > >make[3]: *** [Makefile:479: elf/tests] Error 2 > > > > > >with error messages, like > > > > > >ld: error: /export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod2.os > > >has an STT_TLS symbol but doesn't have an SHF_TLS section > > >ld: error: /export/users/hjl/build/gnu/tools-build/glibc-gitlab-lld/build-x86_64-linux/elf/tst-tlsmod4.os > > >has an STT_TLS symbol but doesn't have an SHF_TLS section > > > > tst-tls* tests appear to be similar to .tls_common which looks very > > obsoleted and not supported by Clang. I don't think ifuncmain* or > > tst-audit* matters for typical usage (most users) but I can take a look. > > "make check" should be clean on Fedora 33/x86-64. > > > >When glibc is configured with --enable-static-pie, I got > > > > > >[hjl@gnu-skx-1 build-x86_64-linux]$ ./elf/ldconfig > > >Segmentation fault (core dumped) > > >[hjl@gnu-skx-1 build-x86_64-linux]$ > > > > > >You need to fix lld first and give the working lld a proper version so that > > >configure can check it. > > > > I cherry picked "Make _dl_relocate_static_pie return an int indicating whether it applied relocs." > > in google/grte/v5-2.27/master, which has fixed the issue. > > Why isn't it needed for ld? > > -- > H.J. "Make _dl_relocate_static_pie return an int indicating whether it applied relocs." makes glibc build with both GNU ld and LLD. Without the commit, elf/ldconfig segfaults with LLD but works with GNU ld because the code relies on the undefined weak __rela_iplt_start/__rela_iplt_end to be null. % ld.bfd --verbose | grep rela_iplt_start PROVIDE_HIDDEN (__rela_iplt_start = .); % ld.bfd -pie --verbose | grep rela_iplt_start % ld.bfd -shared --verbose | grep rela_iplt_start I don't think this justifies a different behavior in ld.