Difference between input and output sections in a linkerfile?

为君一笑 提交于 2019-12-24 03:09:38

问题


While it could be clear in the context of a resulting binary or ELF file what is a section, many places in documentation (independently of the compiler used) refers them as to Input or Output sections.

What are the differences between these?


回答1:


The linker consumes object files (and possibly shared libraries) and outputs an executable or shared library. The input object files are composed of named sections - .text, .data, .rodata, .bss, etc. So is the output file.

It is a principal part of the linker's job to combine all the input sections of the same name, from all of the input object files, into a single output section of that name in the output file. E.g. all of the .text sections of the input object files contribute to the .text section of the output file.

Some input sections may discarded from the output file if the linker determines they are redundant.



来源:https://stackoverflow.com/questions/49509585/difference-between-input-and-output-sections-in-a-linkerfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!