From nobody Thu Feb 17 01:13:36 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DDC6619D2387; Thu, 17 Feb 2022 01:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JzcKD547Yz4j8V; Thu, 17 Feb 2022 01:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645060416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7oOP4iu0rLIMkj3V8KWB1MYrXMADfLzZXNbbD84M1iE=; b=K2hjM68cjRAPKl24nGHjsStA4UVHMR8s2p5Hdi/+N2GDLp90sIWxIaL/2MaiX2lyk+CZFx YUBdyw+one6tbEyEzj7oEmkRAqWYtbaZpsbyMpGT8QTosEU5LdeP+Iw8gu0kWE6HqKmNPk ZqjllIg32PHw9V8kzYeb+73Yt1tKkUMkyDqEi0dYThuw3LiZDz8FCh58LHShmy03McdZjp 665Jouwm+o0pUwqQy3vQM19qokNRqjnpH8tTVO0FZBDsiyNSzjwHHVhkrz9uWe2hm7DwB4 T+0jfJKqYSKreR1ND1/CpYFSOOQREgA9n4si6j90KAC3uWSy9MTeZH6JVTFMpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8397220B93; Thu, 17 Feb 2022 01:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21H1Da7D042347; Thu, 17 Feb 2022 01:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21H1DaYc042346; Thu, 17 Feb 2022 01:13:36 GMT (envelope-from git) Date: Thu, 17 Feb 2022 01:13:36 GMT Message-Id: <202202170113.21H1DaYc042346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 31ec0c5834b0 - stable/13 - crunchgen: remove -dc from linker invocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31ec0c5834b051a512508ba3291e6b848d4643e5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645060416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7oOP4iu0rLIMkj3V8KWB1MYrXMADfLzZXNbbD84M1iE=; b=MyK3d8YSJWIH8VbfvFKTxNXlwSGz1TwbhsmZOF6dizqlvXlR0HK+IyU/qckRO709MNlL4j tjgruiWTUxIGx3WasOWrYzz1odk3HVXUp/elmdOMD38FXzH6efbiQngEcoEz9r1C7z8r4d tJ15Tn7MYnEimabQXvO0JioKo9+bDhSx4dTv0aHIYWHxaB/EiJuwcroOSaunqdacnpznS/ ViGr3nswVMrNwslN3t1aUpxnPmnqbCBifCe+7+mehfm32ZYkzc2BRunfZVRlmQy67YhHPa Ukk2//7e1vAe7tlnsYimrUqSz4WXen6et+fJ3Kah3kI8J9YLnehM8FWnyVn8iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645060416; a=rsa-sha256; cv=none; b=fArH0GdCIRGQhOlExMqDjzvwBsQYX2CKj9qbvA0pqPT/j2jlmQzUQMswMnIbjCeUg80uH8 54ijjG7G4A0zDeCCrQcg/vXXHwZ/YgoUT3Ua+KGNWlOxXIBqY3Bqu7cLSQoTao4bGVjqgg 24cIMOxkPqq9fKtjH4VYi2hf+QKm9tcJoFmlRSXAgqJ3geSBfmAdxLrSKqzbCL/wSijSwi X2++THIKKid4Kwg/lUrt1mdDKEl0Nd8mF44hekQPnbSm7fjIJKuV6G6mATKqH8AcMh2Qyo flEVoknIJ6GloxMyXJRynPRnN+KYqfyyoWxLWct+a7FMquwGoTm31iikNoabng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=31ec0c5834b051a512508ba3291e6b848d4643e5 commit 31ec0c5834b051a512508ba3291e6b848d4643e5 Author: Fangrui Song AuthorDate: 2022-02-09 00:59:53 +0000 Commit: Ed Maste CommitDate: 2022-02-17 01:03:53 +0000 crunchgen: remove -dc from linker invocation In GNU ld and ld.lld, -dc is used with -r to allocate space to COMMON symbols. It is presumably to work around legacy code which cannot handle COMMON symbols in relocatable output. ld.lld may remove -dc or make it a no-op for the 15.0.0 release. As of 7420b323a014 crunch/crunchide does not require -dc, as the symbol hiding technique no longer relied on making symbols local. In addition -fno-common is now the default in Clang and GCC, so -dc serves no purpose as the compiler does not generate COMMON symbols anyway. See https://maskray.me/blog/2022-02-06-all-about-common-symbols for more detail on common symbols. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D34215 (cherry picked from commit ec81497cc7260b26c2af615c54aa80f515d6c539) --- usr.sbin/crunch/crunchgen/crunchgen.c | 2 +- usr.sbin/crunch/crunchide/crunchide.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c index 94792c5ec50b..9d603abc9114 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -1137,7 +1137,7 @@ prog_makefile_rules(FILE *outmk, prog_t *p) fprintf(outmk, " $(%s_LIBS)", p->ident); fprintf(outmk, "\n"); - fprintf(outmk, "\t$(CC) -nostdlib -Wl,-dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", + fprintf(outmk, "\t$(CC) -nostdlib -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", p->name, p->name, p->ident); if (p->libs) fprintf(outmk, " $(%s_LIBS)", p->ident); diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index 1f2f98893bac..bd663e1d57bd 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -28,9 +28,7 @@ /* * crunchide.c - tiptoes through a symbol table, hiding all defined * global symbols. Allows the user to supply a "keep list" of symbols - * that are not to be hidden. This program relies on the use of the - * linker's -dc flag to actually put global bss data into the file's - * bss segment (rather than leaving it as undefined "common" data). + * that are not to be hidden. * * The point of all this is to allow multiple programs to be linked * together without getting multiple-defined errors. @@ -40,7 +38,7 @@ * int foo_main(int argc, char **argv){ return main(argc, argv); } * like so: * cc -c foo.c foostub.c - * ld -dc -r foo.o foostub.o -o foo.combined.o + * ld -r foo.o foostub.o -o foo.combined.o * crunchide -k _foo_main foo.combined.o * at this point, foo.combined.o can be linked with another program * and invoked with "foo_main(argc, argv)". foo's main() and any