From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id C9B523858D1E for ; Fri, 29 Apr 2022 06:00:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9B523858D1E Received: by mail-pf1-x42a.google.com with SMTP id j6so6072716pfe.13 for ; Thu, 28 Apr 2022 23:00:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ugYup1j/EwjTrJKX9/I7BZr55yNZRi+8zECaPYVw7gs=; b=X3F6UUowsCRcOSnJSmdhPDERzvSvP/6/jAqgDSfmubwxRp4yPpW3i9rcXcxDL0bnTy 74cT4xc02T1IFBi59Ia9/TnIQt9eLxVAapeqD1smblPnAXxxHmXTGCSIDM92C4k2qkWg LwuCbgT3evb9UHh4zzYsHN05VddDsUAQhWY0lKGuk2yZtwkiI1G8IfvtzaiS6kisPE+L JaTtxslS74McycqdV2ZgyW/6ZYZ5THLe1qAOItS+POLpnw914PLAzlWMpcq5x1GFkfMl ZoADHLTgQcmdFwZcCzWwGnf6GkR7ghyfLG9Acoxh5XVA/6GK0t2xiOZAy6HfCV7y0CvM FbhA== X-Gm-Message-State: AOAM533vy1WLNi0Yph2hPyzW4VO0vTsgbrxtzn/6JTIlUlbIpEjrAHGj BU07oJy/0GoinC40Q1L4yi54y53NpndvCw== X-Google-Smtp-Source: ABdhPJwvleCxzon3Hxu5EdEfXbsW/iINz2eyScQSdk/ui8QUgYDUz6LigaWZ4is4UX2m2jf83oCcgw== X-Received: by 2002:a05:6a00:1399:b0:50d:b1e0:9350 with SMTP id t25-20020a056a00139900b0050db1e09350mr1610692pfg.20.1651212045668; Thu, 28 Apr 2022 23:00:45 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:fb4f:b611:3fdd:bd70]) by smtp.gmail.com with ESMTPSA id e126-20020a621e84000000b0050567191161sm1648501pfe.210.2022.04.28.23.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 23:00:45 -0700 (PDT) Date: Thu, 28 Apr 2022 23:00:41 -0700 From: Fangrui Song To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3 2/2] Default to --with-default-link=no (bug 25812) Message-ID: <20220429060041.n24pkmlujglkumer@google.com> References: <15c7f6e9afe2c2b9c51ebc6372682a39b0932712.1649691083.git.fweimer@redhat.com> <20220428072502.4rpxnlreq72sgv5x@google.com> <87zgk5bnxo.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87zgk5bnxo.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-19.9 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.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-List-Received-Date: Fri, 29 Apr 2022 06:00:49 -0000 On 2022-04-28, Florian Weimer wrote: >* Fangrui Song: > >> I use chromium's prebuilt clang/lld and do something like: >> >> curl -s https://raw.githubusercontent.com/chromium/chromium/main/tools/clang/scripts/update.py | python3 - --output-dir=~/Stable >> sudo ln -sf ~/Stable/bin/lld /usr/local/bin/ld >> >> so that gcc will use ld.lld. >> >> ld.lld doesn't have a built-in linker script (ld.bfd --verbose), so $@T will be empty and `test -s $@T` will fail. >> I wonder how to better support ld.lld with the default --with-default-link=no ... > >How does lld place sections without a linker script? Purely based on >names? It entirely uses code to describe the built-in rules like gold, while GNU ld uses an internal linker script plus built-in code. (some rules cannot be described by the linker script language and needs code anyway). There is no support dumping lld/gold's built-in rules into a linker script. I will add DATA_SEGMENT_RELRO_END support to ld.lld: https://reviews.llvm.org/D124656 . With the patch, ld.lld can read shlib.lds transformed from ld.bfd --verbose output. I can think of 3 ways for lld: * ask lld users to use --with-default-link=yes * remove `test -s $@T` (if lld) * add -fuse-ld=bfd >> Besides, the position of .hash in --with-default-link=no seems weird. >> 71213dc2589554dc8f8061e9b04e80c55d098b6a (2006-09) moved it to the end >> of the RO segment. > >I think it's odd that we have an old-style hash table at all. Do we >really need it? All tools should have migrated by now. We can remove .hash for non-mips architectures. (I am a bit sad .MIPS.xhash support went in, but thankfully it doesn't take too much code. The translation table could be solved in a better way. I suspect the whole thing is unnecessary with RELR.)