From: Alan Modra Date: Fri, 15 Jul 2005 12:19:15 +0000 (+0000) Subject: * ldemul.c (ldemul_do_assignments): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e797c2c670d8fe04e417043214c0a1843a18aa3;p=binutils-gdb.git * ldemul.c (ldemul_do_assignments): New function. (do_assignments_default): New function. * ldemul.h (ldemul_do_assignments): Declare. (do_assignments_default): Declare. (struct ld_emulation_xfer_struct): Add do_assignments. * ldlang.c (lang_do_assignments) Call ldemul_do_assignments. * emultempl/aix.em (ld_*_emulation): Init do_assignments field. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise, to call gld*_provide_init_fini_syms. (gld*_find_exp_assignment): Adjust bfd_elf_record_link_assignment call. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 1fe6ae06134..1de79acccfd 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,27 @@ +2005-07-15 Alan Modra + + * ldemul.c (ldemul_do_assignments): New function. + (do_assignments_default): New function. + * ldemul.h (ldemul_do_assignments): Declare. + (do_assignments_default): Declare. + (struct ld_emulation_xfer_struct): Add do_assignments. + * ldlang.c (lang_do_assignments) Call ldemul_do_assignments. + * emultempl/aix.em (ld_*_emulation): Init do_assignments field. + * emultempl/armcoff.em: Likewise. + * emultempl/beos.em: Likewise. + * emultempl/generic.em: Likewise. + * emultempl/gld960.em: Likewise. + * emultempl/gld960c.em: Likewise. + * emultempl/linux.em: Likewise. + * emultempl/lnk960.em: Likewise. + * emultempl/m68kcoff.em: Likewise. + * emultempl/pe.em: Likewise. + * emultempl/sunos.em: Likewise. + * emultempl/ticoff.em: Likewise. + * emultempl/vanilla.em: Likewise. + * emultempl/elf32.em: Likewise, to call gld*_provide_init_fini_syms. + (gld*_find_exp_assignment): Adjust bfd_elf_record_link_assignment call. + 2005-07-14 Jim Blandy Add support for the Renesas M32C and M16C. diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index ac476825dd9..8030b477c06 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -1340,6 +1340,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_set_output_arch, gld${EMULATION_NAME}_choose_target, gld${EMULATION_NAME}_before_allocation, + do_assignments_default, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em index 86a60024569..64a2b32d822 100644 --- a/ld/emultempl/armcoff.em +++ b/ld/emultempl/armcoff.em @@ -260,6 +260,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, gld${EMULATION_NAME}_before_allocation, + do_assignments_default, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em index 4e06372fd29..7a014ce210c 100644 --- a/ld/emultempl/beos.em +++ b/ld/emultempl/beos.em @@ -767,6 +767,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, gld_${EMULATION_NAME}_before_allocation, + do_assignments_default, gld_${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 9480c2c6ab7..3899a02df62 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -981,8 +981,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp) will do no harm. */ if (strcmp (exp->assign.dst, ".") != 0) { - if (!bfd_elf_record_link_assignment (output_bfd, &link_info, - exp->assign.dst, provide)) + if (!bfd_elf_record_link_assignment (&link_info, exp->assign.dst, + provide)) einfo ("%P%F: failed to record assignment to %s: %E\n", exp->assign.dst); } @@ -1881,6 +1881,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default}, ${LDEMUL_CHOOSE_TARGET-ldemul_default_target}, ${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}, + ${LDEMUL_DO_ASSIGNMENTS-gld${EMULATION_NAME}_provide_init_fini_syms}, ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script}, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em index e808cb1f261..a37bdc6cb1d 100644 --- a/ld/emultempl/generic.em +++ b/ld/emultempl/generic.em @@ -128,6 +128,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default}, ${LDEMUL_CHOOSE_TARGET-ldemul_default_target}, ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default}, + ${LDEMUL_DO_ASSIGNMENTS-do_assignments_default}, ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script}, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em index c202d6db502..acacac762ad 100644 --- a/ld/emultempl/gld960.em +++ b/ld/emultempl/gld960.em @@ -134,6 +134,7 @@ struct ld_emulation_xfer_struct ld_gld960_emulation = gld960_set_output_arch, gld960_choose_target, before_allocation_default, + do_assignments_default, gld960_get_script, "960", "", diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em index 7c14179e034..452c194b456 100644 --- a/ld/emultempl/gld960c.em +++ b/ld/emultempl/gld960c.em @@ -149,6 +149,7 @@ struct ld_emulation_xfer_struct ld_gld960coff_emulation = gld960_set_output_arch, gld960_choose_target, before_allocation_default, + do_assignments_default, gld960_get_script, "960coff", "", diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em index a9b27f63808..277d1e950bb 100644 --- a/ld/emultempl/linux.em +++ b/ld/emultempl/linux.em @@ -189,6 +189,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, gld${EMULATION_NAME}_before_allocation, + do_assignments_default, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em index 924dd4724b0..1c820655cf5 100644 --- a/ld/emultempl/lnk960.em +++ b/ld/emultempl/lnk960.em @@ -269,6 +269,7 @@ struct ld_emulation_xfer_struct ld_lnk960_emulation = lnk960_set_output_arch, lnk960_choose_target, before_allocation_default, + do_assignments_default, lnk960_get_script, "lnk960", "", diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em index 29c61ce0f9c..9b011d3eac3 100644 --- a/ld/emultempl/m68kcoff.em +++ b/ld/emultempl/m68kcoff.em @@ -222,6 +222,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, before_allocation_default, + do_assignments_default, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 7c0fb95bc31..aefe3aad60c 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1822,6 +1822,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, gld_${EMULATION_NAME}_before_allocation, + do_assignments_default, gld_${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index d8e576dacb2..b114737167a 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -1013,6 +1013,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, gld${EMULATION_NAME}_before_allocation, + do_assignments_default, gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em index 59e67260f7a..9c4ec2b0527 100644 --- a/ld/emultempl/ticoff.em +++ b/ld/emultempl/ticoff.em @@ -162,6 +162,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = set_output_arch_default, ldemul_default_target, before_allocation_default, + do_assignments_default, gld_${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em index e2f098954cf..769fb30f8e5 100644 --- a/ld/emultempl/vanilla.em +++ b/ld/emultempl/vanilla.em @@ -65,6 +65,7 @@ struct ld_emulation_xfer_struct ld_vanilla_emulation = vanilla_set_output_arch, ldemul_default_target, before_allocation_default, + do_assignments_default, vanilla_get_script, "vanilla", "a.out-sunos-big", diff --git a/ld/ldemul.c b/ld/ldemul.c index 8e6669dce23..fbe3e1dd565 100644 --- a/ld/ldemul.c +++ b/ld/ldemul.c @@ -79,6 +79,12 @@ ldemul_before_allocation (void) ld_emulation->before_allocation (); } +void +ldemul_do_assignments (void) +{ + ld_emulation->do_assignments (); +} + void ldemul_set_output_arch (void) { @@ -216,6 +222,11 @@ before_allocation_default (void) strip_excluded_output_sections (); } +void +do_assignments_default (void) +{ +} + void set_output_arch_default (void) { diff --git a/ld/ldemul.h b/ld/ldemul.h index 1170c0a021e..1a42cb63dea 100644 --- a/ld/ldemul.h +++ b/ld/ldemul.h @@ -1,6 +1,6 @@ /* ld-emul.h - Linker emulation header file Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003, 2004 + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -35,6 +35,8 @@ extern void ldemul_after_allocation (void); extern void ldemul_before_allocation (void); +extern void ldemul_do_assignments + (void); extern void ldemul_set_output_arch (void); extern char *ldemul_choose_target @@ -77,6 +79,8 @@ extern void after_allocation_default (void); extern void before_allocation_default (void); +extern void do_assignments_default + (void); extern void set_output_arch_default (void); extern void syslib_default @@ -117,6 +121,9 @@ typedef struct ld_emulation_xfer_struct { /* Run before allocating output sections. */ void (*before_allocation) (void); + /* Run to set special symbols at the same time as link script syms. */ + void (*do_assignments) (void); + /* Return the appropriate linker script. */ char * (*get_script) (int *isfile); diff --git a/ld/ldlang.c b/ld/ldlang.c index 35c507525f1..dc8aa1497e3 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4585,6 +4585,7 @@ lang_do_assignments (void) { lang_statement_iteration++; lang_do_assignments_1 (statement_list.head, abs_output_section, NULL, 0); + ldemul_do_assignments (); } /* Fix any .startof. or .sizeof. symbols. When the assemblers see the