diff options
Diffstat (limited to 'ld/emultempl/hppaosf.em')
-rw-r--r-- | ld/emultempl/hppaosf.em | 72 |
1 files changed, 58 insertions, 14 deletions
diff --git a/ld/emultempl/hppaosf.em b/ld/emultempl/hppaosf.em index b066f6b..d08951d 100644 --- a/ld/emultempl/hppaosf.em +++ b/ld/emultempl/hppaosf.em @@ -1,3 +1,5 @@ +# This shell script emits a C file. -*- C -*- +# It does some substitutions. cat >em_${EMULATION_NAME}.c <<EOF /* An emulation for HP PA-RISC OSF/1 linkers. Copyright (C) 1991 Free Software Foundation, Inc. @@ -79,24 +81,66 @@ hppaosf_set_output_arch() bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); } -static char *script = -"hppaosf.x" -; +static char * +hppaosf_get_script(isfile) + int *isfile; +EOF - -static char *script_reloc = -"hppaosf.xr" - ; +if test "$DEFAULT_EMULATION" = "$EMULATION_NAME" +then +# Scripts compiled in. + +# sed commands to quote an ld script as a C string. +sc='s/["\\]/\\&/g +s/$/\\n\\/ +1s/^/"{/ +$s/$/n}"/ +' + +cat >>em_${EMULATION_NAME}.c <<EOF +{ + extern ld_config_type config; + + *isfile = 0; + + if (config.relocateable_output == true && config.build_constructors == true) + return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`; + else if (config.relocateable_output == true) + return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`; + else if (!config.text_read_only) + return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`; + else if (!config.magic_demand_paged) + return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`; + else + return `sed "$sc" ldscripts/${EMULATION_NAME}.x`; +} +EOF +else +# Scripts read from the filesystem. + +cat >>em_${EMULATION_NAME}.c <<EOF +{ + extern ld_config_type config; + + *isfile = 1; + + if (config.relocateable_output == true && config.build_constructors == true) + return "ldscripts/${EMULATION_NAME}.xu"; + else if (config.relocateable_output == true) + 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 -static char *hppaosf_get_script() -{ - extern ld_config_type config; - if (config.relocateable_output) - return script_reloc; - return script; +fi -} +cat >>em_${EMULATION_NAME}.c <<EOF struct ld_emulation_xfer_struct ld_hppaosf_emulation = { |