diff options
Diffstat (limited to 'ld/emultempl/elf32.em')
-rw-r--r-- | ld/emultempl/elf32.em | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index c5ffe14..cce6b3e 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -3,6 +3,11 @@ # This file is now misnamed, because it supports both 32 bit and 64 bit # ELF emulations. test -z "${ELFSIZE}" && ELFSIZE=32 +if [ -z "$MACHINE" ]; then + OUTPUT_ARCH=${ARCH} +else + OUTPUT_ARCH=${ARCH}:${MACHINE} +fi cat >e${EMULATION_NAME}.c <<EOF /* This file is is generated by a shell script. DO NOT EDIT! */ @@ -90,7 +95,15 @@ cat >>e${EMULATION_NAME}.c <<EOF static void gld${EMULATION_NAME}_before_parse () { - ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; + const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); + if (arch) + { + ldfile_output_architecture = arch->arch; + ldfile_output_machine = arch->mach; + ldfile_output_machine_name = arch->printable_name; + } + else + ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; config.dynamic_link = ${DYNAMIC_LINK-true}; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`; } |