[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 64 bit ABI not set correctly for IA64 elf binaries when using objcop
From: |
Alan Modra |
Subject: |
Re: 64 bit ABI not set correctly for IA64 elf binaries when using objcopy |
Date: |
Thu, 25 Jul 2002 21:01:42 +0930 |
User-agent: |
Mutt/1.3.25i |
On Tue, Jul 23, 2002 at 05:52:04AM -0400, Volkmar Uhlig wrote:
> When using objcopy for IA64 using binary as input format, objcopy does
> not set the 64 bit ABI flag in the elf header. Thus, the generated elf file
> is for the wrong ABI and the linker denies linking.
[snip]
> +static boolean
> +elfNN_ia64_elf_object_p (abfd)
> + bfd *abfd;
> +{
> + /* if the machine is a 64 bit target set the ABI64 bit in the e_flags */
> + if (bfd_get_mach(abfd) == bfd_mach_ia64_elf64)
> + elf_elfheader(abfd)->e_flags |= EF_IA_64_ABI64;
> + return true;
> +}
I believe elfNN_ia64_final_write_processing is the correct place to do
this. elf_backend_object_p is called when opening input files, so you
would be adjusting flags on all ia64_elf64 files. While it may be
true that all such files should have EF_IA_64_ABI64 set, I don't think
doing so is a good idea.
Would you mind checking that the following patch works for you?
bfd/ChangeLog
* elfxx-ia64.c (elfNN_ia64_final_write_processing): Set e_flags.
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.55
diff -u -p -r1.55 elfxx-ia64.c
--- bfd/elfxx-ia64.c 23 Jul 2002 12:29:33 -0000 1.55
+++ bfd/elfxx-ia64.c 25 Jul 2002 11:26:11 -0000
@@ -1187,6 +1187,19 @@ elfNN_ia64_final_write_processing (abfd,
break;
}
}
+
+ if (! elf_flags_init (abfd))
+ {
+ unsigned long flags = 0;
+
+ if (abfd->xvec->byteorder == BFD_ENDIAN_BIG)
+ flags |= EF_IA_64_BE;
+ if (bfd_get_mach (abfd) == bfd_mach_ia64_elf64)
+ flags |= EF_IA_64_ABI64;
+
+ elf_elfheader(abfd)->e_flags = flags;
+ elf_flags_init (abfd) = true;
+ }
}
/* Hook called by the linker routine which adds symbols from an object
--
Alan Modra
IBM OzLabs - Linux Technology Centre