diff options
author | Alan Modra <amodra@gmail.com> | 2021-01-26 10:48:09 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-01-26 20:54:43 +1030 |
commit | 1c9c9b9b55520b36c15af94ee0803f0922b3ca09 (patch) | |
tree | 9f173d24144a20066955dc47b2e69201ab527656 /ld/emultempl | |
parent | a45ef9a30ba53836cbc4ae1e287c20aeb4b349f6 (diff) | |
download | gdb-1c9c9b9b55520b36c15af94ee0803f0922b3ca09.zip gdb-1c9c9b9b55520b36c15af94ee0803f0922b3ca09.tar.gz gdb-1c9c9b9b55520b36c15af94ee0803f0922b3ca09.tar.bz2 |
PR27226, ld.bfd contains huge .rodata section
This makes it possible to build ld without any compiled-in scripts,
by setting COMPILE_IN=no in the environment. pe, beos and pdp11
targets didn't support scripts from the file system, with pdp11
nastily editing the ld/ldscripts file so that the built-in script
didn't match.
PR 27226
* emulparams/alphavms.sh: Don't set COMPILE_IN.
* emulparams/elf64_ia64_vms.sh: Likewise.
* emulparams/elf64mmix.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/mmo.sh: Likewise.
* emulparams/pdp11.sh: Set DATA_SEG_ADDR.
* scripttempl/pdp11.sc: Use it.
* emultempl/pdp11.em: Don't edit .xn script for separate_code,
instead use .xe script. Support scripts from file system.
* emultempl/beos.em: Support scripts from file system.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* testsuite/ld-bootstrap/bootstrap.exp: Make tmpdir/ldscripts link.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/beos.em | 25 | ||||
-rw-r--r-- | ld/emultempl/pdp11.em | 30 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 34 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 34 |
4 files changed, 121 insertions, 2 deletions
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em index bb4395f..fc43ce1 100644 --- a/ld/emultempl/beos.em +++ b/ld/emultempl/beos.em @@ -712,7 +712,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s, static char * gld_${EMULATION_NAME}_get_script (int *isfile) EOF + +if test x"$COMPILE_IN" = xyes +then # Scripts compiled in. + # sed commands to quote an ld script as a C string. sc="-f stringify.sed" @@ -734,6 +738,27 @@ echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c +else +# Scripts read from the filesystem. + +fragment <<EOF +{ + *isfile = 1; + + if (bfd_link_relocatable (&link_info) && config.build_constructors) + return "ldscripts/${EMULATION_NAME}.xu"; + else if (bfd_link_relocatable (&link_info)) + return "ldscripts/${EMULATION_NAME}.xr"; + else if (!config.text_read_only) + return "ldscripts/${EMULATION_NAME}.xbn"; + else if (!config.magic_demand_paged) + return "ldscripts/${EMULATION_NAME}.xn"; + else + return "ldscripts/${EMULATION_NAME}.x"; +} +EOF +fi + fragment <<EOF diff --git a/ld/emultempl/pdp11.em b/ld/emultempl/pdp11.em index f725e73..6a3cacb 100644 --- a/ld/emultempl/pdp11.em +++ b/ld/emultempl/pdp11.em @@ -94,7 +94,11 @@ gld${EMULATION_NAME}_handle_option (int optc) static char * gld${EMULATION_NAME}_get_script (int *isfile) EOF + +if test x"$COMPILE_IN" = xyes +then # Scripts compiled in. + # sed commands to quote an ld script as a C string. sc="-f stringify.sed" @@ -109,8 +113,7 @@ sed $sc ldscripts/${EMULATION_NAME}.xu >> 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 (link_info.separate_code) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn | \ - sed -e "s/ALIGN($TARGET_PAGE_SIZE)/0/" >> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.xe >> 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 echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c @@ -119,6 +122,29 @@ echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c +else +# Scripts read from the filesystem. + +fragment <<EOF +{ + *isfile = 1; + + if (bfd_link_relocatable (&link_info) && config.build_constructors) + return "ldscripts/${EMULATION_NAME}.xu"; + else if (bfd_link_relocatable (&link_info)) + return "ldscripts/${EMULATION_NAME}.xr"; + else if (link_info.separate_code) + return "ldscripts/${EMULATION_NAME}.xe"; + else if (!config.text_read_only) + return "ldscripts/${EMULATION_NAME}.xbn"; + else if (!config.magic_demand_paged) + return "ldscripts/${EMULATION_NAME}.xn"; + else + return "ldscripts/${EMULATION_NAME}.x"; +} +EOF +fi + fragment <<EOF /* --- \end{pdp11.em} */ diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index f9060be..748a6b4 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -2355,7 +2355,11 @@ gld_${EMULATION_NAME}_find_potential_libraries static char * gld_${EMULATION_NAME}_get_script (int *isfile) EOF + +if test x"$COMPILE_IN" = xyes +then # Scripts compiled in. + # sed commands to quote an ld script as a C string. sc="-f stringify.sed" @@ -2381,6 +2385,36 @@ echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c +else +# Scripts read from the filesystem. + +fragment <<EOF +{ + *isfile = 1; + + if (bfd_link_relocatable (&link_info) && config.build_constructors) + return "ldscripts/${EMULATION_NAME}.xu"; + else if (bfd_link_relocatable (&link_info)) + return "ldscripts/${EMULATION_NAME}.xr"; + else if (!config.text_read_only) + return "ldscripts/${EMULATION_NAME}.xbn"; + else if (!config.magic_demand_paged) + return "ldscripts/${EMULATION_NAME}.xn"; +EOF +if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then +fragment <<EOF + else if (link_info.pei386_auto_import == 1 + && (MERGE_RDATA_V2 || link_info.pei386_runtime_pseudo_reloc != 2)) + return "ldscripts/${EMULATION_NAME}.xa"; +EOF +fi +fragment <<EOF + else + return "ldscripts/${EMULATION_NAME}.x"; +} +EOF +fi + fragment <<EOF diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index ca335b5..ff49c15 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -2175,7 +2175,11 @@ gld_${EMULATION_NAME}_find_potential_libraries static char * gld_${EMULATION_NAME}_get_script (int *isfile) EOF + +if test x"$COMPILE_IN" = xyes +then # Scripts compiled in. + # sed commands to quote an ld script as a C string. sc="-f stringify.sed" @@ -2201,6 +2205,36 @@ echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c +else +# Scripts read from the filesystem. + +fragment <<EOF +{ + *isfile = 1; + + if (bfd_link_relocatable (&link_info) && config.build_constructors) + return "ldscripts/${EMULATION_NAME}.xu"; + else if (bfd_link_relocatable (&link_info)) + return "ldscripts/${EMULATION_NAME}.xr"; + else if (!config.text_read_only) + return "ldscripts/${EMULATION_NAME}.xbn"; + else if (!config.magic_demand_paged) + return "ldscripts/${EMULATION_NAME}.xn"; +EOF +if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then +fragment <<EOF + else if (link_info.pei386_auto_import == 1 + && link_info.pei386_runtime_pseudo_reloc != 2) + return "ldscripts/${EMULATION_NAME}.xa"; +EOF +fi +fragment <<EOF + else + return "ldscripts/${EMULATION_NAME}.x"; +} +EOF +fi + fragment <<EOF |