This is the mail archive of the binutils@sourceware.cygnus.com 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]

Bug in ARM linker...


Hi Nick,

I have found a bug in the ARM linker, and I think you might be able to
help me. 

The problem is the DT_TEXTREL tag is not being written out to a shared
library.  This is due to the fact the SEC_READONLY flag is not set on
the .text section.  See elf32_arm_size_dynamic_relocs() in elf32-arm.h. 
The test is around line 2817 I believe.  A search for DT_TEXTREL in the
file will turn it up quickly.

I believe I have tracked the problem down to ld/ldlang.c:wild_doit(). 
The statement at line 1165 clears the SEC_READONLY flag in the output
section because the input section does not have it set.

This routine takes asection* as a parameter and is called in a loop
through a list of input sections.  If I break in the loop and examine
each section I eventually see a section with the following attributes:

section->name = .text
section->flags = 0x237
section->output_section = 0x207548c
section->output_section->name = .text
section->output_section->flags = 0x237

The next section has the following attributes:

section->name = .glue_7t
section->flags = 0x20203
section->output_section = 0x207548c
section->output_section->name = .text
section->output_section->flags = 0x237

The next section has the following attributes:

section->name = .glue_7
section->flags = 0x20203
section->output_section = 0x207548c
section->output_section->name = .text
section->output_section->flags = 0x20227

These 3 sections all share the SAME output section.  I think this is the
root cause of the problem.  Somewhere along the way the flags for the
output .text section are altered by the code.  At any rate I believe
this is the reason why the DT_TEXTREL tag is not output in the .dynamic
section.  The output .text section should be readonly for ELF.

I believe these sections are for the ARM-Thumb interwork code, and their
contents should be output to the .text section.  I'm not familiar with
the Thumb code, so I'd appreciate a little help if you have time.

Scott

-- 
Scott Bambrough - Software Engineer
REBEL.COM    http://www.rebel.com
NetWinder    http://www.netwinder.org

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