diff options
author | liuzhensong <liuzhensong@loongson.cn> | 2021-10-22 16:42:07 +0800 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-10-24 21:36:32 +1030 |
commit | 560b3fe208255ae909b4b1c88ba9c28b09043307 (patch) | |
tree | 197eb56c181344b0b56a4542bee9cc05e601c408 /ld/emulparams | |
parent | 4462d7c440247bfcdc464412332bbec13b8aab12 (diff) | |
download | gdb-560b3fe208255ae909b4b1c88ba9c28b09043307.zip gdb-560b3fe208255ae909b4b1c88ba9c28b09043307.tar.gz gdb-560b3fe208255ae909b4b1c88ba9c28b09043307.tar.bz2 |
LoongArch ld support
2021-10-22 Chenghua Xu <xuchenghua@loongson.cn>
Zhensong Liu <liuzhensong@loongson.cn>
Weinan Liu <liuweinan@loongson.cn>
Xiaolin Tang <tangxiaolin@loongson.cn>
ld/
* Makefile.am: Add LoongArch.
* NEWS: Mention LoongArch support.
* configure.tgt: Add LoongArch.
* emulparams/elf32loongarch-defs.sh: New.
* emulparams/elf32loongarch.sh: Likewise.
* emulparams/elf64loongarch-defs.sh: Likewise.
* emulparams/elf64loongarch.sh: Likewise.
* emultempl/loongarchelf.em: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
ld/testsuite/
* ld-loongarch-elf/disas-jirl.d: New.
* ld-loongarch-elf/disas-jirl.s: Likewise.
* ld-loongarch-elf/jmp_op.d: Likewise.
* ld-loongarch-elf/jmp_op.s: Likewise.
* ld-loongarch-elf/ld-loongarch-elf.exp: Likewise.
* ld-loongarch-elf/macro_op.d: Likewise.
* ld-loongarch-elf/macro_op.s: Likewise.
* ld-loongarch-elf/syscall-0.s: Likewise.
* ld-loongarch-elf/syscall-1.s: Likewise.
* ld-loongarch-elf/syscall.d: Likewise.
* ld-srec/srec.exp: Add LoongArch.
* ld-unique/pr21529.d: Likewise.
Diffstat (limited to 'ld/emulparams')
-rw-r--r-- | ld/emulparams/elf32loongarch-defs.sh | 36 | ||||
-rw-r--r-- | ld/emulparams/elf32loongarch.sh | 11 | ||||
-rw-r--r-- | ld/emulparams/elf64loongarch-defs.sh | 39 | ||||
-rw-r--r-- | ld/emulparams/elf64loongarch.sh | 11 |
4 files changed, 97 insertions, 0 deletions
diff --git a/ld/emulparams/elf32loongarch-defs.sh b/ld/emulparams/elf32loongarch-defs.sh new file mode 100644 index 0000000..f80f574 --- /dev/null +++ b/ld/emulparams/elf32loongarch-defs.sh @@ -0,0 +1,36 @@ +# This is an ELF platform. +SCRIPT_NAME=elf +ARCH=loongarch +NO_REL_RELOCS=yes + +TEMPLATE_NAME=elf +EXTRA_EM_FILE=loongarchelf + +ELFSIZE=32 + +if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then + case " $EMULATION_LIBPATH " in + *" ${EMULATION_NAME} "*) + NATIVE=yes + ;; + esac +fi + +# Enable shared library support for everything except an embedded elf target. +case "$target" in + loongarch*-elf) + ;; + *) + GENERATE_SHLIB_SCRIPT=yes + GENERATE_PIE_SCRIPT=yes + ;; +esac + +IREL_IN_PLT= +TEXT_START_ADDR=0x10000 +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" + +SEPARATE_GOTPLT=0 +INITIAL_READONLY_SECTIONS=".interp : { *(.interp) } ${CREATE_PIE-${INITIAL_READONLY_SECTIONS}}" +INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIONS}}}" diff --git a/ld/emulparams/elf32loongarch.sh b/ld/emulparams/elf32loongarch.sh new file mode 100644 index 0000000..edc85ec --- /dev/null +++ b/ld/emulparams/elf32loongarch.sh @@ -0,0 +1,11 @@ +source_sh ${srcdir}/emulparams/elf32loongarch-defs.sh +OUTPUT_FORMAT="elf32-loongarch" + +case "$target" in + loongarch32*-linux*) + case "$EMULATION_NAME" in + *32*) + LIBPATH_SUFFIX="32" ;; + esac + ;; +esac diff --git a/ld/emulparams/elf64loongarch-defs.sh b/ld/emulparams/elf64loongarch-defs.sh new file mode 100644 index 0000000..c793f5d --- /dev/null +++ b/ld/emulparams/elf64loongarch-defs.sh @@ -0,0 +1,39 @@ +# This is an ELF platform. +SCRIPT_NAME=elf +ARCH=loongarch +NO_REL_RELOCS=yes + +TEMPLATE_NAME=elf +EXTRA_EM_FILE=loongarchelf + +ELFSIZE=64 + +if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then + case " $EMULATION_LIBPATH " in + *" ${EMULATION_NAME} "*) + NATIVE=yes + ;; + esac +fi + +# Enable shared library support for everything except an embedded elf target. +case "$target" in + loongarch*-elf) + ;; + *) + GENERATE_SHLIB_SCRIPT=yes + GENERATE_PIE_SCRIPT=yes + ;; +esac + +# In all cases, the number is big-endian. +# LoongArch nop is 'andi $r0,$r0,0'. +NOP=0x00004003 + +TEXT_START_ADDR=0x120000000 +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" + +SEPARATE_GOTPLT=0 +INITIAL_READONLY_SECTIONS=".interp : { *(.interp) } ${CREATE_PIE-${INITIAL_READONLY_SECTIONS}}" +INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIONS}}}" diff --git a/ld/emulparams/elf64loongarch.sh b/ld/emulparams/elf64loongarch.sh new file mode 100644 index 0000000..d7b2229 --- /dev/null +++ b/ld/emulparams/elf64loongarch.sh @@ -0,0 +1,11 @@ +source_sh ${srcdir}/emulparams/elf64loongarch-defs.sh +OUTPUT_FORMAT="elf64-loongarch" + +case "$target" in + loongarch64*-linux*) + case "$EMULATION_NAME" in + *64*) + LIBPATH_SUFFIX="64";; + esac + ;; +esac |