From owner-dev-commits-src-all@freebsd.org Sat Jun 26 16:28:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D303656413; Sat, 26 Jun 2021 16:28:22 +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 4GBznf0P0Vz3CrW; Sat, 26 Jun 2021 16:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E910421F63; Sat, 26 Jun 2021 16:28: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 15QGSLW4035162; Sat, 26 Jun 2021 16:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QGSL4K035161; Sat, 26 Jun 2021 16:28:21 GMT (envelope-from git) Date: Sat, 26 Jun 2021 16:28:21 GMT Message-Id: <202106261628.15QGSL4K035161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: f2ef124469ae - stable/12 - linker_set: fix globl/weak symbol redefinitions to work on clang 12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f2ef124469aef4ba17fb201d5412b04cc298bd2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2021 16:28:22 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f2ef124469aef4ba17fb201d5412b04cc298bd2a commit f2ef124469aef4ba17fb201d5412b04cc298bd2a Author: Greg V AuthorDate: 2021-04-20 00:47:15 +0000 Commit: Mateusz Guzik CommitDate: 2021-06-26 15:52:06 +0000 linker_set: fix globl/weak symbol redefinitions to work on clang 12 In clang 12.0.0.rc2, going from weak to global is now a hard error: ``` /usr/src/stand/libsa/amd64/_setjmp.S:67:25: error: _longjmp changed binding to STB_GLOBAL .text; .p2align 4,0x90; .globl _longjmp; .type _longjmp,@function; _longjmp:; .cfi_startproc ``` And the other way is a warning, but we have -Werror: ``` error: __start_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm] error: __stop_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm] ``` ref: https://reviews.llvm.org/D90108 Reviewed By: arichardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29159 (cherry picked from commit 32231805fbe2b9438c2de50c229b43c016207a08) --- sys/sys/cdefs.h | 4 ++-- sys/sys/linker_set.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index a2625a1ed5b4..c8485fa58f54 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -569,8 +569,8 @@ #endif /* __STDC__ */ #endif /* __GNUC__ || __INTEL_COMPILER */ -#define __GLOBL1(sym) __asm__(".globl " #sym) -#define __GLOBL(sym) __GLOBL1(sym) +#define __GLOBL(sym) __asm__(".globl " __XSTRING(sym)) +#define __WEAK(sym) __asm__(".weak " __XSTRING(sym)) #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index 9f49b802887b..b67ed51551a6 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -57,8 +57,8 @@ */ #ifdef __GNUCLIKE___SECTION #define __MAKE_SET_QV(set, sym, qv) \ - __GLOBL(__CONCAT(__start_set_,set)); \ - __GLOBL(__CONCAT(__stop_set_,set)); \ + __WEAK(__CONCAT(__start_set_,set)); \ + __WEAK(__CONCAT(__stop_set_,set)); \ static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ __used = &(sym)