Avoid ubsan bug complaining about &p->field
[deliverable/binutils-gdb.git] / ld / emultempl / scoreelf.em
index 369ad763bf54385c1f9992ad2110849b12d580a7..b200419b56862835db944242a9818a51b7d25699 100644 (file)
@@ -1,6 +1,7 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright 2006, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 #   Contributed by:
+#   Brain.lin (brain.lin@sunplusct.com)
 #   Mei Ligang (ligang@sunnorth.com.cn)
 #   Pei-Lin Tsai (pltsai@sunplus.com)
 
 # MA 02110-1301, USA.
 #
 
-# This file is sourced from elf32.em, and defines extra score-elf
+# This file is sourced from elf.em, and defines extra score-elf
 # specific routines.
 #
 fragment <<EOF
 
+#include "elf32-score.h"
+
 static void
-gld${EMULATION_NAME}_before_parse ()
+gld${EMULATION_NAME}_before_parse (void)
 {
 #ifndef TARGET_                        /* I.e., if not generic.  */
-  ldfile_set_output_arch ("`echo ${ARCH}`");
+  ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
 #endif /* not TARGET_ */
-  config.dynamic_link = ${DYNAMIC_LINK-true};
-  config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
+  input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+  config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
+  config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+  link_info.check_relocs_after_open_input = TRUE;
+  link_info.relro = DEFAULT_LD_Z_RELRO;
 }
 
 static void
 score_elf_after_open (void)
 {
-  if (strstr (bfd_get_target (output_bfd), "score") == NULL)
+  if (strstr (bfd_get_target (link_info.output_bfd), "score") == NULL)
     {
       /* The score backend needs special fields in the output hash structure.
         These will only be created if the output format is an score format,
         hence we do not support linking and changing output formats at the
         same time.  Use a link followed by objcopy to change output formats.  */
-      einfo ("%F%X%P: error: cannot change output format whilst linking S+core binaries\n");
+      einfo (_("%F%P: error: cannot change output format "
+              "whilst linking %s binaries\n"), "S+core");
       return;
     }
 
@@ -56,6 +63,15 @@ score_elf_after_open (void)
 
 EOF
 
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+PARSE_AND_LIST_PROLOGUE=''
+PARSE_AND_LIST_SHORTOPTS=
+PARSE_AND_LIST_LONGOPTS=''
+PARSE_AND_LIST_OPTIONS=''
+PARSE_AND_LIST_ARGS_CASES=''
+
 # We have our own after_open and before_allocation functions, but they call
 # the standard routines, so give them a different name.
 LDEMUL_AFTER_OPEN=score_elf_after_open
This page took 0.025663 seconds and 4 git commands to generate.