[Bug lto/48200] Implement function attribute for symbol versioning (.symver)

xry111 at mengyan1223 dot wang gcc-bugzilla@gcc.gnu.org
Mon Dec 16 04:44:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200

--- Comment #41 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Jan Hubicka from comment #40)
> I posted initial patch here
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01334.html

I applied it into gcc-9.2.0 and it works.  But, unfortunately, the problem with
LTO and symver is not fixed.

A simple testcase fails:

$ cat foo.c
__attribute__ ((__symver__ ("foo@VERS_1")))
int foo_v1 (void)
{
        return 1;
}

__attribute__ ((__symver__ ("foo@@VERS_2")))
int foo_v2 (void)
{
        return 2;
}
$ cat version.map
VERS_1 {
global:
        foo;
local:
        *;
};

VERS_2 {
} VERS_1;
$ gcc foo.c -flto -Wl,--version-script -Wl,version.map -shared -Wl,--as-needed
--save-temp
$ cat foo.res
1
foo.o 4
211 93dd820662070d19 PREVAILING_DEF_IRONLY foo_v1
213 93dd820662070d19 PREVAILING_DEF_IRONLY foo@VERS_1
222 93dd820662070d19 PREVAILING_DEF_IRONLY foo_v2
224 93dd820662070d19 PREVAILING_DEF_IRONLY foo@@VERS_2
$ grep symver cc*.s || echo "no symver"
no symver


More information about the Gcc-bugs mailing list