From nobody Wed Feb 09 18:55:21 2022 X-Original-To: dev-commits-src-main@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 E84C719A5975; Wed, 9 Feb 2022 18:55:21 +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 4Jv8G164r1z4mdf; Wed, 9 Feb 2022 18:55:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644432921; 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=512i7d0ciyQ3Dfzc8DYR8+LCtNjWHg2t01n32JG6Ow4=; b=KIzYyXBDrROwncC3RgQlbyj+1thEIsY4FCYCKw0HY4M9mpWlMJnLY88pYKnckEJolWw945 quiwPO7Q3qD/5QB78pAeFgQWE+PyWkeqbAs+lgGUyEG2xhUbC17wKiAUyYipWVu65TQVxU ZdD8kWPMuiVqwxCDFHs5/SPH+S2m0qpqZ4zsSQ2bEOvFMCR0m5Lj3YoJcdLTPhtTvDJLFK dxfwoNPvgL5sgqWa+EAolscYh9k3rISizx07ifK4zuxqN7T4Yvd0c30EJ/EY75BQqsGUYn 9ARaIuOek5VJKoxa0HcekWu5JKcY2huCH24KBKR3MpzrTrSDTLBfln29evkb5A== 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 A775F12570; Wed, 9 Feb 2022 18:55:21 +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 219ItLQG040793; Wed, 9 Feb 2022 18:55:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 219ItLqa040792; Wed, 9 Feb 2022 18:55:21 GMT (envelope-from git) Date: Wed, 9 Feb 2022 18:55:21 GMT Message-Id: <202202091855.219ItLqa040792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ec81497cc726 - main - crunchgen: remove -dc from linker invocation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: ec81497cc7260b26c2af615c54aa80f515d6c539 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644432921; 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=512i7d0ciyQ3Dfzc8DYR8+LCtNjWHg2t01n32JG6Ow4=; b=heNHr70onGaYhtk6FxQenlgBsG+Vgc17fcYisHhbuVKW3wWySzz6r1qtJM0eCJSDU605H/ LoWKvVO+Iz1db7sgSsNyQSA5jJtCOHElM2wrIw4N2w0MISJwCGUyUbOnj0zRIHi5YkwQVh TalQ0qzeQS6pnT7cXx4OgIVAYgdVBRMAtAJf0QVqXvlw0q7EdCJY1aJWMW/J34Of2cPS1V UzHzj8dDXvRUEKRXcbmJ/pI44SQf9FxxmQGzu+WelgpiNDRzPuaKEmim56Lw1hlxFAgjAd jgiYvAPbSByV/BWuJ3Rqkw4HqQ4kbDMlWlesiShvkNdPf0ha6MQDMl9x8MS9+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644432921; a=rsa-sha256; cv=none; b=QqgwipVgOU97kTWxd2SP6QEPUcyVkMs4EW7FodpVV3BC4twl1DhNSrKmsmWBHivElPnbQa APNyC0vxgAB9FBVcsx0CIk3E7QGg+T2aAz+a+AobO3We1k0IUQW4ZSj74/g8qV91zA2gkl P03JmS5N76XPDrm71/d1gLLj/B3vHVmdacOaVkVqg8+Kn3/ixRV5cWlKMQEm2FZGkVTll7 belg9Z8/bBh70BSOGG5VziJHoyOQzuOe+gvY6bDzZzmrDvSsWiPDiVTJihp1oaDBeDvvcv q3NLvI42H2x1X9uhLCSt4YUnYCrRKVKadPFNlAEerzyHoZ60Uwu7B5b2IbaPxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ec81497cc7260b26c2af615c54aa80f515d6c539 commit ec81497cc7260b26c2af615c54aa80f515d6c539 Author: Fangrui Song AuthorDate: 2022-02-09 00:59:53 +0000 Commit: Ed Maste CommitDate: 2022-02-09 18:54:35 +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 --- 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 89d549b18b4e..63ce727496b7 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -1123,7 +1123,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