aboutsummaryrefslogtreecommitdiff
path: root/gold
AgeCommit message (Collapse)AuthorFilesLines
2024-08-31gold: Always resolve non-default weak undefined to 0H.J. Lu7-5/+214
Non-default weak undefined symbols in executable and shared library are always resolved to 0 at runtime and don't need dynamic relocation. Tested on i686, x86-64, powerpc64le and aarch64. PR gold/32071 * symtab.cc (Symbol::final_value_is_known): Always resolve non-default weak undefined symbol in executable and shared library to 0 at runtime. * symtab.h (Symbol::needs_dynamic_reloc): Return false for non-default weak undefined symbol in executable and shared library. * testsuite/Makefile.am: Add weak_undef_test_3 and weak_undef_test_4 tests. * testsuite/Makefile.in: Regenerated. * testsuite/weak_undef_lib_4.c: New file. * testsuite/weak_undef_test_3.c: Likewise. * testsuite/weak_undef_test_4.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-28gold: Force a PC-relative reference to .LC0H.J. Lu1-7/+1
Force a PC-relative reference to .LC0 with: __asm__ (".dc.a .LC0 - ."); for all targets. Tested on x86, powerpc64le and aarch64. * testsuite/discard_locals_relocatable_test.c: Force a PC-relative reference to .LC0. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-28gold: Disable &no_such_symbol_ != NULL check when GOT in useH.J. Lu1-0/+3
Since this test: if (&no_such_symbol_ != NULL) { fprintf(stderr, "FAILED weak undef test 4: %s\n", "&no_such_symbol_ is not NULL"); status = 1; } always fails when GOT is used and aarch64 always uses GOT, disable it for aarch64 and PIC. PR gold/32112 * testsuite/weak_undef_test.cc (main): Disable the &no_such_symbol_ != NULL check for aarch64 and PIC. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-28gold: Use asm for GCC 9 and older in PR gold/31830 testsH.J. Lu2-0/+8
Since GCC 9 and older fail to compile PR gold/31830 tests: $ gcc -S testsuite/ver_test_pr31830_b.c -o /tmp/x.s testsuite/ver_test_pr31830_b.c:3:1: warning: ‘__symver__’ attribute directive ignored [-Wattributes] void __collector_foo_2_2(void) {} ^~~~ use asm statement, instead of symver attribute, for GCC 9 and older. PR gold/31830 * testsuite/ver_test_pr31830_b.c (__collector_foo_2_2): Use asm statement, instead of symver attribute, for GCC 9 and older. symver attribute with __asm__. * testsuite/ver_test_pr31830_lto.c (__collector_foo_2_2): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-28gold: Remove duplicated rules for ifuncmain[12457]picstaticH.J. Lu2-60/+30
When HAVE_STATIC and IFUNC_STATIC both are false, "make" reports: Makefile:3796: warning: overriding recipe for target 'ifuncmain1picstatic' Makefile:3788: warning: ignoring old recipe for target 'ifuncmain1picstatic' Makefile:3900: warning: overriding recipe for target 'ifuncmain2picstatic' Makefile:3892: warning: ignoring old recipe for target 'ifuncmain2picstatic' Makefile:3932: warning: overriding recipe for target 'ifuncmain4picstatic' Makefile:3924: warning: ignoring old recipe for target 'ifuncmain4picstatic' Makefile:3972: warning: overriding recipe for target 'ifuncmain5picstatic' Makefile:3964: warning: ignoring old recipe for target 'ifuncmain5picstatic' Makefile:4048: warning: overriding recipe for target 'ifuncmain7picstatic' Makefile:4040: warning: ignoring old recipe for target 'ifuncmain7picstatic' due to duplicated rules for ifuncmain[12457]picstatic: @GCC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @HAVE_STATIC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @IFUNC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @IFUNC_STATIC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @NATIVE_LINKER_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @GCC_TRUE@@HAVE_STATIC_TRUE@@IFUNC_STATIC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld Make rules for ifuncmain[12457]picstatic independent of HAVE_STATIC and IFUNC_STATIC: @GCC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @IFUNC_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @NATIVE_LINKER_FALSE@ifuncmain1picstatic$(EXEEXT): $(ifuncmain1picstatic_OBJECTS) $(ifuncmain1picstatic_DEPENDENCIES) $(EXTRA_ifuncmain1picstatic_DEPENDENCIES) @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld PR gold/32116 * testsuite/Makefile.am (ifuncmain1picstatic): Make it independent of HAVE_STATIC and IFUNC_STATIC. (ifuncmain2picstatic): Likewise. (ifuncmain4picstatic): Likewise. (ifuncmain5picstatic): Likewise. (ifuncmain7picstatic): Likewise. * testsuite/Makefile.in: Regenerated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-29PR32032 dwp segfaults on hello world binaryAlan Modra1-5/+5
Fixing the segfault is easy with this bandaid, but further work is needed to teach dwp about DW_AT_dwo_name and dwo id in the cu header. At the moment dwp only handles DW_AT_GNU_dwo_name and DW_AT_GNU_dwo_id. PR 32032 * dwp.cc (Dwp_output_file::finalize): Return immediately on no output file.
2024-07-20Change version to 2.43.50Nick Clifton1-48/+48
2024-07-20Add markers for 2.43 branch/releaseNick Clifton1-0/+4
2024-07-03x86-64: Support APX NF TLS IE with 2 operandsLingling Kong2-0/+2
Support APX NF TLS IE with 2 operands.Verify it with ld and gold. gas/ * config/tc-i386.c (md_assemble): Allow APX NF TLS IE with 2 operands. * testsuite/gas/i386/x86-64-gottpoff.d: Updated. * testsuite/gas/i386/x86-64-gottpoff.s: Add APX NF TLS IE tests with 2 operands. gold/ * testsuite/x86_64_ie_to_le.s: Add APX NF TLS IE tests with 2 operands. * testsuite/x86_64_ie_to_le.sh: Updated. ld/ * testsuite/ld-x86-64/tlsbindesc.s: Add APX NF TLS IE tests with 2 operands. * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
2024-07-01x86-64: Verify that TLS IE works with APX NFkonglin12-0/+4
Verify that {nf} add %reg1, foo@gottpoff(%rip), %reg2 {nf} add foo@gottpoff(%rip), %reg, %reg2 work correctly with ld and gold. gas/ * testsuite/gas/i386/x86-64-gottpoff.d: Updated. * testsuite/gas/i386/x86-64-gottpoff.s: Add tests for "{nf} add %reg1, foo@gottpoff(%rip), %reg2" and "{nf} add foo@gottpoff(%rip), %reg, %reg2". gold/ * testsuite/x86_64_ie_to_le.s: Add tests for "{nf} add %reg1, foo@gottpoff(%rip), %reg2" and "{nf} add foo@gottpoff(%rip), %reg, %reg2". * testsuite/x86_64_ie_to_le.sh: Updated. ld/ * testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF for APX NF tests. * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise. Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-06-20Revert "Remove LIBINTL_DEP"Alan Modra5-8/+15
This reverts commit e874cbd3879843a83e4bcc4b54cd7107387b1df6. The patch was wrong. LIBINTL_DEP is needed with an in-tree gettext.
2024-06-20Remove LIBINTL_DEPAlan Modra5-15/+8
The intl directory in the source no longer exists. LIBINTL_DEP is thus always empty. Remove references to it. config/ * gettext-sister.m4: Don't AC_SUBST LIBINTL_DEP. bfd/ * Makefile.in: Regenerate. * configure: Regenerate. binutils/ * Makefile.am (*_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. gas/ * Makefile.am (as_new_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. gdb/ * Makefile.in (INTL_DEPS): Don't set or reference. * configure: Regenerate. gdbserver/ * Makefile.in (INTL_DEPS): Don't set or reference. gdbsupport/ * Makefile.in: Regenerate. * configure: Regenerate. gold/ * Makefile.am (deps_var): Remove LIBINTL_DEP. (incremental_dump_DEPENDENCIES, dwp_DEPENDENCIES): Likewise. * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.am (DEPENDENCIES): Remove LIBINTL_DEP. * testsuite/Makefile.in: Regenerate. gprof/ * Makefile.am (gprof_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. ld/ * Makefile.am (ld_new_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. libctf/ * Makefile.in: Regenerate. * configure: Regenerate. opcodes/ * configure.ac (BUILD_LIBS): Remove LIBINTL. (BUILD_LIB_DEPS): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate.
2024-06-10autoupdate: regen after replacing obsolete macrosMatthieu Longo1-2/+0
2024-06-10autoupdate: add square brackets around arguments of AC_INITMatthieu Longo1-1/+1
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fINIT-2
2024-06-10autoupdate: replace obsolete macros AC_AIX, AC_MINIX, and AC_GNU_SOURCEMatthieu Longo1-2/+0
- AC_AIX, AC_MINIX, and AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fAIX https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fMINIX-1 https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fGNU_005fSOURCE-1
2024-06-08gold: Properly remove the versioned symbolH.J. Lu10-25/+261
When the versioned symbol foo is removed from the shared library, the ".symver foo,foo@VER" directive provides binary compatibility for foo@VER. In this case, the unversioned symbol foo should be hidden and shouldn't generate a multiple definition error. PR gold/31830 * resolve.cc (Symbol_table::resolve): Move symbol version handling to ... * symtab.cc (Symbol_table::add_from_object): Here. If the hidden version from .symver is the same as the default version from the unversioned symbol, don't make the unversioned symbol the default versioned symbol. * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_pr31830.sh. (check_DATA): ver_test_pr31830_a.syms and ver_test_pr31830_b.syms. (ver_test_pr31830_a.syms): New. (ver_test_pr31830_b.syms): Likewise. (ver_test_pr31830_a.so): Likewise. (ver_test_pr31830_b.so): Likewise. * testsuite/Makefile.in: Regenerated. * testsuite/ver_test_pr31830.script: New file. * testsuite/ver_test_pr31830.sh: Likewise. * testsuite/ver_test_pr31830_a.c: Likewise. * testsuite/ver_test_pr31830_b.c: Likewise. * testsuite/ver_test_pr31830_lto.c: Likewise. * testsuite/ver_test_pr31830_lto.sh: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-04-05Add missing install-dvi and install-ps Makefie targets.Christophe Lyon1-0/+2
For some reason, these targets are missing although others from the same family are present. This looks like an oversight. This enables calling 'make install-dvi' from the top-level build directory.
2024-02-08x86-64: Add R_X86_64_CODE_6_GOTTPOFFH.J. Lu3-4/+47
For add %reg1, name@gottpoff(%rip), %reg2 and add name@gottpoff(%rip), %reg1, %reg2 add #define R_X86_64_CODE_6_GOTTPOFF 50 if the instruction starts at 6 bytes before the relocation offset. They are similar to R_X86_64_GOTTPOFF. Linker can covert GOTTPOFF to add $name@tpoff, %reg1, %reg2 Rewrite fx_tcbit, fx_tcbit2 and fx_tcbit3 usage to generate R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX, R_X86_64_CODE_4_GOTPCRELX, R_X86_64_CODE_4_GOTTPOFF, R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_6_GOTTPOFF. NB: There is no need to check BFD_RELOC_X86_64_CODE_4_GOTTPOFF in md_assemble since there is only BFD_RELOC_X86_64_GOTTPOFF at this stage, which will be converted to BFD_RELOC_X86_64_CODE_4_GOTTPOFF or BFD_RELOC_X86_64_CODE_6_GOTTPOFF in i386_validate_fix. 5 relocations: #define R_X86_64_CODE_5_GOTPCRELX 46 #define R_X86_64_CODE_5_GOTTPOFF 47 #define R_X86_64_CODE_5_GOTPC32_TLSDESC 48 #define R_X86_64_CODE_6_GOTPCRELX 49 #define R_X86_64_CODE_6_GOTPC32_TLSDESC 51 are added for completeness and they are unused. bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (R_X86_64_standard): Updated. (x86_64_reloc_map): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_check_tls_transition): Handle R_X86_64_CODE_6_GOTTPOFF. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_scan_relocs): Handle R_X86_64_CODE_6_GOTTPOFF. Issue an error for R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_relocate_section): Handle R_X86_64_CODE_6_GOTTPOFF. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_CODE_5_GOTPCRELX, BFD_RELOC_X86_64_CODE_5_GOTTPOFF, BFD_RELOC_X86_64_CODE_5_GOTPC32_TLSDESC, BFD_RELOC_X86_64_CODE_6_GOTPCRELX, BFD_RELOC_X86_64_CODE_6_GOTTPOFF and BFD_RELOC_X86_64_CODE_6_GOTPC32_TLSDESC. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. elfcpp/ * x86_64.h (R_X86_64_CODE_5_GOTPCRELX): New. (R_X86_64_CODE_5_GOTTPOFF): Likewise. (R_X86_64_CODE_5_GOTPC32_TLSDESC): Likewise. (R_X86_64_CODE_6_GOTPCRELX): Likewise. (R_X86_64_CODE_6_GOTTPOFF): Likewise. (R_X86_64_CODE_6_GOTPC32_TLSDESC): Likewise. gas/ * config/tc-i386.c (tc_i386_fix_adjustable): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (md_assemble): Don't check BFD_RELOC_X86_64_CODE_4_GOTTPOFF. Allow "add %reg1, foo@gottpoff(%rip), %reg2". (output_disp): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. Rewrite setting fx_tcbitX bits for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (md_apply_fix): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (i386_validate_fix): Rewrite fx_tcbitX bit checking for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. * testsuite/gas/i386/x86-64-gottpoff.d: Updated. * testsuite/gas/i386/x86-64-gottpoff.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". gold/ * x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle R_X86_64_CODE_6_GOTTPOFF. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise. (Target_x86_64::Relocate::tls_ie_to_le): Handle. R_X86_64_CODE_6_GOTTPOFF. * testsuite/x86_64_ie_to_le.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". * testsuite/x86_64_ie_to_le.sh: Updated. include/ * elf/x86-64.h (elf_x86_64_reloc_type): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. ld/ * testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF tests. * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
2024-01-29Updated French translations for GOLD and LDNick Clifton1-158/+167
2024-01-22Updated Serbian translations for th bfd, gold and opcodes directoriesNick Clifton1-159/+167
2024-01-18Updated translations for various sub-directoriesNick Clifton2-323/+342
2024-01-15Change version to 2.42.50 and regenerate filesNick Clifton2-94/+98
2024-01-15Add markers for 2.42 branchNick Clifton1-0/+4
2024-01-05Enforce C++11 as a minimum for building gold [PR30867]Tamar Christina6-2/+1012
The attempt in 5e9091dab885 to correct gold for modern LLVM has broken gold for older compilers. This commit introduced C++11 types without changing the build system to require a C++ compiler. More importantly it depends on the compiler having at least C++11 as the default language. Older compilers which support C++11 but not as the default language needlessly break. Fix that. PR gold/30867 * configure.ac (AX_CXX_COMPILE_STDCXX): Require C++11. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate.
2024-01-04Update year range in copyright notice of binutils filesAlan Modra483-485/+485
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-12-28Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFFH.J. Lu7-37/+195
Handle R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC. Convert add name@gottpoff(%rip), %reg mov name@gottpoff(%rip), %reg to add $name@tpoff, %reg mov $name@tpoff, %reg and lea name@tlsdesc(%rip), %reg to mov $name@tpoff, %reg mov name@gottpoff(%rip), %reg if the instruction is encoded with the REX2 prefix when possible. elfcpp/ * x86_64.h (R_X86_64_CODE_4_GOTTPOFF): New. (R_X86_64_CODE_4_GOTPC32_TLSDESC): Likewise. gold/ * x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_4_GOTTPOFF. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise. (Target_x86_64::Relocate::tls_desc_gd_to_ie): Handle R_X86_64_CODE_4_GOTPC32_TLSDESC. (Target_x86_64::Relocate::tls_desc_gd_to_le): Likewise. (Target_x86_64::Relocate::tls_ie_to_le): Handle. R_X86_64_CODE_4_GOTTPOFF. * testsuite/Makefile.am: Add x86_64_ie_to_le test. * testsuite/Makefile.in: Regenerated. * testsuite/x86_64_gd_to_le.s: Add R_X86_64_CODE_4_GOTPC32_TLSDESC test. * testsuite/x86_64_gd_to_le.sh: Check GDesc to LE conversion. * testsuite/x86_64_ie_to_le.s: New file. * testsuite/x86_64_ie_to_le.sh: Likewise.
2023-12-28gold: Handle R_X86_64_CODE_4_GOTPCRELXH.J. Lu7-9/+49
Handle R_X86_64_CODE_4_GOTPCRELX and convert mov name@GOTPCREL(%rip), %r31 to lea name@GOTPCREL(%rip), %r31 if the instruction is encoded with the REX2 prefix when possible. elfcpp/ * x86_64.h (R_X86_64_CODE_4_GOTPCRELX): New. gold/ * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Handle R_X86_64_CODE_4_GOTPCRELX. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::possible_function_pointer_reloc): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. * testsuite/x86_64_mov_to_lea1.s: Add a test for R_X86_64_CODE_4_GOTPCRELX. * testsuite/x86_64_mov_to_lea2.s: Likewise. * testsuite/x86_64_mov_to_lea3.s: Likewise. * testsuite/x86_64_mov_to_lea4.s: Likewise. * testsuite/x86_64_mov_to_lea5.s: Likewise. * testsuite/x86_64_mov_to_lea.sh: Updated.
2023-12-11R_MICROMIPS_GPREL7_S2Alan Modra1-18/+64
This reloc is meant for the 16-bit LWGP instruction, 0x6400/0xfc00 match/mask encoding in `micromips_opcodes'. It is correctly specified to operate on a half-word by the howtos in elf32-mips.c, elfn32-mips.c and elf64-mips.c, but is incorrectly subject to shuffle/unshuffle in code like _bfd_mips_elf32_gprel16_reloc. Current behaviour when applying the reloc to .byte 0x11,0x22,0x33,0x44 is to apply the reloc to byte 0x22 when big-endian, and to byte 0x33 when little-endian. Big-endian behaviour is unchanged after this patch and little-endian correctly applies the reloc to byte 0x11. The patch also corrects REL addend extraction from section contents, and overflow checking. gold had all of the bfd problems with this reloc and additionally did not apply the rightshift by two. bfd/ * elfxx-mips.c (micromips_reloc_shuffle_p): Return false for R_MICROMIPS_GPREL7_S2. (mips_elf_calculate_relocation): Correct sign extension and overflow calculation for R_MICROMIPS_GPREL7_S2. (_bfd_mips_elf_relocate_section): Update small-data overflow message. gold/ * mips.cc (Mips_relocate_functions::should_shuffle_micromips_reloc): Return false for R_MICROMIPS_GPREL7_S2. (Mips_relocate_functions::mips_reloc_unshuffle): Update comment. (Mips_relocate_functions::relgprel): Remove R_MICROMIPS_GPREL7_S2 handling. (Mips_relocate_functions::relgprel7): New function. (Target_mips::Relocate::relocate): Adjust to suit. ld/ * testsuite/ld-mips-elf/reloc-4.d: Adjust expected error. * testsuite/ld-mips-elf/reloc-5.d: Likewise.
2023-11-17Gold/MIPS: Add targ_extra_size=64 for mips32 triplesYunQiang Su2-2/+8
2023-11-16Fix emit-relocs for aarch64 goldVladislav Khmelevsky1-0/+22
Fix relocation offsets values for the relaxed input sections the same way it was fixed for the sections in PR21430.
2023-11-15Finalized intl-update patchesArsen Arsenovi?7-111/+2185
* intl: Remove directory. Replaced with out-of-tree GNU gettext. * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. * src-release.sh: Remove references to the intl/ directory.
2023-11-10Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endianYunQiang Su2-1/+6
2023-11-10MIPS: Change all E_MIPS_* to EF_MIPS_*Ying Huang1-84/+84
2023-09-06gold: Use char16_t, char32_t instead of uint16_t, uint32_t as character typesRoland McGrath4-6/+22
The std::basic_string template type is only specified for instantiations using character types. Newer (LLVM) libc++ implementations no longer allow non-character integer types to be used. gold/ * output.cc: Include <uchar.h>. (Output_section::add_merge_input_section): Use char16_t and char32_t for 2- and 4-byte entry size, respectively. * stringpool.cc: Include <uchar.h>. (Stringpool_template): Explicitly instantiate for char16_t, char32_t instead of uint16_t, uint32_t. * merge.cc (Output_merge_string): Likewise.
2023-08-30Revert "Gold: Add targ_extra_little_endian to configure.ac"Maciej W. Rozycki3-17/+1
This reverts commit cf8565fb2ea42579c50722cbaeafdf71c3d58c66. It was applied unapproved.
2023-08-30Revert "Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian"Maciej W. Rozycki1-1/+1
This reverts commit 39834263784567c306fbccb8230ddd1badca53fe. It was applied unapproved.
2023-08-30Revert "Gold/MIPS: Drop mips*le/mips*el* triple pattern"Maciej W. Rozycki1-1/+1
This reverts commit adb3ae2eba78b4b84d7b94342f6774b250190a98. It was applied unapproved.
2023-08-30Revert "Gold/MIPS: Add targ_extra_size=64 for mips32 triples"Maciej W. Rozycki1-2/+0
This reverts commit d6cdc0af2b880bb48dd16055f4cb3509c7a2da70. It was applied unapproved.
2023-08-30Revert "Gold/MIPS: Add mips64*/mips64*el triple support"Maciej W. Rozycki1-16/+0
This reverts commit 5c4cdba100b66e2924a25dad9b12d8e5b84d527f. It was applied unapproved.
2023-08-30Revert "MIPS: Use 64-bit a ABI by default for `mipsisa64*-*-linux*' targets"Maciej W. Rozycki1-2/+2
This reverts commit 025e84f93566c8ced594ef48ddee1dec7e5b4cdd. It was applied unapproved.
2023-08-27MIPS: Use 64-bit a ABI by default for `mipsisa64*-*-linux*' targetsYunQiang Su1-2/+2
Following the arrangement in GCC select a 64-bit ABI by default, either n32 or n64, rather than o32 for `mipsisa64*-*-linux*' targets, just as with the corresponding `mips64*-*-linux*' targets.
2023-08-27Gold/MIPS: Add mips64*/mips64*el triple supportYunQiang Su1-0/+16
Use targ_size=64 and targ_extra_size=32
2023-08-27Gold/MIPS: Add targ_extra_size=64 for mips32 triplesYunQiang Su1-0/+2
So we can enable 64bit ELF support for MIPS32 toolchain.
2023-08-27Gold/MIPS: Drop mips*le/mips*el* triple patternYunQiang Su1-1/+1
Only mips*el triples are supported by binutils. The mips*le or mips*el* may cause some problem with other components of binutils, since they will consider them as big endian.
2023-08-27Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endianYunQiang Su1-1/+1
EM_MIPS_RS3_LE has been deprecated quite long ago, and in fact most of current LE ELF files are using EM_MIPS. This problem didn't make some trouble for us, is due to that gold is a linker, and all of the inputs to it has right EM values.
2023-08-27Gold: Add targ_extra_little_endian to configure.acYunQiang Su3-1/+17
This option will be used by architectures which is big endian by default, while little-endian support is also needed. Mips(eb) ports are the examples.
2023-08-25PR30794, PowerPC gold: internal error in add_output_section_to_loadAlan Modra1-22/+25
Caused by commit 5a97377e5513, specifically this code added to Target_powerpc::do_relax + if (parameters->options().output_is_position_independent()) + this->rela_dyn_size_ + = this->rela_dyn_section(layout)->current_data_size(); The problem here is that if .rela.dyn isn't already created then the call to rela_dyn_section creates it, and as this comment in Target_powerpc::do_finalize_sections says: // Annoyingly, we need to make these sections now whether or // not we need them. If we delay until do_relax then we // need to mess with the relaxation machinery checkpointing. We can't be creating sections in do_relax. PR 30794 * powerpc.cc (Target_powerpc::do_relax): Only set rela_dyn_size_ for size == 64, and assert that rela_dyn_ already exists. Tidy code setting plt_thread_safe, which also only needs to be set when size == 64 for ELFv1.
2023-08-02Revert "2.41 Release sources"Sam James6-22/+53
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d. See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-022.41 Release sourcesbinutils-2_41-releaseNick Clifton6-53/+22
2023-07-28Revert "MIPS: support mips*64 as CPU and gnuabi64 as ABI"Maciej W. Rozycki1-14/+0
This reverts commit 32f1c80375ebe8ad25d9805ee5889f0006c51e59. It had two unrelated changes lumped together, one of which changed the meaning of the `mipsisa64*-*-linux*' target triplets, which was not properly evaluated.