* ldemul.c (ldemul_do_assignments): New function.
authorAlan Modra <amodra@gmail.com>
Fri, 15 Jul 2005 12:19:15 +0000 (12:19 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 15 Jul 2005 12:19:15 +0000 (12:19 +0000)
(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.

18 files changed:
ld/ChangeLog
ld/emultempl/aix.em
ld/emultempl/armcoff.em
ld/emultempl/beos.em
ld/emultempl/elf32.em
ld/emultempl/generic.em
ld/emultempl/gld960.em
ld/emultempl/gld960c.em
ld/emultempl/linux.em
ld/emultempl/lnk960.em
ld/emultempl/m68kcoff.em
ld/emultempl/pe.em
ld/emultempl/sunos.em
ld/emultempl/ticoff.em
ld/emultempl/vanilla.em
ld/ldemul.c
ld/ldemul.h
ld/ldlang.c

index 1fe6ae06134202ee72acc6f5d9a3c5c1ec012b5e..1de79acccfd4ade3c3e7ff409a498ab4b404db43 100644 (file)
@@ -1,3 +1,27 @@
+2005-07-15  Alan Modra  <amodra@bigpond.net.au>
+
+       * 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  <jimb@redhat.com>
 
        Add support for the Renesas M32C and M16C.
index ac476825dd9a992e207a4946ff0dd699c333097b..8030b477c06646b190ff519ee4503ce17a1ab60c 100644 (file)
@@ -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}",
index 86a600245699ef199a1dc6ec754a93bc11dd9dde..64a2b32d8220755d29f9ed91da7d952b098b36f8 100644 (file)
@@ -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}",
index 4e06372fd29b79a249ef9b02348b74c799725df0..7a014ce210c9b51d53b7b7c86b6b19c78bef1f40 100644 (file)
@@ -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}",
index 9480c2c6ab713ef0de9de8918c20773e922d722e..3899a02df6244ddce68e33f6d6abb5da242becd4 100644 (file)
@@ -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}",
index e808cb1f26160393e9da7da651184733355b3a94..a37bdc6cb1dc03061bed2acd7039244390ef0e7a 100644 (file)
@@ -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}",
index c202d6db502abe7e5b6fc892639b1d4660aa2aad..acacac762adb8e20d869d08154cfb11b4d2e06bd 100644 (file)
@@ -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",
   "",
index 7c14179e03466791768540cb61198d2b8810f088..452c194b456e6be13d79e1c3ae3f6cfd3ba8941c 100644 (file)
@@ -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",
   "",
index a9b27f6380874a4ed2c1ce001bcb723e362a1d52..277d1e950bb17e55474022dbd9242eb574b5383b 100644 (file)
@@ -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}",
index 924dd4724b0e4952e2d0e44ddc839174a68701ff..1c820655cf5419d7706b17f7d5ee0c1fec8768bb 100644 (file)
@@ -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",
   "",
index 29c61ce0f9cb54534d5e9b397215ffa07dd35896..9b011d3eac3ca4545833790907a7a0f215fb4ad7 100644 (file)
@@ -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}",
index 7c0fb95bc314f3fa062d6a95ab73a6977ba497a2..aefe3aad60c48ec2e8812c3760fd8a2e6fd0d185 100644 (file)
@@ -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}",
index d8e576dacb2c6a1649a335a18b18b421bbdd33bf..b114737167ac95253609a6a73f146427a772965b 100644 (file)
@@ -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}",
index 59e67260f7ad05e88f1f4bd84b3fa5cbc9e42ff6..9c4ec2b052753c8006830c060ae1287723148c01 100644 (file)
@@ -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}",
index e2f098954cf46cd6b443cc244bb67925a640e529..769fb30f8e58f073717922e7c85edf2e09ec97da 100644 (file)
@@ -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",
index 8e6669dce23cebf6f1cf73b10055e1ef0592a93d..fbe3e1dd565c0c6f9ca2f542072e5cea7eb2adb5 100644 (file)
@@ -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)
 {
index 1170c0a021e95f5a8d685d86d3f383e0cd7f6652..1a42cb63dea157ab5ada2013b272379ad333fbc3 100644 (file)
@@ -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);
 
index 35c507525f1f90d90f8aedba4d055fb0ba983f6f..dc8aa1497e3f2cb3aed8c6e07df3f61e9b51e1c2 100644 (file)
@@ -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