mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-09 23:32:21 +08:00
bfd/
* elfxx-mips.c (GGA_NORMAL, GGA_RELOC_ONLY, GGA_NONE): New macros. (mips_elf_link_hash_entry): Add a "global_got_area" field. (mips_elf_link_hash_newfunc): Initialize it. (mips_elf_sort_hash_table_f): Use h->global_got_area instead of h->root.got.offset. Do not handle forced_local symbols specially. (mips_elf_record_global_got_symbol): Set h->global_got_area instead of h->root.got.offset. (mips_elf_recreate_got): Assert that h->global_got_area == GGA_NONE for indirect and warning symbols. (mips_elf_count_forced_local_got_symbols): Change the argument from a "elf_link_hash_entry" to "mips_elf_link_hash_entry". Use and set h->global_got_area instead of h->root.got.offset. Set it to GGA_NONE for all forced-local symbols. (mips_elf_set_global_got_offset): Set h->global_got_area instead of h->root.got.offset. Use g->global_got_area instead of a combination of dynindx, forced_local and tls_type. (mips_elf_multi_got): Remove disabled code. Pass GGA_* values to mips_elf_set_global_got_offset. (mips_elf_lay_out_got): Use mips_elf_link_hash_traverse instead of elf_link_hash_traverse. (_bfd_mips_elf_copy_indirect_symbol): Copy the indirect symbol's global_got_area to the direct symbol if the latter's value is higher. Set the indirect symbol's area to GGA_NONE. ld/testsuite/ * ld-mips-elf/got-vers-1a.s, ld-mips-elf/got-vers-1b.s, ld-mips-elf/got-vers-1.ver, ld-mips-elf/got-vers-1.dd, ld-mips-elf/got-vers-1.sd, ld-mips-elf/got-vers-1.rd: New tests. * ld-mips-elf/mips-elf.exp: Run them.
This commit is contained in:
6
ld/testsuite/ld-mips-elf/got-vers-1.dd
Normal file
6
ld/testsuite/ld-mips-elf/got-vers-1.dd
Normal file
@ -0,0 +1,6 @@
|
||||
# There must be one global GOT symbol. Its index doesn't matter.
|
||||
#...
|
||||
0x70000011 \(MIPS_SYMTABNO\) * 4
|
||||
#...
|
||||
0x70000013 \(MIPS_GOTSYM\) * 0x3
|
||||
#pass
|
6
ld/testsuite/ld-mips-elf/got-vers-1.rd
Normal file
6
ld/testsuite/ld-mips-elf/got-vers-1.rd
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
Relocation section '\.rel\.dyn' at offset .* contains 2 entries:
|
||||
*Offset * Info * Type * Sym\.Value * Sym\. Name
|
||||
00000000 * 00000000 * R_MIPS_NONE *
|
||||
# This index must be the same as DT_MIPS_GOTsYM.
|
||||
[^ ]+ * 00000303 * R_MIPS_REL32 * [^ ]+ * foo
|
6
ld/testsuite/ld-mips-elf/got-vers-1.sd
Normal file
6
ld/testsuite/ld-mips-elf/got-vers-1.sd
Normal file
@ -0,0 +1,6 @@
|
||||
# foo@@V2 must have index DT_MIPS_GOTSYM
|
||||
#...
|
||||
*3: .* 4 * OBJECT * GLOBAL * DEFAULT * [0-9]+ * foo@@V2
|
||||
|
||||
Symbol table '\.symtab' contains .*:
|
||||
#pass
|
1
ld/testsuite/ld-mips-elf/got-vers-1.ver
Normal file
1
ld/testsuite/ld-mips-elf/got-vers-1.ver
Normal file
@ -0,0 +1 @@
|
||||
V2 { global: foo; local: *; };
|
2
ld/testsuite/ld-mips-elf/got-vers-1a.s
Normal file
2
ld/testsuite/ld-mips-elf/got-vers-1a.s
Normal file
@ -0,0 +1,2 @@
|
||||
.abicalls
|
||||
.word foo
|
7
ld/testsuite/ld-mips-elf/got-vers-1b.s
Normal file
7
ld/testsuite/ld-mips-elf/got-vers-1b.s
Normal file
@ -0,0 +1,7 @@
|
||||
.abicalls
|
||||
.symver foo2,foo@@V2
|
||||
.global foo2
|
||||
.data
|
||||
.type foo2,%object
|
||||
.size foo2,4
|
||||
foo2: .word 0
|
@ -363,3 +363,15 @@ run_dump_test "attr-gnu-4-43"
|
||||
run_dump_test "attr-gnu-4-44"
|
||||
run_dump_test "attr-gnu-4-45"
|
||||
run_dump_test "attr-gnu-4-51"
|
||||
|
||||
if { $linux_gnu } {
|
||||
run_ld_link_tests {
|
||||
{"GOT and versioning 1"
|
||||
"-shared -melf32btsmip --version-script got-vers-1.ver"
|
||||
"-EB -mips2 -32" {got-vers-1a.s got-vers-1b.s}
|
||||
{{readelf -d got-vers-1.dd}
|
||||
{readelf --symbols got-vers-1.sd}
|
||||
{readelf --relocs got-vers-1.rd}}
|
||||
"got-vers-1.so"}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user