This is the mail archive of the 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: "ld --verbose" omits SECTIONS-to-PHDRS mapping

>> and the full output includes no PHDRS paragraph.

> What PHDRS paragraph ?  The default linker script for the x86_64 architecture does not contain a PHDRS paragraph.  In fact the only binutils target which includes a PHDRS paragraph by default is the sh-symbianelf target.

That's my point: the default linker script (for any output format
that generates ElfXX_Phdr) always should contain a PHDRS paragraph.
Omitting the PHDRS paragraph, and the mapping from SECTION to PHDR
["readelf --segments" calls this the "Section to Segment mapping"],
omits vital information about the default behavior.  Instead,
"ld --verbose" should include this information.

For instance, on x86_64 the SECTIONS paragraph of "ld --verbose"
contains a line:
  .interp         : { *(.interp) }
but neither this line nor any preceding line designates the
segment in which the .interp section should reside.  The line should be:
  .interp         : { *(.interp) } :interp :text
and there should be lines such as these in a PHDRS paragraph:
       interp   PT_INTERP ;
       text     PT_LOAD   FILEHDR  PHDRS  FLAGS ( 5 ) ;
Without those lines the description of ld's behavior is incomplete.

Omitting the PHDRS paragraph and the SECTION to PHDR mapping matters
when a user wants to change the default, such as by moving some
section to a different segment, or by introducing a new segment,
or by changing the output alignment or permissions, etc.
In order to do this using the current output from "ld --verbose",
then the user must conjure up a suitable PHDRS paragraph that matches
the default behavior, and designate the proper segment for each section.
The information required to make an explicit PHDRS paragraph that is
equivalent to the current default is scattered and incomplete.
This creates a significant barrier to Usability of ld.


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