summaryrefslogtreecommitdiff
path: root/bfd/elfnn-loongarch.c
Commit message (Collapse)AuthorAgeFilesLines
* Update year range in copyright notice of binutils filesAlan Modra2023-01-011-1/+1
| | | | | | The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
* LoongArch: Fix dynamic reloc not generated bug in some cases.mengqinggang2022-12-061-1/+1
| | | | | | bfd/ChangeLog: * elfnn-loongarch.c (loongarch_elf_relocate_section): Likewise.
* LoongArch: Update ELF e_flags handling according to specification.liuzhensong2022-09-301-3/+18
| | | | | | | | | | | | | | | | | | | | | | | Update handling of e_flags according to the documentation update [1] (discussions [2][3]). Object file bitness is now represented in the EI_CLASS byte. The e_flags field is now interpreted as follows: e_flags[2:0]: Base ABI modifier - 0x1: soft-float - 0x2: single-precision hard-float - 0x3: double-precision hard-float e_flags[7:6]: ELF object ABI version - 0x0: v0 - 0x1: v1 [1]: https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc#e_flags-identifies-abi-type-and-version [2]: https://github.com/loongson/LoongArch-Documentation/pull/61 [3]: https://github.com/loongson/LoongArch-Documentation/pull/47
* LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocsXi Ruoyao2022-09-201-17/+24
| | | | | | | | | | | | | | | | | | | | loongarch_elf_finish_dynamic_symbol is called after elf_link_sort_relocs if -z combreloc. elf_link_sort_relocs redistributes the contents of .rela.* sections those would be merged into .rela.dyn, so the slot for R_LARCH_IRELATIVE may be out of relplt->contents now. To make things worse, the boundary check dyn < dyn + relplt->size / sizeof (*dyn) is obviously wrong ("x + 10 < x"? :), causing the issue undetected during the linking process and the resulted executable suddenly crashes at runtime. The issue was found during an attempt to add static-pie support to the toolchain. Fix it by iterating through the inputs of .rela.dyn to find the slot.
* LoongArch: Don't write into GOT for local ifuncXi Ruoyao2022-09-201-2/+3
| | | | | | | | | | | Local ifuncs are always resolved at runtime via R_LARCH_IRELATIVE, so there is no need to write anything into GOT. And when we write the GOT we actually trigger a heap-buffer-overflow: If a and b are different sections, we cannot access something in b with "a->contents + (offset from a)" because "a->contents" and "b->contents" are heap buffers allocated separately, not slices of a large buffer. So stop writing into GOT for local ifunc now.
* LoongArch: ld: Fix bug not generate plt when link a dsoliuzhensong2022-08-241-0/+6
| | | | | | | | | | | | | Fix the bug that can not generate func@plt when linking a undefined function with cmodel=medium. Add testcase. bfd/ * elfnn-loongarch.c ld/testsuite/ld-loongarch-elf/ * cmodel-libjirl.dd * cmodel.exp * libjirl.s
* LoongArch: Set defaults to exec stack 0.liuzhensong2022-08-011-0/+1
|
* Fix indentation in loongarch code, preventing a compile time warning.Nick Clifton2022-07-261-12/+10
|
* bfd: Delete R_LARCH_NONE from dyn info of LoongArch.liuzhensong2022-07-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some R_LARCH_64 in section .eh_frame will to generate R_LARCH_NONE, we change relocation to R_LARCH_32_PCREL from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation for R_LARCH_32_PCREL. Add New relocate type R_LARCH_32_PCREL for .eh_frame. include/elf/ loongarch.h bfd/ bfd/bfd-in2.h libbfd.h reloc.c elfxx-loongarch.c elfnn-loongarch.c gas/config/ tc-loongarch.c binutils/ readelf.c ld/testsuite/ld-elf/ eh5.d
* LoongArch: Move ifunc info to rela.dyn from rela.plt.liuzhensong2022-07-251-29/+344
| | | | | | | | | | | Delete R_LARCH_IRELATIVE from dynamic loader (glibc ld.so) when loading lazy function (rela.plt section). In dynamic programes, move ifunc dynamic relocate info to section srelgot from srelplt. bfd/ elfnn-loongarch.c
* bfd: Add supported for LoongArch new relocations.liuzhensong2022-07-251-430/+772
| | | | | | | | | | | | | | | Define new reloc types according to linker needs. include/elf/ loongarch.h bfd/ bfd-in2.h libbfd.h reloc.c elfnn-loongarch.c elfxx-loongarch.c elfxx-loongarch.h
* Re: Fix new linker testsuite failures due to rwx segment test problemsAlan Modra2022-05-071-3/+0
| | | | | | | | | | Fix it some more. bfd/ * elfnn-loongarch.c: Remove commented out elf_backend_* defines. ld/ * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Match arm*. Delete loongarch.
* loongarch: Don't check ABI flags if no code sectionXi Ruoyao2022-05-051-0/+21
| | | | | | | | | | | | | | | Various packages (glib and gtk4 for example) produces data-only objects using `ld -r -b binary` or `objcopy`, with no elf header flags set. But these files also have no code sections, so they should be compatible with all ABIs. bfd/ * elfnn-loongarch.c (elfNN_loongarch_merge_private_bfd_data): Skip ABI checks if the input has no code sections. Reported-by: Wu Xiaotian <yetist@gmail.com> Suggested-by: Wang Xuerui <i@xen0n.name> Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
* ld:LoongArch: Fix glibc fail: tst-audit25a/b.caiyinyu2022-04-141-0/+16
| | | | | | bfd/ * elfnn-loongarch.c: Add new func elf_loongarch64_hash_symbol.
* LoongArch: Fix LD check fails.liuzhensong2022-03-201-62/+279
| | | | | | | | | | | | | | Some test cases about ifunc. bfd/ * elfnn-loongarch.c * elfxx-loongarch.h === ld Summary === of expected passes 1430 of expected failures 11 of untested testcases 1 of unsupported tests 154
* LoongArch: Update ABI eflag in elf header.liuzhensong2022-03-201-1/+1
| | | | | | | | | | | | | | | | | | | Update LoongArch ABI eflag in elf header. ilp32s 0x5 ilp32f 0x6 ilp32d 0x7 lp64s 0x1 lp64f 0x2 lp64d 0x3 bfd/ * elfnn-loongarch.c Check object flags while ld. gas/ * tc-loongarch.c Write eflag to elf header. include/elf * loongarch.h Define ABI number.
* LoongArch: Use functions instead of magic numbers.liuzhensong2022-03-201-89/+32
| | | | | | | | | | | | | | Replace the magic numbers in gas(tc-loongarch.c) and bfd(elfnn-loongarch.c) with the functions defined in the howto table(elfxx-loongarch.c). gas/ * config/tc-loongarch.c: use functions. bfd/ * elfnn-loongarch.c: use functions. * elfxx-loongarch.c: define functions. * elfxx-loongarch.h
* Update year range in copyright notice of binutils filesAlan Modra2022-01-021-1/+1
| | | | | | | | | | The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
* LoongArch bfd supportliuzhensong2021-10-241-0/+3265
2021-10-22 Chenghua Xu <xuchenghua@loongson.cn> Zhensong Liu <liuzhensong@loongson.cn> Weinan Liu <liuweinan@loongson.cn> bfd/ * Makefile.am: Add LoongArch. * archures.c: Likewise. * config.bfd: Likewise. * configure.ac: Likewise. * cpu-loongarch.c: New. * elf-bfd.h: Add LoongArch. * elf.c: Add LoongArch elfcore_grok_xxx. * elfnn-loongarch.c: New. * elfxx-loongarch.c: New. * elfxx-loongarch.h: New. * reloc.c: Add LoongArch BFD RELOC ENUM. * targets.c: Add LoongArch target. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. * libbfd.h: Regenerate. * po/BLD-POTFILES.in: Regenerate. * po/SRC-POTFILES.in: Regenerate. include/ * elf/common.h: Add NT_LARCH_{CPUCFG,CSR,LSX,LASX}. * elf/loongarch.h: New.