This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold input section handling


David Miller <davem@davemloft.net> writes:

> When trying to build a sparc64 Linux kernel with my sparc gold target
> I get an assertion failure in Output_data_dynamic::set_info_section().
>
> The reason is that the input objects to the link are using different
> section flags for a particular section.
>
> The section '.devinit.data' in one object uses just SHF_ALLOC, and in
> another it used (SHF_ALLOC | SHF_WRITE).
>
> Gold doesn't like this, as it uses the flags as a unique key for
> output section lookup.
>
> The BFD linker allows this, and simply or's together all of the input
> instance's section flags in the output section's flags.

Yes.  I believe that gold's behaviour is more correct.  It should be
possible to have different input sections with the same name but
different flags.  In general ELF linkers should not rely heavily on
the name to determine semantics.  At least some other ELF linkers
behave the way gold does.

Because the Linux kernel is not reliable about setting section flags
in assembler source, gold has exceptions such that it will combine
sections with zero flags with sections with non-zero flags if they
have the same name.

Because gcc uses an optimization for the .eh_frame section, making it
read-only possible and read-write when necessary, gold has an
exception for the .eh_frame section.

Otherwise there are currently no exceptions to the general rule.
Maintaining the general rule has the advantage that it is possible to
attach output sections to segments as they are created.  When the
output section flags can change, it becomes necessary to be able to
move output sections to different segments.

Any thoughts on the best approach here?  It is necessary for the
kernel sources to use inconsistent flags?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]