On 2019-12-17 09:32 +0100, Jan Hubicka wrote: > > Hi, > > with Jan's patch commited in r278878 we can use symver attribute for > > functions > > and variables. The symver attribute is designed for replacing toplevel asm > > statements containing ".symver" which may be removed by LTO. Unfortunately, > > a quick test shown GCC still generates buggy so file with LTO and new symver > > attribute. > > Thanks for looking into this. It was on my TODo list to actually > convert some packages, so it is great you did that. > > Two issues: > > > > 1. The symver node in symtab is marked as PREVAILING_DEF_IRONLY (no EXP) and > > then removed by LTO. > > This is however wrong - linker should not mark it as > PREVAILING_DEF_IRONLY if it is used externally. What linker do you use? > On my testcases this was working with > GNU ld (GNU Binutils) 2.31.51.20181222 > I could easily imagine that some linkers get it wrong which should be > reported to bintuils bugzilla but it is also easy to work around as done > in your patch.
Hi Jan, I'm using GNU ld 2.33.1. I'll attach a testcase simplified from fuse-3.9 code. "local: *;" in the versioning script triggers the issue. Without it there would be no problem. > > 2. The actual function body implementing the symver-ed function is also > > marked > > as PREVAILING_DEF_IRONLY and then removed or marked as local. So no > > ".globl" > > directive is outputed for it. > > Here is the symver-ed function exported from the DSO (or is it set > to have hidden attribute)? > Again this was working for me, so it would be good to understand this > issue. It's also triggered by "local: *;". Untar the attachment and use "make" to build it, then "make show-dynamic-syms" to dump the dynamic symbol table. I believe (with 99% chance) you'll see only foo (VERS_1) and foo_v1 (because foo_v1 is marked as global in the version script). And foo (VERS_2) would be missing. With this patch foo (VERS_2) would show up. We can't mark "foo_v2" to be "global" because it should not be a part of DSO ABI. The other 1% chance would be a regression in Binutils. -- Xi Ruoyao <xry...@mengyan1223.wang> School of Aerospace Science and Technology, Xidian University
pr48200.tar.gz
Description: application/compressed-tar