]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/emultempl/linux.em
Emit a warning when -z relro is unsupported
[thirdparty/binutils-gdb.git] / ld / emultempl / linux.em
index 9c320a3dfa23ef0edde49b6ba84204f8df67dc2b..14446109eaef0f60301566c68f760a2e82734967 100644 (file)
@@ -9,7 +9,7 @@ fragment <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* Linux a.out emulation code for ${EMULATION_NAME}
-   Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    Linux support by Eric Youngdale <ericy@cais.cais.com>
 
@@ -35,6 +35,7 @@ fragment <<EOF
 #include "sysdep.h"
 #include "bfd.h"
 #include "bfdlink.h"
+#include "ctf-api.h"
 
 #include "ld.h"
 #include "ldmain.h"
@@ -50,6 +51,14 @@ gld${EMULATION_NAME}_before_parse (void)
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   input_flags.dynamic = TRUE;
   config.has_shared = TRUE;
+  link_info.check_relocs_after_open_input = TRUE;
+EOF
+if test -n "$COMMONPAGESIZE"; then
+fragment <<EOF
+  link_info.relro = DEFAULT_LD_Z_RELRO;
+EOF
+fi
+fragment <<EOF
 }
 
 /* Try to open a dynamic archive.  This is where we know that Linux
@@ -114,14 +123,14 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
 static void
 gld${EMULATION_NAME}_before_allocation (void)
 {
-  if (link_info.relocatable)
+  if (bfd_link_relocatable (&link_info))
     return;
 
   /* Let the backend work out the sizes of any sections required by
      dynamic linking.  */
   if (! bfd_${EMULATION_NAME}_size_dynamic_sections (link_info.output_bfd,
                                                     &link_info))
-    einfo ("%P%F: failed to set dynamic section sizes: %E\n");
+    einfo (_("%F%P: failed to set dynamic section sizes: %E\n"));
 
   before_allocation_default ();
 }
@@ -141,11 +150,11 @@ fragment <<EOF
 {
   *isfile = 0;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return
 EOF
 sed $sc ldscripts/${EMULATION_NAME}.xu                 >> e${EMULATION_NAME}.c
-echo '  ; else if (link_info.relocatable) return'     >> e${EMULATION_NAME}.c
+echo '  ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xr                 >> e${EMULATION_NAME}.c
 echo '  ; else if (!config.text_read_only) return'     >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xbn                >> e${EMULATION_NAME}.c
@@ -162,9 +171,9 @@ fragment <<EOF
 {
   *isfile = 1;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return "ldscripts/${EMULATION_NAME}.xu";
-  else if (link_info.relocatable)
+  else if (bfd_link_relocatable (&link_info))
     return "ldscripts/${EMULATION_NAME}.xr";
   else if (!config.text_read_only)
     return "ldscripts/${EMULATION_NAME}.xbn";
@@ -186,6 +195,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   hll_default,
   after_parse_default,
   after_open_default,
+  after_check_relocs_default,
+  before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
@@ -206,6 +217,9 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   NULL,        /* recognized file */
   NULL,        /* find_potential_libraries */
   NULL,        /* new_vers_pattern */
-  NULL /* extra_map_file_text */
+  NULL,        /* extra_map_file_text */
+  ${LDEMUL_EMIT_CTF_EARLY-NULL},
+  ${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
+  ${LDEMUL_PRINT_SYMBOL-NULL}
 };
 EOF