Age | Commit message (Collapse) | Author | Files | Lines |
|
The CTF deduplicator was not considering enumerators inside enum types to be
things that caused type conflicts, so if the following two TUs were linked
together, you would end up with the following in the resulting dict:
1.c:
enum foo { A, B };
2.c:
enum bar { A, B };
linked:
enum foo { A, B };
enum bar { A, B };
This does work -- but it's not something that's valid C, and the general
point of the shared dict is that it is something that you could potentially
get from any valid C TU.
So consider such types to be conflicting, but obviously don't consider
actually identical enums to be conflicting, even though they too have (all)
their identifiers in common. This involves surprisingly little code. The
deduplicator detects conflicting types by counting types in a hash table of
hash tables:
decorated identifier -> (type hash -> count)
where the COUNT is the number of times a given hash has been observed: any
name with more than one hash associated with it is considered conflicting
(the count is used to identify the most common such name for promotion to
the shared dict).
Before now, those identifiers were all the identifiers of types (possibly
decorated with their namespace on the front for enumerator identifiers), but
we can equally well put *enumeration constant names* in there, undecorated
like the identifiers of types in the global namespace, with the type hash
being the hash of each enum containing that enumerator. The existing
conflicting-type-detection code will then accurately identify distinct enums
with enumeration constants in common. The enum that contains the most
commonly-appearing enumerators will be promoted to the shared dict.
libctf/
* ctf-impl.h (ctf_dedup_t) <cd_name_counts>: Extend comment.
* ctf-dedup.c (ctf_dedup_count_name): New, split out of...
(ctf_dedup_populate_mappings): ... here. Call it for all
* enumeration constants in an enum as well as types.
ld/
* testsuite/ld-ctf/enum-3.c: New test CTF.
* testsuite/ld-ctf/enum-4.c: Likewise.
* testsuite/ld-ctf/overlapping-enums.d: New test.
* testsuite/ld-ctf/overlapping-enums-2.d: Likewise.
|
|
|
|
Add -z isa-level-report=[none|all|needed|used] to the x86 ELF linker to
report needed and used x86-64 ISA levels.
bfd/
PR ld/31868
* elf-linker-x86.h (elf_x86_isa_level_report): New.
(elf_linker_x86_params): Add isa_level_report.
* elfxx-x86.c (report_isa_level): New.
(_bfd_x86_elf_link_setup_gnu_properties): Check
-z isa-level-report=[none|all|needed|used] to report needed and
used x86-64 ISA level.
ld/
PR ld/31868
* NEWS: Mention -z isa-level-report=[none|all|needed|used].
* ld.texi: Document -z isa-level-report=[none|all|needed|used].
* emulparams/elf32_x86_64.sh: Source x86-64-level-report.sh.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/x86-64-level-report.sh: New file.
* testsuite/ld-i386/pr31868a.d: Likewise.
* testsuite/ld-i386/pr31868b.d: Likewise.
* testsuite/ld-i386/pr31868c.d: Likewise.
* testsuite/ld-x86-64/pr31868a-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868a.d: Likewise.
* testsuite/ld-x86-64/pr31868a.l: Likewise.
* testsuite/ld-x86-64/pr31868a.s: Likewise.
* testsuite/ld-x86-64/pr31868b-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868b.d: Likewise.
* testsuite/ld-x86-64/pr31868b.l: Likewise.
* testsuite/ld-x86-64/pr31868b.s: Likewise.
* testsuite/ld-x86-64/pr31868c-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868c.d: Likewise.
* testsuite/ld-x86-64/pr31868c.l: Likewise.
* testsuite/ld-i386/i386.exp: Run PR ld/31868 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
* lexsup.c (elf_static_list_options): Align --no-error-execstack
help output.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
|
|
|
|
generating two read-only segments.
PR 30907
|
|
Regtested on s390x-redhat-linux.
Rewriting l(g)rl @GOTENT to larl is unnecessarily guarded by
bfd_link_pic(). There were no use cases for this in the past, but
since recently the Linux Kernel on s390x is compiled with -fPIE
and linked with --no-pie. Remove the unnecessary bfd_link_pic()
check.
bfd/ChangeLog:
* elf32-s390.c (elf_s390_relocate_section): Don't check for
bfd_link_pic() when rewriting lrl@GOTENT to larl.
(elf_s390_finish_dynamic_symbol): Emit a relative reloc for
the above case.
* elf64-s390.c (elf_s390_relocate_section): Don't check for
bfd_link_pic() when rewriting lgrl@GOTENT to larl.
(elf_s390_finish_dynamic_symbol): Emit a relative reloc for
the above case.
ld/ChangeLog:
* testsuite/ld-s390/s390.exp: Hook up the new tests.
* testsuite/ld-s390/gotreloc_31-no-pie-1.dd: New test.
* testsuite/ld-s390/gotreloc_64-no-pie-1.dd: New test.
|
|
Not all aarch64 targets supports dt_relr as this requires some
mechanisms on the OS side.
Adjust support_dt_relr helper and use it in aarch64-elf.exp.
|
|
|
|
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fINIT-2
|
|
- 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
|
|
- AC_HELP_STRING by AS_HELP_STRING
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fHELP_005fSTRING-1
Except for the ifdef in lib-prefix.m4, make the defun of AC_LIB_ARG_WITH
unconditional.
|
|
|
|
aarch64-elf fails these tests due to .rela.dyn being at a different
address to that expected, and due to the symbol table being different.
Unexpected symbol numbering results in a mismatch of reloc r_info
field, but these are shown decoded so the raw field doesn't really add
anything to the test.
* testsuite/ld-aarch64/relr-align.d: Accept any address for
.relr.dyn section. Don't match raw r_info field.
* testsuite/ld-aarch64/relr-data-shared.d: Likewise.
* testsuite/ld-aarch64/relr-got-shared.d: Likewise.
* testsuite/ld-aarch64/relr-text-shared.d: Likewise.
|
|
If set the address of section or segment, the offset from pc to symbol
may become bigger and cause overflow.
|
|
|
|
The logic to decide if an input relocation for a symbol becomes a
particular kind of output relocation is one of the hard to maintain
parts of the bfd ld backend, since it is partially repeated across
elfNN_aarch64_check_relocs (where dynamic relocations are counted per
symbol and input section),
elfNN_aarch64_late_size_sections (where relocation sections are sized
and GOT offsets assigned),
elfNN_aarch64_relocate_section (where most relocations are applied and
output to a relocation section),
elfNN_aarch64_finish_dynamic_symbol (where some of the GOT
relocations are applied and output).
The DT_RELR support adds another layer to this complexity: after the
output relocation sections are sized, so all dynamic relocations are
accounted (in elfNN_aarch64_late_size_sections), we scan the symbols
and input relocations again to decide which ones become relative
relocations that can be packed. The sizes of the relocation sections
are updated accordingly. This logic must be consistent with the code
that applies the relocs later so each relative relocation is emitted
exactly once: either in .rela.* or packed in .relr.dyn.
Sizing of .relr.dyn is done via elfNN_aarch64_size_relative_relocs that
may be called repeatedly whenever the layout changes since an address
change can affect the size of the packed format. Then the final content
is emitted in elfNN_aarch64_finish_relative_relocs, that is called
after the layout is final and before relocations are applied and
emitted. These hooks are only called if DT_RELR is enabled.
We only pack relative relocs that are known to be aligned in the output
during .relr.dyn sizing, the potentially unaligned relative relocs are
emitted normally (in .rela.*, not packed), because the format requires
aligned addresses.
|
|
The default memory region sizes for PRU were set somewhat arbitrarily to
the sizes of the most popular BeagleBone board with AM33x SoC. But the
PRU toolchain documentation has always instructed to use SoC-specific
spec files to override the defaults and set the correct memory sizes [1].
The small default memory sizes can cause IMEM memory region overflow
even for simple printf("Hello world") programs, as usually done by
Autotools checks. The stdio is simply too big to fit in 8K
instruction memory. This can confuse the check and lead to wrong
feature selection during configure [2].
Fix by bumping the default DMEM and IMEM memory sizes.
There is no need to backport this patch. Issue was caught with a
feature-rich newlib build used for daily CI. The release builds of the
PRU toolchain use stripped newlib configuration, which does not overflow
the IMEM region, even for 8K.
[1] https://github.com/dinuxbg/gnuprumcu
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115158
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
|
|
This was originally reported by Hau Hsu <hau.hsu@sifive.com>.
Similar to commit 51a8a7c2e3cc0730831963651a55d23d1fae624d
We shouldn't use riscv_elf_append_rela to add dynamic relocs into .rela.iplt
in the riscv_elf_relocate_section when handling ifunc data reloc R_RISCV_32/64.
This just like what did in the riscv_elf_finish_dynamic_symbol.
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): We shouldn't use
riscv_elf_append_rela to add dynamic relocs into .rela.iplt in the
riscv_elf_relocate_section when handling ifunc data reloc.
ld/
* testsuite/ld-riscv-elf/ifunc-overwrite.s: Updated and renamed.
* testsuite/ld-riscv-elf/ifunc-overwrite-exe.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite-pic.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite-pie.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite.d: Renamed.
|
|
ld -z separate-code let .text and .rodata in two different but read only
segment. If the symbol and pc in two segment, the offset from pc to
symbol need to consider segment alignment.
Add a function 'loongarch_two_sections_in_same_segment' to determine
whether two sections are in the same segment.
|
|
This is the v2 patch I am checking in.
H.J.
|
|
Older tool versions (4.12 in my case) demand . or , after @xref{};
arrange for this to be the case.
|
|
PR 31738
|
|
|
|
PR ld/31710
* testsuite/ld-elf/wrap.exp: Run ld/31710 tests.
* testsuite/ld-elf/wrap2.h: New file.
* testsuite/ld-elf/wrap2a.c: Likewise.
* testsuite/ld-elf/wrap2b.c: Likewise.
|
|
Run --wrap tests with shared library only if -shared is supported.
* testsuite/ld-elf/wrap.exp: Run --wrap tests with shared library
only if -shared is supported.
|
|
* https://github.com/riscv/riscv-b/tags
Added standard B extension back, which implies Zba, Zbb and Zbs extensions.
* https://github.com/riscv/riscv-zaamo-zalrsc/tags
Splited standard A extension into two new extensions, Zaamo and Zalrsc.
The A extension implies Zaamo and Zalrsc extensions.
Not sure if we need to do the similar check as i and zicsr/zifencei.
Passed riscv[32|64]-[elf/linux] binutils testcases.
bfd/
* elfxx-riscv.c (riscv_implicit_subsets): Added imply rules
for A and B extensions. The A implies Zaamo and Zalrsc, the
B implies Zba, Zbb and Zbs.
(riscv_supported_std_ext): Supported B extension with v1.0.
(riscv_supported_std_z_ext): Supported Zaamo and Zalrsc with v1.0.
(riscv_multi_subset_supports, riscv_multi_subset_supports_ext): Updated.
include/
* opcode/riscv.h (riscv_insn_class): Removed INSN_CLASS_A, Added
INSN_CLASS_ZAAMO and INSN_CLASS_ZALRSC.
opcodes/
* riscv-opc.c (riscv_opcodes): Splited standard A extension into two
new extensions, Zaamo and Zalrsc.
gas/
* testsuite/gas/riscv/march-imply-a.d: New testcase.
* testsuite/gas/riscv/march-imply-b.d: New testcase.
* testsuite/gas/riscv/attribute-01.d: Updated.
* testsuite/gas/riscv/attribute-02.d: Updated.
* testsuite/gas/riscv/attribute-03.d: Updated.
* testsuite/gas/riscv/attribute-04.d: Updated.
* testsuite/gas/riscv/attribute-05.d: Updated.
* testsuite/gas/riscv/attribute-10.d: Updated.
* testsuite/gas/riscv/mapping-symbols.d: Updated.
* testsuite/gas/riscv/march-imply-g.d: Updated.
* testsuite/gas/riscv/march-imply-unsupported.d: Updated.
* testsuite/gas/riscv/march-ok-reorder.d: Updated.
ld/
* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Updated.
|
|
Different versions of objdump may take different forms of output
for instructions. Use -M no-aliases to avoid the failure of ld
test cases caused by objdump using aliases.
|
|
PR 30783
|
|
Absolute address symbols cannot be used with -shared.
We output more information to the user than just BFD_ASSETR.
|
|
relocated
|
|
The reason behind this patch was noticing that generic ELF targets
fail to remove "bar" in the recently committed ld-elf/undefweak-1
test. (Despite that, those targets pass the test due to it being too
strict when matching symbols. "bar" gets turned into a local weak
defined absolute symbol.)
swap_out_syms currently drops local section syms that are defined in
discarded sections. Extend that to also drop other symbols in
discarded sections too, even global symbols. The linker goes to quite
a lot of effort to ensure globals in discarded section take a
definition from the kept linkonce or comdat group section. So the
global sym change should only affect cases where something is quite
wrong about the set of linkonce or comdat group sections. However
that change to elf_map_symbols meant we dropped _DYNAMIC_LINK /
_DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION
type for some reason. That problem is fixed by reverting the pr14493
change which is no longer needed due to a) BSF_SECTION_SYM_USED on
x86, and b) fixing objcopy to use copy_private_symbol_data.
bfd/
PR 14493
* elf.c (ignore_sym): Rename from ignore_section_sym. Return
true for any symbol without a section or in a discarded section.
Revert pr14493 change.
(elf_map_symbols): Tidy. Use ignore_sym on all symbols.
(swap_out_syms): Tidy.
ld/
* testsuite/ld-elf/undefweak-1.rd: Match any "bar".
|
|
".set" has a different meaning on alpha. Changing it to ".equ" runs
into ".equ" having a different meaning on hppa, and changing it to "="
runs into trouble on bfin.
* testsuite/ld-elf/elf.exp (undefweak-1): xfail on alpha,
don't xfail for genelf.
|
|
Ignore .align at the start of a section may result in misalignment when
partial linking. Manually add -mignore-start-align option without partial
linking.
Gcc -falign-functions add .align 5 to the start of a section, it causes some
error message mismatch. Set these testcases to xfail on LoongArch target.
|
|
Linker will resolve an undefined symbol only if it is referenced by
relocation. Unreferenced weak undefined symbols serve no purpose.
Weak undefined symbols appear in the dynamic symbol table only when they
are referenced by dynamic relocation. Mark symbols with relocation and
strip undefined weak symbols if they don't have relocation and aren't
in the dynamic symbol table.
bfd/
PR ld/31652
* elf-bfd.h (elf_link_hash_entry): Add has_reloc.
* elf-vxworks.c (elf_vxworks_emit_relocs): Set has_reloc.
* elflink.c (_bfd_elf_link_output_relocs): Likewise.
(elf_link_output_extsym): Strip undefined weak symbols if they
don't have relocation and aren't in the dynamic symbol table.
ld/
PR ld/31652
* testsuite/ld-elf/elf.exp: Run undefweak tests.
* testsuite/ld-elf/undefweak-1.rd: New file.
* testsuite/ld-elf/undefweak-1a.s: Likewise.
* testsuite/ld-elf/undefweak-1b.s: Likewise.
* testsuite/ld-x86-64/weakundef-1.nd: Likewise.
* testsuite/ld-x86-64/weakundef-1a.s: Likewise.
* testsuite/ld-x86-64/weakundef-1b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run undefweak tests.
|
|
Also skip the archive if the symbol isn't referenced by a regular object.
bfd/
PR ld/31644
* elflink.c (elf_link_add_archive_symbols): Also skip the archive
if the symbol isn't referenced by a regular object.
ld/
PR ld/31644
* testsuite/ld-plugin/lto.exp: Run PR ld/31644 tests.
* testsuite/ld-plugin/pr31644a.c: New test.
* testsuite/ld-plugin/pr31644b.c: Likewise.
* testsuite/ld-plugin/pr31644c.c: Likewise.
|
|
|
|
|
|
When -fsanitize=address,undefined is used to build, the mmap configure
check failed with
=================================================================
==231796==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239
Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190
SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s).
Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP to avoid the sanitizer
configure check failure.
bfd/
* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
binutils/
* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
ld/
* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
libctf/
* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
libsframe/
* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
|
|
Don't use CC_FOR_TARGET in the bootstrap test, a silly idea aiming at
consistency that made things worse. The objects being linked were
built using $CC, so $CC should be used to link.
* testsuite/ld-bootstrap/bootstrap.exp: Revert last change.
|
|
Move .got .got.plt before .data so .got can be protected with -zrelro.
And the first two entries of .got.plt (_dl_runtime_resolve and link map)
are placed within the relro region.
|
|
The idea here is build tests without sanitizer flags, so they don't
fail due to many not using the compiler to link and thus result in
undefined symbols, since libasan is not supplied. We definitely do not
want a compiler to perform linking in most cases, and it's complicated
to supply libasan (and would possibly disturb testcase output).
* testsuite/config/default.exp (CFLAGS_FOR_TARGET),
(CXXFLAGS_FOR_TARGET): Append NOSANITIZE_CFLAGS.
* testsuite/ld-bootstrap/bootstrap.exp: Use CC_FOR_TARGET and
CFLAGS_FOR_TARGET throughout.
|
|
PR ld/31615
* testsuite/ld-plugin/lto.exp: Run ld/31615 tests.
* testsuite/ld-plugin/pr31615.ver: New file.
* testsuite/ld-plugin/pr31615a.c: Likewise.
* testsuite/ld-plugin/pr31615b.c: Likewise.
* testsuite/ld-plugin/pr31615c.c: Likewise.
* testsuite/ld-plugin/pr31615d.c: Likewise.
|
|
GCC doesn't put builtin function symbol references, which are defined in
the shared C library, in the IR symbol table. When linker rescans shared
objects and archives for newly added symbol references generated from the
IR inputs, it skips definitions of the builtin functions in shared
objects and archives.
Add first_hash to elf_link_hash_table to track unreferenced definitions
defined first in shared objects and archives. Always use them to resolve
any references.
bfd/
PR ld/31482
PR ld/31489
* elf-bfd.h (elf_link_hash_table): Add first_hash.
* elflink.c (elf_link_add_to_first_hash): New function.
(elf_link_add_object_symbols): Initialize first_hash for an IR
input. Always use the first definition in shared object. Add
the first unreferenced dynamic definition to first_hash.
(_bfd_elf_archive_symbol_lookup): Add the first unreferenced
definition to first_hash..
(elf_link_add_archive_symbols): Use the symbol definition in
archive if symbol is defined first in this archive.
(_bfd_elf_link_hash_table_free): Also free first_hash.
ld/
PR ld/31482
PR ld/31489
* testsuite/ld-plugin/lto.exp: Add PR ld/31482 and PR ld/31489
tests.
* testsuite/ld-elf/pr31482a-no-lto.c: New file.
* testsuite/ld-elf/pr31482b-no-lto.c: Likewise.
* testsuite/ld-elf/pr31482c-no-lto.c: Likewise.
* testsuite/ld-elf/pr31482d-no-lto.c: Likewise.
* testsuite/ld-plugin/pass1.out: Likewise.
* testsuite/ld-plugin/pr31482a.c: Likewise.
* testsuite/ld-plugin/pr31482b.c: Likewise.
* testsuite/ld-plugin/pr31482c.c: Likewise.
|
|
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.
|
|
PR 31458
bfd/
* elf-bfd.h (_bfd_elf_link_read_relocs),
(_bfd_elf_link_info_read_relocs): Constify section.
* elflink.c: Likewise.
* elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Read
relocs again in case --no-keep-memory.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Run --no-keep-memory
version of eh-frame3 test.
|
|
This largely mechanical patch is preparation for a followup patch.
For quite some time I've thought that it would be useful to call
elf_backend_size_dynamic_sections even when no dynamic objects are
seen by the linker. That's what this patch does, with some renaming.
There are no functional changes to the linker, just a move of the
dynobj test in bfd_elf_size_dynamic_sections to target backend
functions, replacing the asserts/aborts already there. No doubt some
of the current always_size_sections functions could be moved to
size_dynamic_sections but I haven't made that change.
Because both hooks are now always called, I have renamed
always_size_sections to early_size_sections and size_dynamic_sections
to late_size_sections. I condisdered calling late_size_sections plain
size_sections, since this is the usual target dynamic section sizing
hook, but decided that searching the sources for "size_sections" would
then hit early_size_sections and other functions.
|
|
The PA 2.0 architecture introduced several new load and store
instructions with long displacements. These include floating
point loads and stores for word mode, and integer and floating
point loads and stores for double words. Currently, ld does
not correctly support symbolic relocations for these instructions.
If these are used, ld applies the standard R_PARISC_DPREL14R
relocation and corrupts the instruction. This change uses
bfd_hppa_insn2fmt to determine the correct relocation format.
We need to check the computed displacement as the immediate
value used in these instruction must be a multiple of 4 or 8
depending on whether the access is for a word or double word.
A misaligned offset can potentially occur if the symbol is not
properly aligned or if $global$ (the global pointer) is not
double word aligned. $global$ is provided as a .data section
start symbol. The patch adjusts elf.sc and hppalinux.sh to
align .data to a 8-byte boundary in non-shared and non-pie
links.
2024-04-01 John David Anglin <danglin@gcc.gnu.org>
PR ld/31503
bfd/ChangeLog:
* elf32-hppa.c (final_link_relocate): Output
ld/ChangeLog:
* emulparams/hppalinux.sh (DATA_SECTION_ALIGNMENT): Define.
* scripttempl/elf.sc: Align .data section to DATA_SECTION_ALIGNMENT
when relocating.
|
|
Currently, whether GD and IE generate dynamic relocation is
determined by SYMBOL_REFERENCES_LOCAL and bfd_link_executable.
This results in dynamic relocations still being generated in some
situations where dynamic relocations are not necessary (such as
the undefined weak symbol in static links).
We use RLARCH_TLS_GD_IE_NEED_DYN_RELOC macros to determine whether
GD/IE needs dynamic relocation. If GD/IE requires dynamic relocation,
set need_reloc to true and indx to be a dynamic index.
At the same time, some test cases were modified to use regular
expression matching instead of complete disassembly matching.
|