This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Set EF_ARM_HASENTRY for ARM executables with a start address
- To: binutils at sources dot redhat dot com
- Subject: Set EF_ARM_HASENTRY for ARM executables with a start address
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 03 May 2001 18:22:38 +0100
Hi Guys,
It was pointed out to me today the arm linker does not set the
EF_ARM_HASENTRY bit in the e_flags field of the elf header for ARM
executables which have an entry point. Since the ARM EABI says that
this is supposed to happen (section 5.2) this seems rather remiss.
The patch below attempts to fix this, by detecting a non-zero start
address during the final link and setting the flag.
This patch should also help improve the ability of ARM's debugger to
debug GNU generated binaries.
Unless there are any objections I will apply this patch tomorrow.
Cheers
Nick
2001-05-04 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-arm.h (elf32_arm_final_link_relocate): Set
EF_ARM_HASENTRY if the start address is set.
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.49
diff -p -r1.49 elf32-arm.h
*** elf32-arm.h 2001/03/16 17:34:31 1.49
--- elf32-arm.h 2001/05/03 16:21:40
*************** elf32_arm_final_link_relocate (howto, in
*** 1019,1024 ****
--- 1019,1036 ----
bfd_signed_vma signed_addend;
struct elf32_arm_link_hash_table * globals;
+ /* If the start address has been set, then set the EF_ARM_HASENTRY
+ flag. Setting this more than once is redundant, but the cost is
+ not too high, and it keeps the code simple.
+
+ The test is done here, rather than somewhere else, because the
+ start address is only set just before the final link commences.
+
+ Note - if the user deliberately sets a start address of 0, the
+ flag will not be set. */
+ if (bfd_get_start_address (output_bfd) != 0)
+ elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY;
+
globals = elf32_arm_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;