From: Jeff Law Date: Wed, 14 Sep 1994 00:29:11 +0000 (+0000) Subject: * som.c (som_object_setup): Handle exec_entry and exec_flags being X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0b4aa626512b2d255470691273fd2cc93d22b35;p=binutils-gdb.git * som.c (som_object_setup): Handle exec_entry and exec_flags being switched in executables created by the OSF1 linker. (som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL fixups. Support R_ALT_ENTRY (handle just like R_EXIT). --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7f1320ebda6..4f1234ef1bf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +Tue Sep 13 17:57:00 1994 Jeff Law (law@snake.cs.utah.edu) + + * som.c (som_object_setup): Handle exec_entry and exec_flags being + switched in executables created by the OSF1 linker. + (som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL + fixups. Support R_ALT_ENTRY (handle just like R_EXIT). + Tue Sep 13 16:04:07 1994 Steve Chamberlain (sac@jonny.cygnus.com) * cofflink.c (coff_link_input_bfd): syment_base is unsigned diff --git a/bfd/som.c b/bfd/som.c index 3907ce486bb..cea677bc435 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -1605,7 +1605,31 @@ som_object_setup (abfd, file_hdrp, aux_hdrp) break; } - bfd_get_start_address (abfd) = aux_hdrp->exec_entry; + /* Allocate space to hold the saved exec header information. */ + obj_som_exec_data (abfd) = (struct som_exec_data *) + bfd_zalloc (abfd, sizeof (struct som_exec_data )); + if (obj_som_exec_data (abfd) == NULL) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + /* 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) + { + bfd_get_start_address (abfd) = aux_hdrp->exec_flags; + obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_entry; + } + else + { + bfd_get_start_address (abfd) = aux_hdrp->exec_entry; + obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags; + } + bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 0); bfd_get_symcount (abfd) = file_hdrp->symbol_total; @@ -1618,17 +1642,8 @@ som_object_setup (abfd, file_hdrp, aux_hdrp) obj_som_sym_filepos (abfd) = file_hdrp->symbol_location; obj_som_str_filepos (abfd) = file_hdrp->symbol_strings_location; obj_som_reloc_filepos (abfd) = file_hdrp->fixup_request_location; - - obj_som_exec_data (abfd) = (struct som_exec_data *) - bfd_zalloc (abfd, sizeof (struct som_exec_data )); - if (obj_som_exec_data (abfd) == NULL) - { - bfd_set_error (bfd_error_no_memory); - return NULL; - } - obj_som_exec_data (abfd)->system_id = file_hdrp->system_id; - obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags; + return abfd->xvec; } @@ -2434,6 +2449,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep) /* This only needs to handle relocations that may be made by hppa_som_gen_reloc. */ case R_ENTRY: + case R_ALT_ENTRY: case R_EXIT: case R_N_MODE: case R_S_MODE: @@ -2545,12 +2561,6 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep) break; } - case R_EXIT: - bfd_put_8 (abfd, R_EXIT, p); - subspace_reloc_size += 1; - p += 1; - break; - case R_N_MODE: case R_S_MODE: case R_D_MODE: @@ -2566,6 +2576,8 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep) } break; + case R_EXIT: + case R_ALT_ENTRY: case R_FSEL: case R_LSEL: case R_RSEL: