Bug 16833 - ld refuses to mix ordered and unordered sections
Summary: ld refuses to mix ordered and unordered sections
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-11 12:44 UTC by Rainer Orth
Modified: 2020-07-17 04:24 UTC (History)
1 user (show)

See Also:
Host: i386-pc-solaris2.11
Target: i386-pc-solaris2.11
Build: i386-pc-solaris2.11
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2014-04-11 12:44:18 UTC
While testing a new Solaris/x86 assembler that does support cfi directives, I ran
into a link failure while bootstrapping gcc mainline with that /bin/as and gld 2.24:

/vol/gcc/bin/gld-2.24: .eh_frame has both ordered [`.eh_frame' in _muldi3_s.o] and unordered [`.eh_frame' in /usr/lib/amd64/crti.o] sections
/vol/gcc/bin/gld-2.24: final link failed: Bad value
collect2: error: ld returned 1 exit status

/bin/as sets SHF_LINK_ORDER in .eh_frame, but as you can see, the bundled crti.o
lacks that flag.

The question is: what's the basis for this refusal: I see nothing of the kind
in the current ELF gABI:

        http://www.sco.com/developers/gabi/latest/ch4.sheader.html

I see that this check (without the error messages) is already in the original
submission:

        [patch] Honour SHF_LINK_ORDER
        https://sourceware.org/ml/binutils/2004-07/msg00197.html
and
        https://sourceware.org/ml/binutils/2004-07/msg00200.html

but no justification either.

Why not just emit the sections with SHF_LINK_ORDER set in order and add in the
rest behind?

  Rainer
Comment 1 Fangrui Song 2020-07-17 04:24:16 UTC
Ah, just saw this. I just filed bug 26256 with a recent discussion.