Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Fix an issue with commit 8602d4fea60d ("Add AIX weak support"),
<https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the
correct condition to set the storage class for weak defined symbols.
The context here is as follows:
else if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->smclas == XMC_XO)
{
BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section));
isym.n_value = h->root.u.def.value;
isym.n_scnum = N_UNDEF;
if (h->root.type == bfd_link_hash_undefweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else
isym.n_sclass = C_EXT;
aux.x_csect.x_smtyp = XTY_ER;
}
so clearly the inner condition can never be true. Correct the condition
then to check for the `bfd_link_hash_defweak' symbol type instead here,
and in a similar place a little further down in the same function.
bfd/
* xcofflink.c (xcoff_write_global_symbol): Fix symbol type
checks for defined weak symbols.
|
|
Currently on S/390 the .got.plt always comes first which prevents the
GNU_RELRO segment from being extended across the non-plt GOT entries.
Just swapping both unfortunately is not that simple since our ABI
requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very
beginning of the entire GOT. Of the 3 magic GOT entries the first is
accessed via got pointer while second and third are being accessed via
DT_PLTGOT. In order to keep them together we make DT_PLTGOT to point
to the .got instead of .got.plt. However, this violates an assumption
in the dynamic linker prelink undo code about the GOTPLT entries
starting at DT_PLTGOT + 3. We got rid of this requirement with a
Glibc patch already in version 2.24:
https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html
So the S/390 relro GOT layout will look like this with this patch:
+----------------------------------+
|got[0]: DYNAMIC | <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got
|got[1]: link_map parm |
|got[2]: &_dl_runtime_resolve |
+----------------------------------+
| | non-plt GOT entries
| |
| |
+----------------------------------+
| | <--- .gotplt, PLT GOT entries
| |
| |
| |
+----------------------------------+
The patch detects the current layout in size_dynamic_section in order
to deal also with linker scripts not generated by this ld version.
With partial relro enabled we pick a linker script where .got and
.got.plt are swapped which then triggers the rest of the logic.
ld/ChangeLog:
2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com>
* emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and
SEPARATE_GOTPLT.
* testsuite/ld-s390/gotreloc_64-relro-1.dd: New test.
* testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ...
* testsuite/ld-s390/gotreloc_64-1.dd: ... this.
* testsuite/ld-s390/s390.exp: Split the GOT testcase into two.
bfd/ChangeLog:
2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com>
* elf-s390-common.c (s390_gotplt_after_got_p): New function.
(s390_got_pointer): New function.
(s390_got_offset): New function.
(s390_gotplt_offset): New function.
* elf64-s390.c (allocate_dynrelocs): Adjust comment.
(elf_s390_size_dynamic_sections): Move space for magic GOT entries
from .got.plt to .got if necessary and pick the right location for
_GLOBAL_OFFSET_TABLE_.
(elf_s390_relocate_section): Use the wrapper functions from
elf-s390-common.c to deal with both possible layouts (either .got
or .got.plt first).
(elf_s390_finish_dynamic_sections): Likewise.
(elf_s390_finish_dynamic_symbol): Make the location of the GOT
magic entries conditional.
|
|
|
|
Use `bfd_is_abs_symbol' to determine whether a symbol is absolute,
avoiding a problem with ordinary symbols defined in a linker script
outside an output section definition. Such symbols have its owning
section set to the absolute section up to the final link phase. A flag
has been added to the link hash to identify such symbols. Rather than
checking the flag by hand, use the macro that does it uniformly for all
users.
bfd/
* elf32-nds32.c (nds32_elf_relax_loadstore): Use
`bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking
whether the symbol is absolute.
(nds32_elf_relax_lo12): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
(elfNN_aarch64_check_relocs): Likewise.
* xcofflink.c (xcoff_need_ldrel_p): Likewise.
(bfd_xcoff_import_symbol): Likewise.
(xcoff_write_global_symbol): Likewise.
|
|
It is usually possible to tell absolute and ordinary symbols apart in
BFD throughout the link, by checking whether the section that owns the
symbol is absolute or not.
That however does not work for ordinary symbols defined in a linker
script outside an output section statement. Initially such symbols are
entered into to the link hash as absolute symbols, owned by the absolute
section. A flag is set in the internal linker expression defining such
symbols to tell the linker to convert them to section-relative ones in
the final phase of the link. That flag is however not accessible to BFD
linker code, including BFD target code in particular.
Add a flag to the link hash then to copy the information held in the
linker expression. Define a macro, `bfd_is_abs_symbol', for BFD code to
use where determining whether a symbol is absolute or ordinary is
required before the final link phase.
This macro will correctly identify the special `__ehdr_start' symbol as
ordinary throughout link, for example, even though early on it will be
assigned to the absolute section. Of course this does not let BFD code
identify what the symbol's ultimate section will be before the final
link phase has converted this symbol (in `update_definedness').
include/
* bfdlink.h (bfd_link_hash_entry): Add `rel_from_abs' member.
bfd/
* linker.c (bfd_is_abs_symbol): New macro.
* bfd-in2.h: Regenerate.
ld/
* ldexp.c (exp_fold_tree_1) <etree_assign, etree_provide>
<etree_provided>: Copy expression's `rel_from_abs' flag to the
link hash.
|
|
|
|
This patch adds functions for grokking and writing more register core
note sections (NT_PPC_TAR, NT_PPC_PPR, NT_PPC_DSCR, NT_PPC_EBB,
NT_PPC_PMU, NT_PPC_TM_CGPR, NT_PPC_TM_CFPR, NT_PPC_TM_CVMX,
NT_PPC_TM_CVSX, NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR,
NT_PPC_TM_CDSCR).
2018-07-16 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
bfd/
* elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
* elf.c (elfcore_write_ppc_tar): New function.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
(elfcore_write_register_note): Call them.
(elfcore_grok_ppc_tar): New function.
(elfcore_grok_ppc_ppr): Likewise.
(elfcore_grok_ppc_dscr): Likewise.
(elfcore_grok_ppc_ebb): Likewise.
(elfcore_grok_ppc_pmu): Likewise.
(elfcore_grok_ppc_tm_cgpr): Likewise.
(elfcore_grok_ppc_tm_cfpr): Likewise.
(elfcore_grok_ppc_tm_cvmx): Likewise.
(elfcore_grok_ppc_tm_cvsx): Likewise.
(elfcore_grok_ppc_tm_spr): Likewise.
(elfcore_grok_ppc_tm_ctar): Likewise.
(elfcore_grok_ppc_tm_cppr): Likewise.
(elfcore_grok_ppc_tm_cdscr): Likewise.
(elfcore_grok_note): Call them.
|
|
|
|
|
|
|
|
|
|
|
|
Correct an issue with commit 0f20cc3522e7 ("TLS support for MIPS"),
<https://sourceware.org/ml/binutils/2005-02/msg00607.html>, where a
condition used to determine whether to use a dynamic symbol for GD, LD
and IE TLS dynamic relocations against a symbol that has been defined
locally has been incorrectly reversed.
It's executables rather than dynamic shared objects where no symbol is
required, because such symbols cannot be preempted and therefore their
values (thread pointer offsets) are fixed at the static link time as is
the associated module ID of the main executable, so the original
condition should have been `shared' instead of `!shared'. This wrong
condition was then later converted from `!shared' to `!bfd_link_pic',
with commit 0e1862bb401f ("Add output_type to bfd_link_info").
Use the correct `bfd_link_dll' condition then, and adjust code for the
dynamic symbol index possibly being -1 as with symbols that have been
forced local, removing unnecessary dynamic relocations from dynamic
regular executables. PIE executables are unaffected as the existing
condition excluded them by chance due to the conversion mentioned above.
Adjust test cases accordingly.
bfd/
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `!bfd_link_pic' in determining the dynamic symbol index.
Avoid the index of -1.
(mips_elf_initialize_tls_slots): Likewise. Flatten code by
moving `dyn' to the beginning of the function block.
ld/
* testsuite/ld-mips-elf/tlsdyn-o32.d: Update test for dynamic
relocation removal.
* testsuite/ld-mips-elf/tlsdyn-o32.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-1.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
|
|
Correct a commit 0e1862bb401f ("Add output_type to bfd_link_info") issue
and use `bfd_link_dll' rather than `bfd_link_pic' in determining whether
to fully resolve GD, LD and IE TLS relocations referring to symbols
locally defined rather than deferring them to the load time by means of
dynamic relocations.
Such symbols cannot be preempted in PIE executables, which are
necessarily PIC, and therefore their values (thread pointer offsets) are
fixed at the static link time as is the associated module ID of the main
executable.
Given the `tlsbin-o32.s' and `tlsdyn-o32.s' sources from our test suite
this removes the absolute TLS relocations from the static:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
1000002c R_MIPS_TLS_TPREL32 *ABS*
10000030 R_MIPS_TLS_DTPMOD32 *ABS*
10000038 R_MIPS_TLS_DTPMOD32 *ABS*
and the dynamic:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
1000002c R_MIPS_TLS_TPREL32 *ABS*
10000038 R_MIPS_TLS_DTPMOD32 *ABS*
10000044 R_MIPS_TLS_DTPMOD32 *ABS*
10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd
10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd
10000040 R_MIPS_TLS_TPREL32 tlsvar_ie
PIE executable respectively, as reported by `objdump -R', and fills the
corresponding GOT slots with the values expected, as recorded with the
test cases added. The new output from `objdump -R' is:
DYNAMIC RELOCATION RECORDS (none)
and:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd
10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd
10000040 R_MIPS_TLS_TPREL32 tlsvar_ie
for the static and the dynamic executable respectively.
2018-07-11 Maciej W. Rozycki <macro@mips.com>
Rich Felker <bugdal@aerifal.cx>
bfd/
PR ld/22570
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `bfd_link_pic' to determine whether dynamic relocations are
to be produced.
(mips_elf_initialize_tls_slots): Likewise.
ld/
PR ld/22570
* testsuite/ld-mips-elf/tlsbin-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsbin-pie-o32.got: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.got: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
|
|
|
|
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../bfd/elflink.c: In function 'bfd_elf_final_link':
.../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:154: error: shadowed declaration is here
which for versions of GCC before 4.8 prevent support for ELF targets
from being built. See also GCC PR c/53066.
bfd/
* elflink.c (bfd_elf_final_link): Rename `remove' local variable
to `remove_section'.
|
|
elf32-xgate.c contains many functions that are only stubs and
elf32-xgate.h contains unused declarations. While this might be
reasonable for the initial commit of a port with subsequent work
fleshing out the stubs, xgate has only had two minor target specific
patches since the initial commit over six years ago. The rest of the
changes have been general maintenance work applied to all ELF targets,
and some of this work could have been avoided if the stubs hadn't been
there. So this patch removes all the stubs.
I've kept the functionality of the old elf32_xgate_add_symbol_hook,
implemented in elf32_xgate_backend_symbol_processing. Presumably,
that's to set the symbol st_target_internal flag for use in
elf32-m68hc1x.c:elf32_m68hc11_relocate_section.
The empty elf32_xgate_relocate_section meant that xgate had no linker.
Or at least, no linker relocation processing. Deleting the
elf_backend_relocate_section define means the target will now use the
generic linker reloc processing. How good that is will depend on the
accuracy of the reloc howtos..
I haven't updated the ld testsuite to xfail tests expected to fail
for generic elf targets.
bfd/
* elf32-xgate.h: Delete.
* elf32-xgate.c: Delete unnecessary forward declarations, add two
that are now needed.
(xgate_elf_bfd_link_hash_table_create)
(xgate_elf_bfd_link_hash_table_free)
(xgate_elf_set_mach_from_flags, struct xgate_scan_param)
(stub_hash_newfunc, elf32_xgate_add_symbol_hook)
(elf32_xgate_setup_section_lists, elf32_xgate_size_stubs)
(elf32_xgate_build_stubs, elf32_xgate_check_relocs)
(elf32_xgate_relocate_section, _bfd_xgate_elf_set_private_flags)
(elf32_xgate_post_process_headers): Delete.
(elf32_xgate_backend_symbol_processing): New function.
(xgate_elf_ignore_reloc, xgate_elf_special_reloc)
(_bfd_xgate_elf_print_private_bfd_data): Make static.
(ELF_TARGET_ID, elf_info_to_howto, elf_backend_check_relocs)
(elf_backend_relocate_section, elf_backend_object_p)
(elf_backend_final_write_processing, elf_backend_can_gc_sections)
(elf_backend_post_process_headers, elf_backend_add_symbol_hook)
(bfd_elf32_bfd_link_hash_table_create)
(bfd_elf32_bfd_set_private_flags)
(xgate_stub_hash_lookup): Don't define.
(elf_backend_symbol_processing): Define.
* elf-bfd.h (elf_target_id): Delete XGATE_ELF_DATA.
ld/
* emulparams/xgateelf.sh (TEMPLATE_NAME) Set to generic.
(EXTRA_EM_FILE): Set to genelf.
|
|
|
|
Correct a MIPS/BFD linker issue with dynamic symbol and corresponding
GOT entry values being redirected to lazy binding stubs where the stubs
section has been discarded by assigning to the `/DISCARD/' output
section in the linker script used. The issue manifests itself by the
values entered being relative to the absolute section, which is what any
discarded sections are internally assigned in the linker.
For the `stub-dynsym-2.s' piece of code included as a test case with
this change this issue results in the dynamic symbol table and the GOT
looking like:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000010 0 FUNC GLOBAL DEFAULT UND bar
2: 00000000 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value: 00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp) 00000000 Lazy resolver
00090004 -32748(gp) 80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp) 00000010 00000010 FUNC UND bar
0009000c -32740(gp) 00000000 00000000 FUNC UND foo
if assembled to regular MIPS code, or:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000d 0 FUNC GLOBAL DEFAULT UND bar
2: 00000001 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value: 00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp) 00000000 Lazy resolver
00090004 -32748(gp) 80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp) 0000000d 0000000d FUNC UND bar
0009000c -32740(gp) 00000001 00000001 FUNC UND foo
if assembled to microMIPS code. Symbol values and GOT entries record
the offset into the inexistent stubs section and the ISA bit rather than
zero, which would be the case if a lazy binding stub was not used for
other reasons, such as the value of the symbol being taken for a purpose
other than making a function call (e.g. an R_MIPS_GOT16 relocation).
Correct the issue by refraining from redirecting symbols to lazy binding
stubs if the stubs section is going to be discarded.
bfd/
* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Don't set
`->needs_lazy_stub' if the stubs output section is the absolute
section.
ld/
* testsuite/ld-mips-elf/stub-dynsym-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.dd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.gd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.sd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-2.ld: New test linker
script.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.ld: New test
linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
|
|
Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".
PR ld/23388
* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
* configure: Regenerated.
|
|
With config.sub now properly returning m68hc12-unknown-elf rather than
m68hc12-unknown-none, more ELF tests run. This patch enables
STB_GNU_UNIQUE processing fixing some testsuite failures that probably
no m68hc12 user cares about, and removes some XPASSes.
bfd/
* elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call
_bfd_elf_post_process_headers.
ld/
* testsuite/ld-discard/extern.d: Remove m68hc12 xfail.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
|
|
|
|
|
|
|
|
Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:
void weak_function (void);
if (weak_function)
weak_function ();
This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.
bfd/
2018-07-06 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.
|
|
The NT_ARM_SVE section is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
* A NT_ARM_SVE note will be added to each coredump for each thread of the
dumped process. The contents will be equivalent to the data that would have
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
when the coredump was generated.
* elf.c (elfcore_grok_aarch_sve): New function.
(elfcore_grok_note): Check for Aarch64 SVE.
(elfcore_write_aarch_sve): New function.
(elfcore_write_register_note): Check for Aarch64 SVE.
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
|
|
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.
include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
|
|
bfd/
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
(riscv64*-*-*): Likewise.
(riscv-*-*): Add as an alias for riscv32*-*-*.
ld/
* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.
|
|
|
|
There is no need to generate x86 ISA properties with empty bits in
linker output.
bfd/
PR ld/23372
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
ISA properties with empty bits.
ld/
PR ld/23372
* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
* testsuite/ld-i386/pr23372a.d: New file.
* testsuite/ld-i386/pr23372a.s: Likewise.
* testsuite/ld-i386/pr23372b.d: Likewise.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372b.d: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
pr23372b and pr23372b-x32.
|
|
various components of the binutuls.
ld * po/bg.po: Updated Bulgarian translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.
binutils* po/bg.po: Updated Bulgarian translation.
bfd,gas * po/ru.po: Updated Russian translation.
|
|
And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.
bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
on mismatch. Remove "warning: " from messages. Track last bfd
used to set tags.
(ppc_elf_merge_obj_attributes): Likewise. Handle status from
_bfd_elf_ppc_merge_fp_attributes.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
from _bfd_elf_ppc_merge_fp_attributes.
ld/
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.
|
|
|
|
Since bfd.h is an installed header, also install diagnostics.h.
* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
* Makefile.in: Regenerated.
|
|
|
|
Setting SEC_EXCLUDE for empty .gnu.attributes is too late in the link
process for the linker to remove the section. That must be done in
bfd_elf_final_link, as we do for removed group sections.
* elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
sections.
|
|
.gnu.attributes entries from linker input files are merged to the
output file, the output having the union of compatible input
attributes. Incompatible attributes generally cause a linker error
and no output. However in some cases only a warning is emitted, and
one of the incompatible input attributes is passed on to the output.
PowerPC tends to emit warnings rather than errors, and the output
takes the first input attribute. For example, if we have two input
files with Tag_GNU_Power_ABI_FP, the first with a value signifying
"double-precision hard float, IBM long double", the second with a
value signifying "double-precision hard float, IEEE long double",
we'll get a warning about incompatible long double types and the
output will say "double-precision hard float, IBM long double".
The output attribute of course isn't correct. It would be correct to
specify "IBM and IEEE long double", but we don't have a way to
represent that currently. While it would be possible to extend the
encoding, there isn't much gain in doing so. A shared library
providing support for both long double types should link against
objects using either long double type without warning or error. That
is what you'd get if such a shared library had no Tag_GNU_Power_ABI_FP
attribute.
So this patch provides a way for the backend to omit .gnu.attributes
tags from the output.
* elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
* elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
ATTR_TYPE_FLAG_INT_VAL. Set ATTR_TYPE_HAS_ERROR on finding
incompatible attribute.
(ppc_elf_merge_obj_attributes): Likewise. Return
_bfd_elf_merge_object_attributes result.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
_bfd_elf_merge_object_attributes result.
|
|
This is a followup to git commit 97196564c7 "Strip global symbol
defined in discarded section". If a symbol defined in a discarded
section was dynamic, that patch left .dynsym with holes (ie. all zero
entries). For example, the following from libstdc++.so:
Symbol table '.dynsym' contains 6090 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000000a74e0 0 SECTION LOCAL DEFAULT 10
2: 0000000000264180 0 SECTION LOCAL DEFAULT 17
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_addUserCommitAction
4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_memcpyRtWn
5: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 5 found at index >= .dynsym's sh_info value of 3
6: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 6 found at index >= .dynsym's sh_info value of 3
[snip]
This patch removes the symbols from .dynsym too.
PR 17550
* elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
in discarded sections.
|
|
|
|
Prevent runtime procedure table symbols, produced with `ict_irix5' MIPS
targets, from being swept in section GC, fixing linker errors like:
./ld-new: tmpdir/dump: protected symbol `_procedure_table_size' isn't defined
./ld-new: final link failed: bad value
triggered whenever section GC is enabled with those targets and
consequently removing the following test suite failures:
FAIL: Build pr22649-2a.so
FAIL: Build pr22649-2c.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: --gc-sections with .text._init
FAIL: pr20022
observed with `mips-elf', `tx39-elf', `mipsisa32-elf', `mipsisa64-elf',
`mipsel-elf', `mipsisa32el-elf', `mipsisa64el-elf', `mips64vr-elf',
`mips64vrel-elf', `mips64vr4300-elf', `mips64vr4300el-elf',
`mips-sgi-irix5' and `mips-rtems' targets, among others. This fix makes
section GC usable with the affected targets.
bfd/
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
`mark' for symbols created from `mips_elf_dynsym_rtproc_names'
list.
|
|
Complement commit df58fc944dbc ("MIPS: microMIPS ASE support"),
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, and add TLS
and a few miscellaneous relocations to NewABI microMIPS support, fixing
GAS assertion failures:
.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:19: Internal error in append_insn at .../gas/config/tc-mips.c:7660.
Please report this bug.
observed if an attempt is made to assemble the `elf-rel28.s' test case
to microMIPS code. The relocations are the same as with o32 support,
except for `partial_inplace' and `src_mask' updates for the respective
RELA variants.
bfd/
* elf64-mips.c (micromips_elf64_howto_table_rel): Add
R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2 and
R_MICROMIPS_PC23_S2 relocation entries.
(micromips_elf64_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
* elfn32-mips.c (elf_micromips_howto_table_rel): Likewise.
(elf_micromips_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
gas/
* testsuite/gas/mips/elf-rel28-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-micromips-n64.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
|
|
We need to clear the R_X86_64_converted_reloc_bit bit after setting it
to avoid leaking it out by --emit-relocs.
bfd/
PR ld/23324
* elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
R_X86_64_converted_reloc_bit bit.
ld/
PR ld/23324
* testsuite/ld-x86-64/pr23324.s: New file.
* testsuite/ld-x86-64/pr23324a.d: Likewise.
* testsuite/ld-x86-64/pr23324b.d: Likewise.
|
|
Bug #13157 is about a gdb regression, where previously it could handle
universal libraries, but now cannot.
gdb isn't working for me on macOS for other reasons, so I wrote this
small test program to show the problem:
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <bfd.h>
void
die (const char *what)
{
fprintf (stderr, "die: %s\n", what);
exit (1);
}
int
main (int argc, char **argv)
{
bfd *file = bfd_openr (argv[1], NULL);
if (file == NULL)
die ("couldn't open");
if (!bfd_check_format (file, bfd_archive))
die ("not an archive");
printf ("yay\n");
bfd_close (file);
return 0;
}
Then I built a simple universal binary. With git master BFD, I get:
$ ./doit ./universal-exe
die: not an archive
Jeff Muizelaar tracked this down to the BFD change for PR binutils/21787.
This patch changed bfd_generic_archive_p to sometimes reset the BFD's
"format" field.
However, simply changing bfd_generic_archive_p regressed the test case
in that bug.
Debugging PR binutils/21787 again, what I saw is that the mach-o
universal binary support acts like a bfd_archive but does not provide
a _close_and_cleanup function. However, if a BFD appears as an
archive member, it must always remove its own entry from its parent's
map. Otherwise, when the parent is destroyed, the already-destroyed
child BFD will be referenced. mach-o does not use the usual archive
member support, so simply using _bfd_archive_close_and_cleanup (as
other targets do) will not work.
This patch fixes the problem by introducing a new
_bfd_unlink_from_archive_parent function, then arranging for it to be
called in the mach-o case.
Ok?
bfd/ChangeLog
2018-07-02 Jeff Muizelaar <jrmuizel@gmail.com>
Tom Tromey <tom@tromey.com>
PR 13157
PR 21787
* mach-o.c (bfd_mach_o_fat_close_and_cleanup): New function.
(bfd_mach_o_close_and_cleanup): Redefine.
* archive.c (_bfd_unlink_from_archive_parent): New function,
extracted from..
(_bfd_archive_close_and_cleanup): ..here.
(bfd_generic_archive_p): Do not clear archive's format.
* libbfd-in.h (_bfd_unlink_from_archive_parent): Declare.
* libbfd.h: Regenerate.
|
|
BFD's bfd_get_mach () function returns a bfd specific value representing
the architecture of the target which is populated from the Tag_CPU_arch
build attribute value of that target. Among other users of that
interfacem, objdump which uses it to print the architecture version of
the binary being examinated and to decide what instruction is available
if run with "-m arm" via its own mapping from bfd_mach_arm_X values to
feature bits available.
However, both BFD and objdump's most recent known architecture is
Armv5TE. When encountering a newer architecture bfd_get_mach will return
bfd_mach_arm_unknown. This is unfortunate since objdump uses that value
to allow all instructions on all architectures which is already what it
does by default, making the "-m arm" trick useless.
This patch updates BFD and objdump's knowledge of Arm architecture
versions up to the latest Armv8-M Baseline and Mainline, Armv8-R and
Armv8.4-A architectures. Since several architecture versions (eg. 8.X-A)
share the same Tag_CPU_arch build attribute value and
bfd_mach_arm values, the mapping from bfd machine value to feature bits
need to return the most featureful feature bits that would yield the
given bfd machine value otherwise some instruction would not disassemble
under "-m arm" mode. The patch rework that mapping to make this clearer
and simplify writing the mapping rules. In particular, for simplicity
all FPU instructions are allowed in all cases.
Finally, the patch also rewrite the cpu_arch_ver table in GAS to use the
TAG_CPU_ARCH_X macros rather than hardcode their value.
2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* archures.c (bfd_mach_arm_5TEJ, bfd_mach_arm_6, bfd_mach_arm_6KZ,
bfd_mach_arm_6T2, bfd_mach_arm_6K, bfd_mach_arm_7, bfd_mach_arm_6M,
bfd_mach_arm_6SM, bfd_mach_arm_7EM, bfd_mach_arm_8, bfd_mach_arm_8R,
bfd_mach_arm_8M_BASE, bfd_mach_arm_8M_MAIN): Define.
* bfd-in2.h: Regenerate.
* cpu-arm.c (arch_info_struct): Add entries for above new
bfd_mach_arm values.
* elf32-arm.c (bfd_arm_get_mach_from_attributes): Add Tag_CPU_arch to
bfd_mach_arm mapping logic for pre Armv4 and Armv5TEJ and later
architectures. Force assert failure for any new Tag_CPU_arch value.
gas/
* config/tc-arm.c (cpu_arch_ver): Use symbolic TAG_CPU_ARCH macros
rather than hardcode their values.
ld/
* arm-dis.c (select_arm_features): Fix typo in heading comment. Allow
all FPU features and add mapping from new bfd_mach_arm values to
allowed CPU feature bits.
opcodes/
* testsuite/ld-arm/tls-descrelax-be8.d: Add architecture version in
expected result.
* testsuite/ld-arm/tls-descrelax-v7.d: Likewise.
* testsuite/ld-arm/tls-longplt-lib.d: Likewise.
* testsuite/ld-arm/tls-longplt.d: Likewise.
|
|
Binutils documentation uses a mix of spelling for the compound word
"command-line X". According to [1]:
"Sometimes compound words are written separately (nail polish),
sometimes with a hyphen (short-sighted) and sometimes as one word
(eyelashes). Often new compounds are written as two separate words and,
as they become more familiar, they are either connected with a hyphen
(-) or made into one word."
I think command-line X is common enough in our industry that the two
workds command and line should be connected. Since command-line is more
common than commandline, I propose to update binutils documentation to
consistently use "command-line" when this is used as an adjective to a
noun (eg. command-line argument, command-line switch, command-line
option and command-line flag). I've left occurences of "the command
line" as is. I've also left gdb, sim and readline alone and have only
touched public documentation (texi and NEWS files).
[1]
http://dictionary.cambridge.org/grammar/british-grammar/word-formation/compounds
2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* doc/bfdint.texi: Use command-line consistently when used in a
compount word.
* doc/bfdsumm.texi: Likewise.
binutils/
* NEWS: Use command-line consistently when used in a compount word.
* doc/binutils.texi: Likewise and fix trailing whitespace on same
line.
gas/
* NEWS: Use command-line consistently when used in a compount word.
* doc/as.texi: Likewise.
* doc/c-aarch64.texi: Likewise.
* doc/c-alpha.texi: Likewise.
* doc/c-arc.texi: Likewise.
* doc/c-arm.texi: Likewise.
* doc/c-avr.texi: Likewise.
* doc/c-bfin.texi: Likewise.
* doc/c-cris.texi: Likewise.
* doc/c-epiphany.texi: Likewise.
* doc/c-i386.texi: Likewise.
* doc/c-ia64.texi: Likewise.
* doc/c-lm32.texi: Likewise.
* doc/c-m32r.texi: Likewise.
* doc/c-m68k.texi: Likewise.
* doc/c-mips.texi: Likewise.
* doc/c-mmix.texi: Likewise.
* doc/c-msp430.texi: Likewise.
* doc/c-mt.texi: Likewise.
* doc/c-nios2.texi: Likewise.
* doc/c-ppc.texi: Likewise.
* doc/c-pru.texi: Likewise.
* doc/c-rl78.texi: Likewise.
* doc/c-rx.texi: Likewise.
* doc/c-tic6x.texi: Likewise.
* doc/c-v850.texi: Likewise.
* doc/c-vax.texi: Likewise.
* doc/c-visium.texi: Likewise.
* doc/c-xstormy16.texi: Likewise.
* doc/c-xtensa.texi: Likewise.
* doc/c-z80.texi: Likewise.
* doc/c-z8k.texi: Likewise.
* doc/internals.texi: Likewise.
gprof/
* gprof.texi: Use command-line consistently when used in a compount
word.
ld/
* NEWS: Use command-line consistently when used in a compount word.
* ld.texinfo: Likewise.
* ldint.texinfo: Likewise.
|
|
|
|
|
|
|
|
Remove an extraneous symbol visibility check made for undefined weak
symbols in determination whether an R_MIPS_REL32 dynamic relocation has
to be placed in output, complementing commit ad9512030937 ("mips: Check
UNDEFWEAK_NO_DYNAMIC_RELOC"). That check duplicates one already made by
the UNDEFWEAK_NO_DYNAMIC_RELOC macro as a part of a broader condition
used to decide if to enter undefined weak symbols to the dynamic symbol
table or not.
bfd/
* elfxx-mips.c (allocate_dynrelocs): Remove extraneous symbol
visibility check made for undefined weak symbols.
|