Bug 1576362 - binutils: annobin notes and discarded sections
Summary: binutils: annobin notes and discarded sections
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 29
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1576363
TreeView+ depends on / blocked
Reported: 2018-05-09 09:31 UTC by Florian Weimer
Modified: 2019-10-15 13:25 UTC (History)
5 users (show)

Fixed In Version: binutils-2.30-20.fc29
Doc Type: No Doc Update
Doc Text:
Clone Of:
Last Closed: 2019-10-15 13:25:33 UTC
Type: Bug

Attachments (Terms of Use)
func.S (774 bytes, text/plain)
2018-05-09 09:31 UTC, Florian Weimer
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1605019 0 unspecified CLOSED ld fails with "defined in discarded section", e.g. stockfish: FTBFS in Fedora rawhide 2021-02-22 00:41:40 UTC

Internal Links: 1605019

Description Florian Weimer 2018-05-09 09:31:31 UTC
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

Comment 1 Nick Clifton 2018-05-14 16:38:46 UTC
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.

Comment 2 Raphael Groner 2018-07-26 06:12:23 UTC
Not sure if bug #1605019 was a duplicate.

Comment 3 Jan Kurik 2018-08-14 11:19:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Note You need to log in before you can comment on or make changes to this bug.