Use an accessor function for general_symbol_info::language
[deliverable/binutils-gdb.git] / binutils / embedspu.sh
index f44d665d3c2035920228c8c7511c27d942a4d765..49f8e75513a63d43ff43d1816fc33960d1b08f9a 100644 (file)
@@ -1,7 +1,7 @@
-#! /bin/sh 
+#! /bin/sh
 # Embed an SPU ELF executable into a PowerPC object file.
 #
-# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2006-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Binutils.
 #
@@ -119,6 +119,7 @@ main ()
   toe=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *\.toe *[PROGN]*BITS *\([0-9a-f]*\).*,\1 \2,p'`
   toe_addr=`echo $toe | sed -n -e 's,.* ,,p'`
   toe=`echo $toe | sed -n -e 's, .*,,p'`
+  has_ea=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *\._ea *PROGBITS.*,\1,p'`
   # For loaded sections, pick off section number, address, and file offset
   sections=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *[^ ]* *PROGBITS *\([0-9a-f]*\) *\([0-9a-f]*\).*,\1 \2 \3,p'`
   sections=`echo ${sections}`
@@ -145,13 +146,13 @@ main ()
   # 4. Write a struct spe_program_handle to .data.
   # 5. Write a table of _SPUEAR_ symbols.
   ${CC} ${FLAGS} -x assembler-with-cpp -nostartfiles -nostdlib \
-       -Wa,-mbig -Wl,-r -Wl,-x -o ${OUTFILE} - <<EOF
+       -Wa,-mbig -Wa,-noexecstack -Wl,-r -Wl,-x -o ${OUTFILE} - <<EOF
  .section .data.spetoe,"aw",@progbits
  .p2align 7
 __spetoe__:
 `${READELF} -s -W ${INFILE} | grep ' _EAR_' | sort -k 2 | awk \
 'BEGIN { \
-       addr = strtonum ("0x" "'${toe_addr-0}'"); \
+       addr = strtonum ("0x" "'${toe_addr:-0}'"); \
        split ("'"${sections}"'", s, " "); \
        for (i = 1; i in s; i += 3) { \
            sec_off[s[i]] = strtonum ("0x" s[i+2]) - strtonum ("0x" s[i+1]); \
@@ -202,7 +203,6 @@ $3 ~ /R_SPU_PPU/ { \
        print "#else"; \
        print " .reloc __speelf__+" strtonum ("0x" $1) + sec_off[rela[sec]] + (substr($3, 10) == "64" ? 4 : 0)", R_PPC_ADDR32, " ($5 != "" ? $5 "+0x" $7 : "__speelf__ + 0x" $4); \
        print "#endif"; \
-       if (!has_ea && $5 == "") { print "#define HAS_EA 1"; has_ea = 1; }; \
        if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
 } \
 $3 ~ /unrecognized:/ { \
@@ -211,11 +211,10 @@ $3 ~ /unrecognized:/ { \
        print "#else"; \
        print " .reloc __speelf__+" strtonum ("0x" $1) + sec_off[rela[sec]] + ($4 == "f" ? 4 : 0)", R_PPC_ADDR32, " ($6 != "" ? $6 "+0x" $8 : "__speelf__ + 0x" $5); \
        print "#endif"; \
-       if (!has_ea && $5 == "") { print "#define HAS_EA 1"; has_ea = 1; }; \
        if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
 } \
 '`
-#ifdef HAS_EA
+#if ${has_ea:-0}
  .section .data.speelf,"aw",@progbits
 #elif defined (HAS_RELOCS) && (defined (__PIC__) || defined (__PIE__))
  .section .data.rel.ro.speelf,"a",@progbits
This page took 0.024057 seconds and 4 git commands to generate.