From nobody Thu Feb 17 01:13:57 2022 X-Original-To: dev-commits-src-branches@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 38D5B19D2536; Thu, 17 Feb 2022 01:13:58 +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 4JzcKf0pF8z4j1h; Thu, 17 Feb 2022 01:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645060438; 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=tTWRiZ+/U7YNFPlFE9oMoAUH5Wxvi47L5IvrgX2ZTMk=; b=TK2OzKaiNUfOlPSI/TO63wQlBVVy5kYqbpIsX4cXlrbhp/q7+jXmLlXQbbWihwSYNFZh6r RvlLyn8ibm0u3+VYtDdbpZP7CuMobYxNZ8NN3TtWl5eJpNRqmNMjXkoqF7qTiGeWL9sVhT qVHJ+dxYfvYYRvBhNq7Ilo8UGGlvMBDWroxGsm3DspIHIQHjJYePCahoCsOHduvFb5Bn+F chDX6Fu3NY+0ZAubbAdgRarZNNp1JaNnBC1gMMOTQcyDevc7/UGXfHanLaF7BZ5DqbMHc6 dBQF0fNG7zmK0/JFedvXAXByvOUnxnyMbEm4Ms1WQ4i68nr/MC/jcEDTSu4GoA== 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 F10B520C0D; Thu, 17 Feb 2022 01:13:57 +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 21H1DvNi042499; Thu, 17 Feb 2022 01:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21H1DvvW042498; Thu, 17 Feb 2022 01:13:57 GMT (envelope-from git) Date: Thu, 17 Feb 2022 01:13:57 GMT Message-Id: <202202170113.21H1DvvW042498@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: 332166892ef3 - stable/12 - crunchgen: remove -dc from linker invocation List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/12 X-Git-Reftype: branch X-Git-Commit: 332166892ef341664a733e581ea99c0adad17566 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645060438; 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=tTWRiZ+/U7YNFPlFE9oMoAUH5Wxvi47L5IvrgX2ZTMk=; b=bUeTDLUhSnBBED9nbbP59RJxG5kxCgCehFMVIv04isA/NkjYC5CTQ6i+Ab3p61mz0dZ8De EplgZFI9V+tPCudoJbAYSMeAZPNNElxpU8eYlVIHAeUAoHh1t2rqwz1yGCW9C9pxZN5tZ0 y06/wk1ICVWdjPoM8RFodfzEu52ct3HyOms9RMbCaoTnRnxgXhNNE8/KSkX8Vh2hQWp8Fa 9h4bHHdvH/zyObWfIuFh7RLE6m5b22sdiclXA+mC2E+SbLJT5y/FrYTJRGAppwhOr1TE3Z PAeTnbESzCveOYL9ooNfPNmm/iSJO5jbdoLd7vKmu+aR/syBsnbBZCRnrDG+eA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645060438; a=rsa-sha256; cv=none; b=IZ/ryi45W4KVobZoZkoyTpjXno1YegR5ZATtTloxtijwCUpI2znB0iXau7UtSiMX7xfX+b oUP0wxprwklCF0h58EUZeWVBQk9BDyLxF3F2G+8aLjwrpEi+mdVTe1ei+T3KpPJ2Pk7Azz fmxNgwBp/mmc5ybs2f9tPRwRm5c/WfCiswvP8JIRa5nt5R0VnUKLDedyBoU3OVuBa07iI2 t37N9kXOTgEnvQYY9/TWShtTHsnIzw49o0YxJwXYVKoMH3UToGLbLXSR0/uAzvMxqVG8Ta 7NXMVqYYqJPKXWucivdC29l8XfzFH/9+TvpvyRYEcANDCDrZZ39miAJEcZHF4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=332166892ef341664a733e581ea99c0adad17566 commit 332166892ef341664a733e581ea99c0adad17566 Author: Fangrui Song AuthorDate: 2022-02-09 00:59:53 +0000 Commit: Ed Maste CommitDate: 2022-02-17 01:07:30 +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