2012-08-13 22:52:54 +08:00
|
|
|
# Expect script for various AARCH64 ELF tests.
|
2020-01-01 15:57:01 +08:00
|
|
|
# Copyright (C) 2009-2020 Free Software Foundation, Inc.
|
2012-08-13 22:52:54 +08:00
|
|
|
#
|
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
|
|
|
|
|
|
|
# Exclude non-aarch64-ELF targets.
|
|
|
|
if { ![is_elf_format] || ![istarget "aarch64*-*-*"] } {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# List contains test-items with 3 items followed by 2 lists:
|
2013-02-19 09:10:06 +08:00
|
|
|
# 0:name 1:ld early options 2:ld late options 3:assembler options
|
|
|
|
# 4:filenames of assembler files 5: action and options. 6: name of output file
|
2012-08-13 22:52:54 +08:00
|
|
|
|
|
|
|
# Actions:
|
|
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
|
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
|
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
|
|
|
|
|
|
|
set aarch64elftests {
|
2014-10-24 18:39:35 +08:00
|
|
|
{"Erratum 835769 dump test"
|
|
|
|
"--fix-cortex-a53-835769" "" "" {erratum835769.s}
|
|
|
|
{{objdump -dr erratum835769.d}}
|
|
|
|
"erratum835769"}
|
2019-11-07 08:30:26 +08:00
|
|
|
}
|
|
|
|
set tmp {
|
2014-10-24 18:39:35 +08:00
|
|
|
{"Erratum 835769 dump test -shared"
|
|
|
|
"--fix-cortex-a53-835769 -shared" "" "" {erratum835769.s}
|
|
|
|
{{objdump -dr erratum835769.d}}
|
|
|
|
"erratum835769"}
|
2012-08-13 22:52:54 +08:00
|
|
|
}
|
2019-11-07 08:30:26 +08:00
|
|
|
if [check_shared_lib_support] { append aarch64elftests $tmp }
|
2012-08-13 22:52:54 +08:00
|
|
|
|
2015-06-17 23:36:04 +08:00
|
|
|
proc aarch64_choose_ilp32_emul {} {
|
2016-06-24 09:50:53 +08:00
|
|
|
if [istarget *linux*] then {
|
|
|
|
if [istarget aarch64_be-*] {
|
|
|
|
return "aarch64linux32b"
|
|
|
|
}
|
|
|
|
return "aarch64linux32"
|
|
|
|
}
|
|
|
|
if [istarget aarch64_be-*] {
|
2015-06-17 23:36:04 +08:00
|
|
|
return "aarch64elf32b"
|
|
|
|
}
|
2016-06-24 09:50:53 +08:00
|
|
|
return "aarch64elf32"
|
2015-06-17 23:36:04 +08:00
|
|
|
}
|
|
|
|
|
2016-12-13 20:50:17 +08:00
|
|
|
proc aarch64_choose_lp64_emul {} {
|
|
|
|
if [istarget *linux*] then {
|
|
|
|
if [istarget aarch64_be-*] {
|
|
|
|
return "aarch64linuxb"
|
|
|
|
}
|
|
|
|
return "aarch64linux"
|
|
|
|
}
|
|
|
|
if [istarget aarch64_be-*] {
|
|
|
|
return "aarch64elfb"
|
|
|
|
}
|
|
|
|
return "aarch64elf"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc run_dump_test_lp64 { testname } {
|
|
|
|
run_dump_test $testname \
|
|
|
|
[list [list as "-mabi=lp64"] \
|
|
|
|
[list ld [concat "-m " [aarch64_choose_lp64_emul]]]]
|
|
|
|
}
|
|
|
|
|
|
|
|
set eh-frame-merge-lp64 [list [list "EH Frame merge" \
|
|
|
|
[concat "-m " [aarch64_choose_lp64_emul] \
|
|
|
|
" -Ttext 0x8000"] \
|
|
|
|
"" "-mabi=lp64" {eh-frame-bar.s eh-frame-foo.s} \
|
|
|
|
{{objdump --dwarf=frames eh-frame.d}} \
|
|
|
|
"eh-frame"]]
|
|
|
|
|
2012-08-13 22:52:54 +08:00
|
|
|
run_ld_link_tests $aarch64elftests
|
2016-12-13 20:50:17 +08:00
|
|
|
run_ld_link_tests eh-frame-merge-lp64
|
|
|
|
|
2015-02-24 20:04:41 +08:00
|
|
|
run_dump_test "erratum843419"
|
2018-11-27 20:33:21 +08:00
|
|
|
run_dump_test "erratum843419_tls_ie"
|
2019-05-21 20:04:08 +08:00
|
|
|
run_dump_test "erratum843419-adr"
|
|
|
|
run_dump_test "erratum843419-adrp"
|
|
|
|
run_dump_test "erratum843419-far-adr"
|
|
|
|
run_dump_test "erratum843419-far-full"
|
|
|
|
run_dump_test "erratum843419-full"
|
|
|
|
run_dump_test "erratum843419-no-args"
|
2020-01-02 22:06:01 +08:00
|
|
|
run_dump_test "erratum835769-843419"
|
2012-08-13 22:52:54 +08:00
|
|
|
|
|
|
|
# Relocation Tests
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "weak-undefined"
|
2018-11-29 03:35:04 +08:00
|
|
|
run_dump_test "emit-relocs-22"
|
|
|
|
run_dump_test "emit-relocs-23"
|
2015-06-01 22:45:25 +08:00
|
|
|
run_dump_test "emit-relocs-28"
|
2015-08-12 00:44:30 +08:00
|
|
|
run_dump_test "emit-relocs-86"
|
|
|
|
run_dump_test "emit-relocs-86-overflow"
|
2015-08-19 18:18:25 +08:00
|
|
|
run_dump_test "emit-relocs-87"
|
|
|
|
run_dump_test "emit-relocs-88"
|
|
|
|
run_dump_test "emit-relocs-88-overflow"
|
|
|
|
run_dump_test "emit-relocs-89"
|
|
|
|
run_dump_test "emit-relocs-90"
|
|
|
|
run_dump_test "emit-relocs-90-overflow"
|
2015-08-19 17:58:13 +08:00
|
|
|
run_dump_test "emit-relocs-92"
|
2018-03-29 01:06:05 +08:00
|
|
|
|
|
|
|
run_dump_test "emit-relocs-112"
|
|
|
|
run_dump_test "emit-relocs-112-overflow"
|
|
|
|
run_dump_test "emit-relocs-113"
|
|
|
|
run_dump_test "emit-relocs-114"
|
|
|
|
run_dump_test "emit-relocs-114-overflow"
|
|
|
|
run_dump_test "emit-relocs-115"
|
|
|
|
run_dump_test "emit-relocs-116"
|
|
|
|
run_dump_test "emit-relocs-116-overflow"
|
|
|
|
run_dump_test "emit-relocs-117"
|
|
|
|
run_dump_test "emit-relocs-118"
|
|
|
|
run_dump_test "emit-relocs-118-overflow"
|
|
|
|
run_dump_test "emit-relocs-119"
|
|
|
|
|
|
|
|
run_dump_test "emit-relocs-257"
|
|
|
|
run_dump_test "emit-relocs-257-be"
|
2012-08-13 22:52:54 +08:00
|
|
|
# 258 is tested in 257
|
|
|
|
# 259 is tested in 257
|
2017-12-13 20:11:25 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-258-dyn-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-259-dyn-bad"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-260"
|
|
|
|
run_dump_test_lp64 "emit-relocs-260-be"
|
2012-08-13 22:52:54 +08:00
|
|
|
# 261 is tested by 260
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-262"
|
|
|
|
run_dump_test_lp64 "emit-relocs-263"
|
|
|
|
run_dump_test_lp64 "emit-relocs-264"
|
|
|
|
run_dump_test_lp64 "emit-relocs-264-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-265"
|
|
|
|
run_dump_test_lp64 "emit-relocs-266"
|
|
|
|
run_dump_test_lp64 "emit-relocs-266-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-267"
|
|
|
|
run_dump_test_lp64 "emit-relocs-268"
|
|
|
|
run_dump_test_lp64 "emit-relocs-268-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-269"
|
|
|
|
run_dump_test_lp64 "emit-relocs-269-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-270"
|
|
|
|
run_dump_test_lp64 "emit-relocs-270-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-270-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-271"
|
|
|
|
run_dump_test_lp64 "emit-relocs-271-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-272"
|
|
|
|
run_dump_test_lp64 "emit-relocs-272-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-273"
|
|
|
|
run_dump_test_lp64 "emit-relocs-274"
|
|
|
|
run_dump_test_lp64 "emit-relocs-275"
|
|
|
|
run_dump_test_lp64 "emit-relocs-276"
|
|
|
|
run_dump_test_lp64 "emit-relocs-277"
|
|
|
|
run_dump_test_lp64 "emit-relocs-278"
|
|
|
|
run_dump_test_lp64 "emit-relocs-279"
|
|
|
|
run_dump_test_lp64 "emit-relocs-279-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-280"
|
2012-08-13 22:52:54 +08:00
|
|
|
# 281 is unused
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-282"
|
|
|
|
run_dump_test_lp64 "emit-relocs-283"
|
|
|
|
run_dump_test_lp64 "emit-relocs-284"
|
|
|
|
run_dump_test_lp64 "emit-relocs-285"
|
|
|
|
run_dump_test_lp64 "emit-relocs-286"
|
|
|
|
run_dump_test_lp64 "emit-relocs-286-bad"
|
[LD][AARCH64]Add group relocations to create PC-relative offset.
This is a patch to add linker support for group relocations to create a
16, 32, 48, or 64 bit PC-relative offset inline.
The following relocations are added along with the test cases:
BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G3.
bfd/
2018-01-24 Renlin Li <renlin.li@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for
BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G3.
* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
(_bfd_aarch64_elf_resolve_relocation): Likewise.
ld/
2018-01-24 Renlin Li <renlin.li@arm.com>
* testsuite/ld-aarch64/aarch64-elf.exp: Run new testes.
* testsuite/ld-aarch64/emit-relocs-287.s: Fix test case.
* testsuite/ld-aarch64/emit-relocs-287.d: Fix expected output.
* testsuite/ld-aarch64/emit-relocs-287-overflow.s: New.
* testsuite/ld-aarch64/emit-relocs-287-overflow.d: New.
* testsuite/ld-aarch64/emit-relocs-288.d: New.
* testsuite/ld-aarch64/emit-relocs-288.s: New.
* testsuite/ld-aarch64/emit-relocs-289.d: New.
* testsuite/ld-aarch64/emit-relocs-289.s: New.
* testsuite/ld-aarch64/emit-relocs-289-overflow.s: New.
* testsuite/ld-aarch64/emit-relocs-289-overflow.d: New.
* testsuite/ld-aarch64/emit-relocs-290.d: New.
* testsuite/ld-aarch64/emit-relocs-290.s: New.
* testsuite/ld-aarch64/emit-relocs-291.d: New.
* testsuite/ld-aarch64/emit-relocs-291.s: New.
* testsuite/ld-aarch64/emit-relocs-291-overflow.s: New.
* testsuite/ld-aarch64/emit-relocs-291-overflow.d: New.
* testsuite/ld-aarch64/emit-relocs-292.d: New.
* testsuite/ld-aarch64/emit-relocs-292.s: New.
* testsuite/ld-aarch64/emit-relocs-293.d: New.
* testsuite/ld-aarch64/emit-relocs-293.s: New.
2018-01-18 20:17:55 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-287"
|
|
|
|
run_dump_test_lp64 "emit-relocs-287-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-288"
|
|
|
|
run_dump_test_lp64 "emit-relocs-289"
|
|
|
|
run_dump_test_lp64 "emit-relocs-289-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-290"
|
|
|
|
run_dump_test_lp64 "emit-relocs-291"
|
|
|
|
run_dump_test_lp64 "emit-relocs-291-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-292"
|
|
|
|
run_dump_test_lp64 "emit-relocs-293"
|
|
|
|
# 294-298 are not done yet
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-299"
|
2015-10-02 22:54:40 +08:00
|
|
|
# 300 is not done yet
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-301"
|
|
|
|
run_dump_test_lp64 "emit-relocs-301-be"
|
|
|
|
run_dump_test_lp64 "emit-relocs-302"
|
|
|
|
run_dump_test_lp64 "emit-relocs-302-be"
|
2015-10-02 22:29:41 +08:00
|
|
|
# 303-308 are not done yet
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-309-up"
|
|
|
|
run_dump_test_lp64 "emit-relocs-309-low"
|
|
|
|
run_dump_test_lp64 "emit-relocs-309-up-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-309-low-bad"
|
|
|
|
run_dump_test_lp64 "emit-relocs-310"
|
|
|
|
run_dump_test_lp64 "emit-relocs-310-be"
|
|
|
|
run_dump_test_lp64 "emit-relocs-311"
|
|
|
|
run_dump_test_lp64 "emit-relocs-312"
|
|
|
|
run_dump_test_lp64 "emit-relocs-313"
|
|
|
|
run_dump_test_lp64 "emit-relocs-515"
|
|
|
|
run_dump_test_lp64 "emit-relocs-515-be"
|
|
|
|
run_dump_test_lp64 "emit-relocs-516"
|
|
|
|
run_dump_test_lp64 "emit-relocs-516-be"
|
|
|
|
run_dump_test_lp64 "emit-relocs-523"
|
|
|
|
run_dump_test_lp64 "emit-relocs-524"
|
|
|
|
run_dump_test_lp64 "emit-relocs-525"
|
|
|
|
run_dump_test_lp64 "emit-relocs-526"
|
|
|
|
run_dump_test_lp64 "emit-relocs-526-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-527"
|
|
|
|
run_dump_test_lp64 "emit-relocs-528"
|
|
|
|
run_dump_test_lp64 "emit-relocs-528-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-529"
|
|
|
|
run_dump_test_lp64 "emit-relocs-529-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-530"
|
|
|
|
run_dump_test_lp64 "emit-relocs-531"
|
|
|
|
run_dump_test_lp64 "emit-relocs-531-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-532"
|
|
|
|
run_dump_test_lp64 "emit-relocs-533"
|
|
|
|
run_dump_test_lp64 "emit-relocs-533-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-534"
|
|
|
|
run_dump_test_lp64 "emit-relocs-535"
|
|
|
|
run_dump_test_lp64 "emit-relocs-535-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-536"
|
|
|
|
run_dump_test_lp64 "emit-relocs-537"
|
|
|
|
run_dump_test_lp64 "emit-relocs-537-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-538"
|
2018-03-29 01:06:05 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-552"
|
|
|
|
run_dump_test_lp64 "emit-relocs-552-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-553"
|
|
|
|
run_dump_test_lp64 "emit-relocs-554"
|
|
|
|
run_dump_test_lp64 "emit-relocs-554-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-555"
|
|
|
|
run_dump_test_lp64 "emit-relocs-556"
|
|
|
|
run_dump_test_lp64 "emit-relocs-556-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-557"
|
|
|
|
run_dump_test_lp64 "emit-relocs-558"
|
|
|
|
run_dump_test_lp64 "emit-relocs-558-overflow"
|
|
|
|
run_dump_test_lp64 "emit-relocs-559"
|
2012-08-13 22:52:54 +08:00
|
|
|
|
2016-02-09 17:56:21 +08:00
|
|
|
run_dump_test "reloc-overflow-bad"
|
|
|
|
|
2014-07-08 16:29:06 +08:00
|
|
|
# test addend correctness when --emit-relocs specified for non-relocatable obj.
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "emit-relocs-local-addend"
|
2014-07-08 16:29:06 +08:00
|
|
|
# test addend correctness when -r specified.
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "local-addend-r"
|
2012-08-13 22:52:54 +08:00
|
|
|
|
2015-04-25 05:35:04 +08:00
|
|
|
# test error handling on pcrel relocation for shared libraries.
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "pcrel_pic_undefined"
|
2017-06-16 21:20:38 +08:00
|
|
|
run_dump_test_lp64 "pcrel_pic_defined"
|
2015-04-25 05:35:04 +08:00
|
|
|
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "limit-b"
|
|
|
|
run_dump_test "limit-bl"
|
|
|
|
run_dump_test "farcall-back"
|
2015-08-12 04:55:52 +08:00
|
|
|
run_dump_test "farcall-b-defsym"
|
|
|
|
run_dump_test "farcall-bl-defsym"
|
2015-08-12 04:44:31 +08:00
|
|
|
run_dump_test "farcall-b-gsym"
|
|
|
|
run_dump_test "farcall-b-plt"
|
|
|
|
run_dump_test "farcall-bl-plt"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "farcall-bl"
|
|
|
|
run_dump_test "farcall-b"
|
|
|
|
run_dump_test "farcall-b-none-function"
|
|
|
|
run_dump_test "farcall-bl-none-function"
|
2016-01-21 00:57:59 +08:00
|
|
|
run_dump_test "farcall-b-section"
|
|
|
|
run_dump_test "farcall-bl-section"
|
2012-08-13 22:52:54 +08:00
|
|
|
|
|
|
|
run_dump_test "tls-relax-all"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-all-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-gd-le"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-gd-le-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-le"
|
2019-04-11 18:27:28 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-le-now"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-le-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-gd-ie"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-gd-ie-ilp32"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "tls-relax-large-gd-ie"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-gd-ie-be"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-gd-le"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-gd-le-be"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-desc-ie"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-desc-ie-be"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-desc-le"
|
|
|
|
run_dump_test_lp64 "tls-relax-large-desc-le-be"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-ie"
|
|
|
|
run_dump_test "tls-relax-ie-le"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-ie-le-ilp32"
|
2015-09-09 21:19:28 +08:00
|
|
|
run_dump_test "tls-relax-ld-le-small"
|
ld: aarch64: fix TLS relaxation where TCB_SIZE is used
TCB_SIZE is 2*sizeof(void *), which is 0x10 for lp64, and 0x8 for
ilp32. During relaxation, ld goes to do a replace:
bl __tls_get_addr => add R0, R0, TCB_SIZE
But actual implementation is:
bfd_putl32 (0x91004000, contents + rel->r_offset + 4);
Which is equivalent of add x0, x0, 0x10. This is wrong for ilp32.
The possible fix for it is:
bfd_putl32 (0x91000000 | (TCB_SIZE<<10), contents + rel->r_offset + 4);
But ilp32 also needs w-registers, so it's simpler to put proper
instruction in #if/#else condition.
There are 2 such relaxations in elfNN_aarch64_tls_relax(), and so 2 new
tests added for ilp32 mode to test it.
Yury
* bfd/elfnn-aarch64.c: fix TLS relaxations for ilp32 where
TCB_SIZE is used.
* ld/testsuite/ld-aarch64/aarch64-elf.exp: Add tests for the case.
* ld/testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: New file.
* ld/testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: New file.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
2016-12-03 21:20:43 +08:00
|
|
|
run_dump_test "tls-relax-ld-le-small-ilp32"
|
2015-09-09 21:19:28 +08:00
|
|
|
run_dump_test "tls-relax-ld-le-tiny"
|
ld: aarch64: fix TLS relaxation where TCB_SIZE is used
TCB_SIZE is 2*sizeof(void *), which is 0x10 for lp64, and 0x8 for
ilp32. During relaxation, ld goes to do a replace:
bl __tls_get_addr => add R0, R0, TCB_SIZE
But actual implementation is:
bfd_putl32 (0x91004000, contents + rel->r_offset + 4);
Which is equivalent of add x0, x0, 0x10. This is wrong for ilp32.
The possible fix for it is:
bfd_putl32 (0x91000000 | (TCB_SIZE<<10), contents + rel->r_offset + 4);
But ilp32 also needs w-registers, so it's simpler to put proper
instruction in #if/#else condition.
There are 2 such relaxations in elfNN_aarch64_tls_relax(), and so 2 new
tests added for ilp32 mode to test it.
Yury
* bfd/elfnn-aarch64.c: fix TLS relaxations for ilp32 where
TCB_SIZE is used.
* ld/testsuite/ld-aarch64/aarch64-elf.exp: Add tests for the case.
* ld/testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: New file.
* ld/testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: New file.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
2016-12-03 21:20:43 +08:00
|
|
|
run_dump_test "tls-relax-ld-le-tiny-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-desc-ie"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-desc-ie-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-ie-2"
|
|
|
|
run_dump_test "tls-relax-gdesc-le-2"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-gdesc-le-2-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-ie-le-2"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-ie-le-2-ilp32"
|
2012-08-13 22:52:54 +08:00
|
|
|
run_dump_test "tls-relax-ie-le-3"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-relax-ie-le-3-ilp32"
|
2015-02-19 17:10:11 +08:00
|
|
|
run_dump_test "tls-tiny-gd"
|
|
|
|
run_dump_test "tls-tiny-gd-ie"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-tiny-gd-ie-ilp32"
|
2015-02-19 17:10:11 +08:00
|
|
|
run_dump_test "tls-tiny-gd-le"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-tiny-gd-le-ilp32"
|
2015-02-19 17:52:24 +08:00
|
|
|
run_dump_test "tls-tiny-desc"
|
|
|
|
run_dump_test "tls-tiny-desc-ie"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-tiny-desc-ie-ilp32"
|
2015-02-19 17:52:24 +08:00
|
|
|
run_dump_test "tls-tiny-desc-le"
|
2017-01-24 01:07:13 +08:00
|
|
|
run_dump_test "tls-tiny-desc-le-ilp32"
|
2015-02-19 02:10:59 +08:00
|
|
|
run_dump_test "tls-tiny-ie"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "tls-large-ie"
|
|
|
|
run_dump_test_lp64 "tls-large-ie-be"
|
|
|
|
run_dump_test_lp64 "tls-large-desc"
|
|
|
|
run_dump_test_lp64 "tls-large-desc-be"
|
2015-07-16 22:46:21 +08:00
|
|
|
run_dump_test "tls-tiny-ld"
|
2015-08-12 00:05:34 +08:00
|
|
|
run_dump_test "tls-small-ld"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "tlsle"
|
2012-10-17 00:36:50 +08:00
|
|
|
run_dump_test "tlsle-symbol-offset"
|
2013-04-03 22:21:18 +08:00
|
|
|
run_dump_test "gc-got-relocs"
|
|
|
|
run_dump_test "gc-tls-relocs"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "gc-plt-relocs"
|
|
|
|
run_dump_test_lp64 "gc-relocs-257-dyn"
|
|
|
|
run_dump_test_lp64 "gc-relocs-257"
|
2016-03-07 23:40:50 +08:00
|
|
|
run_dump_test "implicit_got_section_1"
|
2015-01-13 19:18:10 +08:00
|
|
|
run_dump_test "pr17415"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "tprel_g2_overflow"
|
2015-06-01 17:31:38 +08:00
|
|
|
run_dump_test "tprel_add_lo12_overflow"
|
2015-07-27 18:48:48 +08:00
|
|
|
run_dump_test "protected-data"
|
2018-02-03 21:18:17 +08:00
|
|
|
run_dump_test_lp64 "pr22764"
|
2018-03-07 17:27:45 +08:00
|
|
|
run_dump_test_lp64 "pr20402"
|
2013-10-03 22:46:09 +08:00
|
|
|
|
|
|
|
# ifunc tests
|
|
|
|
run_dump_test "ifunc-1"
|
|
|
|
run_dump_test "ifunc-1-local"
|
|
|
|
run_dump_test "ifunc-2"
|
|
|
|
run_dump_test "ifunc-2-local"
|
|
|
|
run_dump_test "ifunc-3a"
|
|
|
|
run_dump_test "ifunc-3b"
|
|
|
|
run_dump_test "ifunc-4"
|
|
|
|
run_dump_test "ifunc-4a"
|
|
|
|
run_dump_test "ifunc-5a"
|
|
|
|
run_dump_test "ifunc-5b"
|
|
|
|
run_dump_test "ifunc-5a-local"
|
|
|
|
run_dump_test "ifunc-5b-local"
|
|
|
|
run_dump_test "ifunc-5r-local"
|
|
|
|
run_dump_test "ifunc-6a"
|
|
|
|
run_dump_test "ifunc-6b"
|
|
|
|
run_dump_test "ifunc-7a"
|
|
|
|
run_dump_test "ifunc-7b"
|
|
|
|
run_dump_test "ifunc-7c"
|
|
|
|
run_dump_test "ifunc-8"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "ifunc-9"
|
|
|
|
run_dump_test_lp64 "ifunc-10"
|
|
|
|
run_dump_test_lp64 "ifunc-11"
|
|
|
|
run_dump_test_lp64 "ifunc-12"
|
|
|
|
run_dump_test_lp64 "ifunc-13"
|
2013-10-03 22:46:09 +08:00
|
|
|
run_dump_test "ifunc-14a"
|
|
|
|
run_dump_test "ifunc-14b"
|
|
|
|
run_dump_test "ifunc-14c"
|
|
|
|
run_dump_test "ifunc-14d"
|
|
|
|
run_dump_test "ifunc-14e"
|
|
|
|
run_dump_test "ifunc-14f"
|
|
|
|
run_dump_test "ifunc-15"
|
|
|
|
run_dump_test "ifunc-16"
|
|
|
|
run_dump_test "ifunc-17a"
|
|
|
|
run_dump_test "ifunc-17b"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "ifunc-18a"
|
|
|
|
run_dump_test_lp64 "ifunc-18b"
|
|
|
|
run_dump_test_lp64 "ifunc-19a"
|
|
|
|
run_dump_test_lp64 "ifunc-19b"
|
|
|
|
run_dump_test_lp64 "ifunc-20"
|
|
|
|
run_dump_test_lp64 "ifunc-21"
|
|
|
|
run_dump_test_lp64 "ifunc-22"
|
2014-03-14 19:45:32 +08:00
|
|
|
|
|
|
|
run_dump_test "relasz"
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "relocs-1027-symbolic-func"
|
2014-08-26 22:48:47 +08:00
|
|
|
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "dt_textrel"
|
2015-06-23 19:12:06 +08:00
|
|
|
|
2015-10-01 21:12:37 +08:00
|
|
|
run_dump_test "plt_mapping_symbol"
|
|
|
|
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "rela-abs-relative"
|
|
|
|
run_dump_test_lp64 "rela-abs-relative-be"
|
|
|
|
run_dump_test_lp64 "rela-abs-relative-opt"
|
2016-05-03 18:59:37 +08:00
|
|
|
|
2016-12-13 20:50:17 +08:00
|
|
|
run_dump_test_lp64 "pie-bind-locally"
|
2016-11-10 17:25:17 +08:00
|
|
|
|
2019-03-13 18:42:27 +08:00
|
|
|
run_dump_test "property-bti-pac1"
|
|
|
|
run_dump_test "property-bti-pac2"
|
|
|
|
run_dump_test "property-bti-pac3"
|
2019-06-06 19:27:41 +08:00
|
|
|
run_dump_test "property-bti-pac4-a"
|
|
|
|
run_dump_test "property-bti-pac4-b"
|
[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs
This is part of the patch series to add support for BTI and
PAC in AArch64 linker.
1) This patch adds a new ld command line option: --force-bti.
In the presence of this option, the linker enables BTI with the
GNU_PROPERTY_AARCH64_FEATURE_1_BTI feature. This gives out warning
in case of missing gnu notes for BTI in inputs.
2) It also defines a new set of BTI enabled PLTs. These are used either
when all the inputs are marked with GNU_PROPERTY_AARCH64_FEATURE_1_BTI
or when the new --force-bti option is used. This required adding new
fields in elf_aarch64_link_hash_table so that we could make the PLT
related information more generic.
3) It also defines a dynamic tag DT_AARCH64_BTI_PLT. The linker uses
this whenever it picks BTI enabled PLTs.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4
*** bfd/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
(aarch64_bti_pac_info): New.
(bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
(bfd_elf32_aarch64_set_options): Likewise.
* bfd-in2.h: Regenerate
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
(elfNN_aarch64_small_plt0_bti_entry): New.
(elfNN_aarch64_small_plt_bti_entry): New.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
(elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
(elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
tlsdesc_plt_entry_size fields.
(elfNN_aarch64_link_hash_table_create): Initialise the new fields.
(setup_plt_values): New helper function.
(bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
bti enable type.
(elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
fixed macros.
(elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
(elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
to plt stubs instead of fixed ones and update filling them according
to the need for bti.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
(elfNN_aarch64_plt_sym_val): Update size accordingly.
(elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
is set.
(bfd_elfNN_get_synthetic_symtab): Define.
(elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
and mising BTI NOTE SECTION.
*** binutils/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* readelf.c (get_aarch64_dynamic_type): New.
(get_dynamic_type): Use above for EM_AARCH64.
(dynamic_section_aarch64_val): New.
(process_dynamic_section): Use above for EM_AARCH64.
*** include/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* elf/aarch64.h (DT_AARCH64_BTI_PLT): New.
*** ld/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* NEWS: Document --force-bti.
* emultempl/aarch64elf.em (plt_type, bti_type, OPTION_FORCE_BTI): New.
(PARSE_AND_LIST_SHORTOPTS, PARSE_AND_LIST_OPTIONS): Add force-bti.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FORCE_BTI.
* testsuite/ld-aarch64/aarch64-elf.exp: Add all the tests below.
* testsuite/ld-aarch64/bti-plt-1.d: New test.
* testsuite/ld-aarch64/bti-plt-1.s: New test.
* testsuite/ld-aarch64/bti-plt-2.s: New test.
* testsuite/ld-aarch64/bti-plt-2.d: New test.
* testsuite/ld-aarch64/bti-plt-3.d: New test.
* testsuite/ld-aarch64/bti-plt-4.d: New test.
* testsuite/ld-aarch64/bti-plt-5.d: New test.
* testsuite/ld-aarch64/bti-plt-6.d: New test.
* testsuite/ld-aarch64/bti-plt-7.d: New test.
* testsuite/ld-aarch64/bti-plt-so.s: New test.
* testsuite/ld-aarch64/bti-plt.ld: New test.
2019-03-13 18:54:30 +08:00
|
|
|
run_dump_test "bti-plt-1"
|
|
|
|
run_dump_test "bti-plt-2"
|
2019-03-13 18:42:27 +08:00
|
|
|
|
2019-04-25 22:07:14 +08:00
|
|
|
run_dump_test_lp64 "variant_pcs-r"
|
|
|
|
run_dump_test_lp64 "variant_pcs-shared"
|
|
|
|
run_dump_test_lp64 "variant_pcs-now"
|
|
|
|
|
2014-08-26 22:48:47 +08:00
|
|
|
set aarch64elflinktests {
|
|
|
|
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
|
2016-02-09 17:56:21 +08:00
|
|
|
{} "copy-reloc-so.so"}
|
2014-08-26 22:48:47 +08:00
|
|
|
{"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
|
2016-02-09 17:56:21 +08:00
|
|
|
{copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
|
2017-06-15 23:51:01 +08:00
|
|
|
{"ld-aarch64/exe with copy relocation 2" "-e0 tmpdir/copy-reloc-so.so" "" ""
|
|
|
|
{copy-reloc-exe-2.s} {{objdump -R copy-reloc-2.d}} "copy-reloc-2"}
|
|
|
|
{"ld-aarch64/exe with copy relocation elimination" "-e0 tmpdir/copy-reloc-so.so" "" ""
|
|
|
|
{copy-reloc-exe-eliminate.s} {{objdump -R copy-reloc-eliminate.d}} "copy-reloc-elimination"}
|
2017-01-20 21:30:32 +08:00
|
|
|
{"ld-aarch64/so with global func" "-shared" "" "" {func-in-so.s}
|
|
|
|
{} "func-in-so.so"}
|
|
|
|
{"ld-aarch64/func sym hash opt for exe"
|
|
|
|
"-e0 --hash-style=gnu tmpdir/func-in-so.so" "" ""
|
|
|
|
{func-sym-hash-opt.s} {{readelf --dyn-sym func-sym-hash-opt.d}} "hash-opt"}
|
[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs
This is part of the patch series to add support for BTI and
PAC in AArch64 linker.
1) This patch adds a new ld command line option: --force-bti.
In the presence of this option, the linker enables BTI with the
GNU_PROPERTY_AARCH64_FEATURE_1_BTI feature. This gives out warning
in case of missing gnu notes for BTI in inputs.
2) It also defines a new set of BTI enabled PLTs. These are used either
when all the inputs are marked with GNU_PROPERTY_AARCH64_FEATURE_1_BTI
or when the new --force-bti option is used. This required adding new
fields in elf_aarch64_link_hash_table so that we could make the PLT
related information more generic.
3) It also defines a dynamic tag DT_AARCH64_BTI_PLT. The linker uses
this whenever it picks BTI enabled PLTs.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4
*** bfd/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
(aarch64_bti_pac_info): New.
(bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
(bfd_elf32_aarch64_set_options): Likewise.
* bfd-in2.h: Regenerate
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
(elfNN_aarch64_small_plt0_bti_entry): New.
(elfNN_aarch64_small_plt_bti_entry): New.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
(elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
(elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
tlsdesc_plt_entry_size fields.
(elfNN_aarch64_link_hash_table_create): Initialise the new fields.
(setup_plt_values): New helper function.
(bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
bti enable type.
(elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
fixed macros.
(elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
(elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
to plt stubs instead of fixed ones and update filling them according
to the need for bti.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
(elfNN_aarch64_plt_sym_val): Update size accordingly.
(elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
is set.
(bfd_elfNN_get_synthetic_symtab): Define.
(elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
and mising BTI NOTE SECTION.
*** binutils/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* readelf.c (get_aarch64_dynamic_type): New.
(get_dynamic_type): Use above for EM_AARCH64.
(dynamic_section_aarch64_val): New.
(process_dynamic_section): Use above for EM_AARCH64.
*** include/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* elf/aarch64.h (DT_AARCH64_BTI_PLT): New.
*** ld/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* NEWS: Document --force-bti.
* emultempl/aarch64elf.em (plt_type, bti_type, OPTION_FORCE_BTI): New.
(PARSE_AND_LIST_SHORTOPTS, PARSE_AND_LIST_OPTIONS): Add force-bti.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FORCE_BTI.
* testsuite/ld-aarch64/aarch64-elf.exp: Add all the tests below.
* testsuite/ld-aarch64/bti-plt-1.d: New test.
* testsuite/ld-aarch64/bti-plt-1.s: New test.
* testsuite/ld-aarch64/bti-plt-2.s: New test.
* testsuite/ld-aarch64/bti-plt-2.d: New test.
* testsuite/ld-aarch64/bti-plt-3.d: New test.
* testsuite/ld-aarch64/bti-plt-4.d: New test.
* testsuite/ld-aarch64/bti-plt-5.d: New test.
* testsuite/ld-aarch64/bti-plt-6.d: New test.
* testsuite/ld-aarch64/bti-plt-7.d: New test.
* testsuite/ld-aarch64/bti-plt-so.s: New test.
* testsuite/ld-aarch64/bti-plt.ld: New test.
2019-03-13 18:54:30 +08:00
|
|
|
{"Build bti-plt-so for PLT tests" "-shared" "" "" {bti-plt-so.s}
|
|
|
|
{} "libbti-plt-so.so"}
|
2014-08-26 22:48:47 +08:00
|
|
|
}
|
|
|
|
|
2019-11-07 08:30:26 +08:00
|
|
|
if [check_shared_lib_support] {
|
|
|
|
run_ld_link_tests $aarch64elflinktests
|
|
|
|
}
|
[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs
This is part of the patch series to add support for BTI and
PAC in AArch64 linker.
1) This patch adds a new ld command line option: --force-bti.
In the presence of this option, the linker enables BTI with the
GNU_PROPERTY_AARCH64_FEATURE_1_BTI feature. This gives out warning
in case of missing gnu notes for BTI in inputs.
2) It also defines a new set of BTI enabled PLTs. These are used either
when all the inputs are marked with GNU_PROPERTY_AARCH64_FEATURE_1_BTI
or when the new --force-bti option is used. This required adding new
fields in elf_aarch64_link_hash_table so that we could make the PLT
related information more generic.
3) It also defines a dynamic tag DT_AARCH64_BTI_PLT. The linker uses
this whenever it picks BTI enabled PLTs.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4
*** bfd/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
(aarch64_bti_pac_info): New.
(bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
(bfd_elf32_aarch64_set_options): Likewise.
* bfd-in2.h: Regenerate
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
(elfNN_aarch64_small_plt0_bti_entry): New.
(elfNN_aarch64_small_plt_bti_entry): New.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
(elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
(elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
tlsdesc_plt_entry_size fields.
(elfNN_aarch64_link_hash_table_create): Initialise the new fields.
(setup_plt_values): New helper function.
(bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
bti enable type.
(elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
fixed macros.
(elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
(elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
to plt stubs instead of fixed ones and update filling them according
to the need for bti.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
(elfNN_aarch64_plt_sym_val): Update size accordingly.
(elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
is set.
(bfd_elfNN_get_synthetic_symtab): Define.
(elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
and mising BTI NOTE SECTION.
*** binutils/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* readelf.c (get_aarch64_dynamic_type): New.
(get_dynamic_type): Use above for EM_AARCH64.
(dynamic_section_aarch64_val): New.
(process_dynamic_section): Use above for EM_AARCH64.
*** include/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* elf/aarch64.h (DT_AARCH64_BTI_PLT): New.
*** ld/ChangeLog ***
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* NEWS: Document --force-bti.
* emultempl/aarch64elf.em (plt_type, bti_type, OPTION_FORCE_BTI): New.
(PARSE_AND_LIST_SHORTOPTS, PARSE_AND_LIST_OPTIONS): Add force-bti.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FORCE_BTI.
* testsuite/ld-aarch64/aarch64-elf.exp: Add all the tests below.
* testsuite/ld-aarch64/bti-plt-1.d: New test.
* testsuite/ld-aarch64/bti-plt-1.s: New test.
* testsuite/ld-aarch64/bti-plt-2.s: New test.
* testsuite/ld-aarch64/bti-plt-2.d: New test.
* testsuite/ld-aarch64/bti-plt-3.d: New test.
* testsuite/ld-aarch64/bti-plt-4.d: New test.
* testsuite/ld-aarch64/bti-plt-5.d: New test.
* testsuite/ld-aarch64/bti-plt-6.d: New test.
* testsuite/ld-aarch64/bti-plt-7.d: New test.
* testsuite/ld-aarch64/bti-plt-so.s: New test.
* testsuite/ld-aarch64/bti-plt.ld: New test.
2019-03-13 18:54:30 +08:00
|
|
|
|
|
|
|
run_dump_test "bti-plt-3"
|
|
|
|
run_dump_test "bti-plt-4"
|
|
|
|
run_dump_test "bti-plt-5"
|
|
|
|
run_dump_test "bti-plt-6"
|
|
|
|
run_dump_test "bti-plt-7"
|
2019-03-13 19:09:10 +08:00
|
|
|
|
|
|
|
run_dump_test "pac-plt-1"
|
|
|
|
run_dump_test "pac-plt-2"
|
|
|
|
run_dump_test "bti-pac-plt-1"
|
|
|
|
run_dump_test "bti-pac-plt-2"
|
2019-03-22 00:20:21 +08:00
|
|
|
|
|
|
|
run_dump_test "bti-warn"
|
2019-08-22 18:35:35 +08:00
|
|
|
run_dump_test "weak-tls"
|
|
|
|
run_dump_test "undef-tls"
|