From: Jeff Law Date: Sat, 28 Jan 1995 19:50:52 +0000 (+0000) Subject: * som.c (som_object_setup): New heuristic to determine if the X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fede999213c946e3266b04ef3ec114441fda49e6;p=binutils-gdb.git * som.c (som_object_setup): New heuristic to determine if the entry and flags fields are switched in the exec header. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e1dd03c5772..77e21e28ad7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 28 12:48:57 1995 Jeff Law (law@snake.cs.utah.edu) + + * som.c (som_object_setup): New heuristic to determine if the + entry and flags fields are switched in the exec header. + Sat Jan 28 00:16:01 1995 Ian Lance Taylor * elfcode.h (elf_link_add_object_symbols): Use *sym_hash instead diff --git a/bfd/som.c b/bfd/som.c index 248cbd42927..214a312afd1 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -226,7 +226,7 @@ static boolean som_write_symbol_strings PARAMS ((bfd *, unsigned long, asymbol **, unsigned int, unsigned *)); static boolean som_begin_writing PARAMS ((bfd *)); -static const reloc_howto_type * som_bfd_reloc_type_lookup +static reloc_howto_type * som_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static char som_section_type PARAMS ((const char *)); static int som_decode_symclass PARAMS ((asymbol *)); @@ -1548,7 +1548,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field) howto table. */ /*ARGSUSED*/ -static const reloc_howto_type * +static reloc_howto_type * som_bfd_reloc_type_lookup (abfd, code) bfd *abfd; bfd_reloc_code_real_type code; @@ -1618,10 +1618,16 @@ som_object_setup (abfd, file_hdrp, aux_hdrp) /* The braindamaged OSF1 linker switched exec_flags and exec_entry! - It seems rather backward that the OSF1 linker which is much - older than any HPUX linker I've got uses a newer SOM version - id... But that's what I've found by experimentation. */ - if (file_hdrp->version_id == NEW_VERSION_ID) + We used to identify OSF1 binaries based on NEW_VERSION_ID, but + apparently the latest HPUX linker is using NEW_VERSION_ID now. + + It's about time, OSF has used the new id since at least 1992; + HPUX didn't start till nearly 1995!. + + The new approach examines the entry field. If it's zero or not 4 + byte aligned then it's not a proper code address and we guess it's + really the executable flags. */ + if (aux_hdrp->exec_entry == 0 || (aux_hdrp->exec_entry & 0x3) != 0) { bfd_get_start_address (abfd) = aux_hdrp->exec_flags; obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_entry;