1

Is there a way I can find from how many Relocatable files an Elf execution file Built from? And how can I associate a segment with its original Relocatable file?

Thanks in avance.

asaf levi
  • 11
  • 4

1 Answers1

0

Is there a way I can find from how many Relocatable files an Elf execution file Built from?

No (at least not in general).

And how can I associate a segment with its original Relocatable file?

Any trace of the original ET_REL file will be gone by the time the linker is done linking.

In addition, with section reordering, a single .o can be "spread out" all over the final linked binary, and with identical code folding a single segment of the final binary can be associated with multiple .o files.

I think http://xyproblem.info is also relevant here.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • thanks for the answer, I'm trying to build a tool that will do the opposite to the linker operation (you can call it to "unlink" a file) to .c files files complied and linked with gcc. when I checked the symbol table with readelf, I can see symbols of type "FILE" with the name of the originals files (.c), what these symbols are used for according to your answer? – asaf levi Jun 15 '21 at 15:04