diff options
author | Tom Rix <trix@redhat.com> | 2002-05-10 21:20:16 +0000 |
---|---|---|
committer | Tom Rix <trix@redhat.com> | 2002-05-10 21:20:16 +0000 |
commit | f1f0d9ab14a55973f82d67fe1fa8195e80b325be (patch) | |
tree | 57a08d67b8ff3ee368ad55b158cc7b5f5ad832ba /ld | |
parent | ecac9a4eaf012690d73417818b19477e90d34af4 (diff) | |
download | gdb-f1f0d9ab14a55973f82d67fe1fa8195e80b325be.zip gdb-f1f0d9ab14a55973f82d67fe1fa8195e80b325be.tar.gz gdb-f1f0d9ab14a55973f82d67fe1fa8195e80b325be.tar.bz2 |
XCOFF64 fixes. For setting arch/mach and for R_BR relocations.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 11 | ||||
-rw-r--r-- | ld/emultempl/aix.em | 45 | ||||
-rw-r--r-- | ld/ldfile.c | 8 | ||||
-rw-r--r-- | ld/ldfile.h | 2 |
4 files changed, 45 insertions, 21 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 7aea9e9..a38bd69 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2002-05-10 Tom Rix <trix@redhat.com> + + * emultempl/aix.em: (gld*_set_output_arch): New function. Use + architecture and machine information in the output bfd. + (gld*_before_parse): Remove old arch and machine code. + (choose_target): Rename to gld*_choose_target. + (rtld): Change type to int. + * ldfile.c (ldfile_try_open_bfd): Disable compatiblity check for + objects in XCOFF archives. + * ldfile.h: Update copyright date. + 2002-05-10 Jakub Jelinek <jakub@redhat.com> * ldmain.c (main): Enable -z combreloc by default. diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 28f45c4..90e104a 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -53,11 +53,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "coff/xcoff.h" +#include "libcoff.h" +#include "libxcoff.h" static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); static int gld${EMULATION_NAME}_parse_args PARAMS ((int, char **)); static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static char *choose_target PARAMS ((int, char **)); +static char *gld${EMULATION_NAME}_choose_target PARAMS ((int, char **)); static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); static void gld${EMULATION_NAME}_read_file PARAMS ((const char *, boolean)); static void gld${EMULATION_NAME}_free PARAMS ((PTR)); @@ -68,7 +70,9 @@ static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); static boolean gld${EMULATION_NAME}_unrecognized_file PARAMS ((lang_input_statement_type *)); static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS((void)); + PARAMS ((void)); +static void gld${EMULATION_NAME}_set_output_arch PARAMS ((void)); + static int is_syscall PARAMS ((char *, unsigned int *)); static int change_symbol_mode PARAMS ((char *)); @@ -132,7 +136,7 @@ static unsigned int syscall_mask = 0x77; static lang_input_statement_type *initfini_file; /* Whether to do run time linking */ -static boolean rtld; +static int rtld; /* Explicit command line library path, -blibpath */ static char *command_line_blibpath = NULL; @@ -142,17 +146,7 @@ static char *command_line_blibpath = NULL; static void gld${EMULATION_NAME}_before_parse () { -#ifndef TARGET_ /* I.e., if not generic. */ - const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); - if (arch) - { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; -#endif /* not TARGET_ */ + config.has_shared = true; /* The link_info.[init|fini]_functions are initialized in ld/lexsup.c. @@ -687,7 +681,8 @@ gld${EMULATION_NAME}_before_allocation () if (!bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath, entry_symbol, file_align, maxstack, maxdata, gc && !unix_ld ? true : false, - modtype, textro ? true : false, unix_ld, special_sections, rtld)) + modtype, textro ? true : false, unix_ld, special_sections, + rtld ? true : false)) einfo ("%P%F: failed to set dynamic section sizes: %E\n"); /* Look through the special sections, and put them in the right @@ -806,7 +801,7 @@ gld${EMULATION_NAME}_before_allocation () } static char * -choose_target (argc, argv) +gld${EMULATION_NAME}_choose_target (argc, argv) int argc; char **argv; { @@ -1304,7 +1299,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_create_output_section_statements() +gld${EMULATION_NAME}_create_output_section_statements () { /* __rtinit */ if ((bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour) @@ -1342,6 +1337,18 @@ gld${EMULATION_NAME}_create_output_section_statements() } } +static void +gld${EMULATION_NAME}_set_output_arch () +{ + bfd_set_arch_mach (output_bfd, + bfd_xcoff_architecture (output_bfd), + bfd_xcoff_machine (output_bfd)); + + ldfile_output_architecture = bfd_get_arch (output_bfd); + ldfile_output_machine = bfd_get_mach (output_bfd); + ldfile_output_machine_name = bfd_printable_name (output_bfd); +} + struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_before_parse, syslib_default, @@ -1349,8 +1356,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { after_parse_default, gld${EMULATION_NAME}_after_open, after_allocation_default, - set_output_arch_default, - choose_target, + gld${EMULATION_NAME}_set_output_arch, + gld${EMULATION_NAME}_choose_target, gld${EMULATION_NAME}_before_allocation, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", diff --git a/ld/ldfile.c b/ld/ldfile.c index 8d8310a..7258bb1 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -132,7 +132,13 @@ ldfile_try_open_bfd (attempt, entry) { if (! bfd_check_format (check, bfd_object)) return true; - if (bfd_arch_get_compatible (check, output_bfd) == NULL) + + if ((bfd_arch_get_compatible (check, output_bfd) == NULL) + /* XCOFF archives can have 32 and 64 bit objects */ + && ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour + && bfd_get_flavour (output_bfd) == + bfd_target_xcoff_flavour + && bfd_check_format (entry->the_bfd, bfd_archive))) { einfo (_("%P: skipping incompatible %s when searching for %s\n"), attempt, entry->local_sym_name); diff --git a/ld/ldfile.h b/ld/ldfile.h index ce822e7..7779325 100644 --- a/ld/ldfile.h +++ b/ld/ldfile.h @@ -1,5 +1,5 @@ /* ldfile.h - - Copyright 1991, 1992, 1993, 1994, 1995, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 2000, 2002 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. |