[PATCH] Explicitly get .dynamic section for "readelf -d"
Jie Zhang
zhangjie@magima.com.cn
Mon Jun 14 08:42:00 GMT 2004
Nick Clifton wrote:
>
> There is a small problem with it - it contains duplicated code. I think
> that a better approach would be to put the scan for the .dynamic section
> into the code in process_program_headers() where dynamic_addr and
> dynamic_size are currently initialised. Could you try this out please ?
>
Here is it. But I'm afraid it is not good enough yet.
The -d option of readelf is for displaying the contents of the file's
dynamic section as stated in the document. However, almost all relevant
code say dynamic *segment* rather than dynamic *section*. For most
targets dynamic segment contains only .dynamic section and they are
equivalent, but for SGI's MIPS this is not true. Is it worth changing
all "dynamic segment" to "dynamic section", e.g. process_dynamic_segment
to process_dynamic_section and dynamic_segment to dynamic_section?
The .dynamic section, I think now, should be the first section in the
dynamic segment. Since section header table is optional in executable
file, we cannot always rely on it to relocate .dynamic section. If a
script does not make it come first in the segment, it's the script's
fault not others. So I think that it would better to make ld warn (or
error) if the .dynamic section is not the first section in the dynamic
segment. Is this reasonable? Is there any target other than MIPS that
has more than one section in dynamic segment? If it is the only target,
I'm going to add check in _bfd_mips_elf_modify_segment_map ().
Otherwise, I'm going to add check in map_sections_to_segments (). Are
they the right places?
--
Jie
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: readelf-dynamic-2.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20040614/2ef25ec2/attachment.ksh>
More information about the Binutils
mailing list