Blame NOTES

Packit Service 97d2fb
Fundamental design decision:
Packit Service 97d2fb
Packit Service 97d2fb
- the sizes of external and internal types are assumed to be the same.
Packit Service 97d2fb
  This leaves byte ordering aside.  While assuming this the code can be
Packit Service 97d2fb
  greatly simplified and speed increases.  Since no change violating this
Packit Service 97d2fb
  assumption is in sight this is believed to be a worthwhile optimization.
Packit Service 97d2fb
Packit Service 97d2fb
- the ABI of the backend modules is not guaranteed.  Really, no guarantee
Packit Service 97d2fb
  whatsoever.  We are enforcing this in the code.  The modules and their
Packit Service 97d2fb
  users must match.  No third-party EBL module are supported or allowed.
Packit Service 97d2fb
  The only reason there are separate modules is to not have the code for
Packit Service 97d2fb
  all architectures in all the binaries.
Packit Service 97d2fb
Packit Service 97d2fb
- although the public libraries (libasm, libdw) have a stable API and are
Packit Service 97d2fb
  backwards ABI compatible they, and the elfutils tools, do depend on each
Packit Service 97d2fb
  others internals, and on internals of libelf to provide their interfaces.
Packit Service 97d2fb
  So they should always be upgraded in lockstep when packaging the tools
Packit Service 97d2fb
  and libraries separately. For one example of how to do that, see the
Packit Service 97d2fb
  config/elfutils.spec.
Packit Service 97d2fb
Packit Service 97d2fb
Some notes:
Packit Service 97d2fb
Packit Service 97d2fb
- old GNU ld's behavior wrt DSOs seems to be severely broken.
Packit Service 97d2fb
Packit Service 97d2fb
     y.o reference foo()
Packit Service 97d2fb
     y1.o defines foo(), references bar()
Packit Service 97d2fb
     y2.o defines bar()
Packit Service 97d2fb
     libbar.so defines bar()
Packit Service 97d2fb
Packit Service 97d2fb
  Running
Packit Service 97d2fb
Packit Service 97d2fb
     gcc -o y y.o -lbar y1.o y2.o
Packit Service 97d2fb
Packit Service 97d2fb
  uses the bar() definition from libbar.so and does not mention the definition
Packit Service 97d2fb
  in y2.o at all (no duplicate symbol message).  Correct is to use the
Packit Service 97d2fb
  definition in y2.o.
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
     y.o reference foo()
Packit Service 97d2fb
     y1.o defines foo(), references bar()
Packit Service 97d2fb
     y2.o in liby2.a defines bar()
Packit Service 97d2fb
     libbar.so defines bar()
Packit Service 97d2fb
Packit Service 97d2fb
  Running
Packit Service 97d2fb
Packit Service 97d2fb
     gcc -o y y.o -lbar y1.o -ly3
Packit Service 97d2fb
Packit Service 97d2fb
  has to use the definition in -lbar and not pull the definition from liby3.a.
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
- the old linker follows DT_NEEDED entries and adds the objects referenced
Packit Service 97d2fb
  this way which define a symbol which is needed as a DT_NEEDED to the
Packit Service 97d2fb
  generated binary.  This is wrong since the DT_NEEDED changes the search
Packit Service 97d2fb
  path in the object (which is breadth first).
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
- the old linker supported extern "C++", extern "java" in version scripts.
Packit Service 97d2fb
  I believe this implementation is severly broken and needs a redesign
Packit Service 97d2fb
  (how do wildcards work with these languages*?).  Therefore it is left
Packit Service 97d2fb
  out for now.
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
- what should happen if two sections in different files with the same
Packit Service 97d2fb
  name have different types and/or the flags are different
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
- section names in input files are mostly irrelevant.  Exceptions:
Packit Service 97d2fb
Packit Service 97d2fb
  .comment/SHT_PROGBITS		in strip, ld
Packit Service 97d2fb
Packit Service 97d2fb
  .debug		\
Packit Service 97d2fb
  .line			|
Packit Service 97d2fb
  .debug_srcinfo	|
Packit Service 97d2fb
  .debug_sfnames	|
Packit Service 97d2fb
  .debug_aranges	|
Packit Service 97d2fb
  .debug_pubnames	|
Packit Service 97d2fb
  .debug_info		|
Packit Service 97d2fb
  .debug_abbrev		|
Packit Service 97d2fb
  .debug_line		|
Packit Service 97d2fb
  .debug_abbrev		 >	DWARF sections in ld
Packit Service 97d2fb
  .debug_line		|
Packit Service 97d2fb
  .debug_frame		|
Packit Service 97d2fb
  .debug_str		|
Packit Service 97d2fb
  .debug_loc		|
Packit Service 97d2fb
  .debug_macinfo	|
Packit Service 97d2fb
  .debug_weaknames	|
Packit Service 97d2fb
  .debug_funcnames	|
Packit Service 97d2fb
  .debug_typenames	|
Packit Service 97d2fb
  .debug_varnames	/
Packit Service 97d2fb
Packit Service 97d2fb
  Sections created in output files follow the naming of special section
Packit Service 97d2fb
  from the gABI.
Packit Service 97d2fb
Packit Service 97d2fb
  In no place is a section solely indentified by its name.  Internal
Packit Service 97d2fb
  references always use the section index.