This is the mail archive of the binutils@sources.redhat.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]

Re: arm-elf-ld flag copying


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;

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