Created attachment 1433703 [details]
Steps to reproduce:
$ gcc -Wa,--generate-missing-build-notes=yes -o foo.o -DFUNC=foo -c func.S
$ gcc -Wa,--generate-missing-build-notes=yes -o bar.o -DFUNC=bar -c func.S
$ ld -r foo.o bar.o
bar.o: In function `foo':
(.text+0x0): multiple definition of `foo'
foo.o:(.text+0x0): first defined here
`.gnu.linkonce.t.__x86.get_pc_thunk.ax' referenced in section `.gnu.build.attributes' of bar.o: defined in discarded section `.gnu.linkonce.t.__x86.get_pc_thunk.ax' of bar.o
I don't see a workaround.
This happens within the glibc build after reducing the scope of -Wa,--generate-missing-build-notes=yes as far as possible. I thought that I had enabled these notes before, but I did not, so I didn't notice the bug until now.
Seen with: binutils-2.30-18.fc29.i686
I have applied a patch to the assembler to stop it generating build notes
when dealing with linkonce sections. Not an ideal fix, since the linkonce
section that it retained will not have notes (unless they were generated by
the compiler), but at least it will allow assembly to proceed.
Fixed in: binutils-2.30-20.fc29.
Not sure if bug #1605019 was a duplicate.
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.