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>
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>
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>
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.
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>
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.
The attempt in 5e9091dab8 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.
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.
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.
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.
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.
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.
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.
Caused by commit 5a97377e55, 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.
This reverts commit 32f1c80375. It had
two unrelated changes lumped together, one of which changed the meaning
of the `mipsisa64*-*-linux*' target triplets, which was not properly
evaluated.