This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: arm-elf-ld flag copying
- To: pb at tazenda dot demon dot co dot uk
- Subject: Re: arm-elf-ld flag copying
- From: Nick Clifton <nickc at redhat dot com>
- Date: Wed, 6 Sep 2000 12:39:13 -0700
- CC: binutils at sourceware dot cygnus dot com
Hi Phil,
: I've noticed that flags such as APCS_26 are being thrown out by the linker.
:
: $ arm-linux-as -mapcs-26 -o t.o t.S
: $ arm-linux-readelf -a t.o | grep Flags
: Flags: 0x8
: $ arm-linux-ld -r t.o -o t2.o
: $ arm-linux-readelf -a t2.o | grep Flags
: Flags: 0x0
: $
:
: This is caused by the following code in elf32_arm_merge_private_bfd_data,
: as far as I can tell:
:
: /* If the input is the default architecture then do not
: bother setting the flags for the output architecture,
: instead allow future merges to do this. If no future
: merges ever set these flags then they will retain their
: unitialised values, which surprise surprise, correspond
: to the default values. */
: if (bfd_get_arch_info (ibfd)->the_default)
: return true;
:
: Would it do any harm to remove this, or am I barking up the wrong tree?
I am sure that I thought that I had a good reason for doing this at
the time. If I remember correctly it was all to do with eliminating
unnecessary warning messages caused by linking a "normal" crt0.o with a
mixed set of arm and thumb object files. Unfortunately I cannot
remember the exact details now.
I agree however that it does appear that the code causes the bug you
show above although I think that deleting it might be a bit too
extreme. What happens if apply the patch below ?
Cheers
Nick
2000-09-06 Nick Clifton <nickc@redhat.com>
* elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not
initialise flags in output bfd if the input bfd is the default
architecture with the default flags.
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src//src/bfd/elf32-arm.h,v
retrieving revision 1.35
diff -p -r1.35 elf32-arm.h
*** elf32-arm.h 2000/09/03 16:32:02 1.35
--- elf32-arm.h 2000/09/06 19:37:05
*************** elf32_arm_merge_private_bfd_data (ibfd,
*** 2038,2050 ****
if (!elf_flags_init (obfd))
{
! /* If the input is the default architecture then do not
! bother setting the flags for the output architecture,
! instead allow future merges to do this. If no future
! merges ever set these flags then they will retain their
! unitialised values, which surprise surprise, correspond
to the default values. */
! if (bfd_get_arch_info (ibfd)->the_default)
return true;
elf_flags_init (obfd) = true;
--- 2038,2051 ----
if (!elf_flags_init (obfd))
{
! /* If the input is the default architecture and had the default
! flags then do not bother setting the flags for the output
! architecture, instead allow future merges to do this. If no
! future merges ever set these flags then they will retain their
! uninitialised values, which surprise surprise, correspond
to the default values. */
! if (bfd_get_arch_info (ibfd)->the_default
! && elf_elfheader (ibfd)->e_flags == 0)
return true;
elf_flags_init (obfd) = true;