From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id D9B8A385DC06 for ; Tue, 14 Apr 2020 15:25:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D9B8A385DC06 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 1F567302BB23 for ; Tue, 14 Apr 2020 17:25:55 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id DF357409BFBF; Tue, 14 Apr 2020 17:25:54 +0200 (CEST) Message-ID: Subject: Re: [PATCH] lib: Use attribute symver when available to define symbol versioning. From: Mark Wielaard To: elfutils-devel@sourceware.org Date: Tue, 14 Apr 2020 17:25:54 +0200 In-Reply-To: <20200410194237.31277-1-mark@klomp.org> References: <20200410194237.31277-1-mark@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 15:25:58 -0000 Hi, On Fri, 2020-04-10 at 21:42 +0200, Mark Wielaard wrote: > GCC 10 introduces a function attribute to define symbol versioning. > Add a configure check to see if __attribute__((symver)) is supported. > If it is then define the OLD_VERSION, NEW_VERSION, COMPAT_VERSION > and COMPAT_VERSION_NEWPROTO macros using just attribute symver, > attribute alias and typeof function names. And avoid defining symbols > in asm statements. Turns out this almost, but not completely work. > +#define NEW_VERSION(name, version) \ > + __attribute__((__symver__(#name "@@" #version))) \ > + __typeof__ ( name ) name ; Using the two @@ variant keeps the original name in the symbol table, which will cause that symbol to be doubly marked as a version symbol my the linker. We really need the tripple @@@ variant which will actually rename and remove the original non-versioned name. But gcc10 attribute((symver)) only accepts the single and double @ variants. I am looking how to work around this. The gcc function attribute documentation implies that you shouldn't use the bare non-versioned symbol name, but that is precisely what we do (so we don't have to mark up each symbol, but can simply rely on the linker version map script). Back to the drawing board... Cheers, Mark