aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-08-04 15:36:52 +0100
committerThomas Preud'homme <thomas.preudhomme@arm.com>2016-08-04 15:36:52 +0100
commit4ba2ef8fbe74716708e5ce0bcba4f3b1cc8ac99a (patch)
tree1765b4f578102d53c5f142e9bd6473f129327385 /ld/testsuite
parent024425668d120663a73913352df701c8f0aea316 (diff)
downloadgdb-4ba2ef8fbe74716708e5ce0bcba4f3b1cc8ac99a.zip
gdb-4ba2ef8fbe74716708e5ce0bcba4f3b1cc8ac99a.tar.gz
gdb-4ba2ef8fbe74716708e5ce0bcba4f3b1cc8ac99a.tar.bz2
2016-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/ * elf32-arm.c (CMSE_PREFIX): Define macro. (elf32_arm_stub_cmse_branch_thumb_only): Define stub sequence. (cmse_branch_thumb_only): Declare stub. (struct elf32_arm_link_hash_table): Define cmse_stub_sec field. (elf32_arm_get_plt_info): Add globals parameter. Use it to return FALSE if there is no PLT. (arm_type_of_stub): Adapt to new elf32_arm_get_plt_info signature. (elf32_arm_final_link_relocate): Likewise. (elf32_arm_gc_sweep_hook): Likewise. (elf32_arm_gc_mark_extra_sections): Mark sections holding ARMv8-M secure entry functions. (arm_stub_is_thumb): Add case for arm_stub_cmse_branch_thumb_only. (arm_dedicated_stub_output_section_required): Change to a switch case and add a case for arm_stub_cmse_branch_thumb_only. (arm_dedicated_stub_output_section_required_alignment): Likewise. (arm_stub_dedicated_output_section_name): Likewise. (arm_stub_dedicated_input_section_ptr): Likewise and remove ATTRIBUTE_UNUSED for htab parameter. (arm_stub_required_alignment): Likewise. (arm_stub_sym_claimed): Likewise. (arm_dedicated_stub_section_padding): Likewise. (cmse_scan): New function. (elf32_arm_size_stubs): Call cmse_scan for ARM M profile targets. Set stub_changed to TRUE if such veneers were created. (elf32_arm_swap_symbol_in): Add detection code for CMSE special symbols. include/ * arm.h (ARM_GET_SYM_CMSE_SPCL): Define macro. (ARM_SET_SYM_CMSE_SPCL): Likewise. ld/ * ld.texinfo (Placement of SG veneers): New concept entry. * testsuite/ld-arm/arm-elf.exp (Secure gateway veneers: no .gnu.sgstubs section): New test. (Secure gateway veneers: wrong entry functions): Likewise. (Secure gateway veneers (ARMv8-M Baseline)): Likewise. (Secure gateway veneers (ARMv8-M Mainline)): Likewise. * testsuite/ld-arm/cmse-veneers.s: New file. * testsuite/ld-arm/cmse-veneers.d: Likewise. * testsuite/ld-arm/cmse-veneers.rd: Likewise. * testsuite/ld-arm/cmse-veneers.sd: Likewise. * testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out: Likewise. * testsuite/ld-arm/cmse-veneers-wrong-entryfct.out: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp27
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out3
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers-wrong-entryfct.out19
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers.d21
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers.rd9
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers.s97
-rw-r--r--ld/testsuite/ld-arm/cmse-veneers.sd7
7 files changed, 183 insertions, 0 deletions
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index d0c9a2f..b3c8a84 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -642,6 +642,33 @@ set armeabitests_nonacl {
{{objdump -d jump-reloc-veneers-long.d}}
"jump-reloc-veneers-long"}
+ {"Secure gateway veneers: no .gnu.sgstubs section" "" ""
+ "-march=armv8-m.base -mthumb"
+ {cmse-veneers.s}
+ {{ld cmse-veneers-no-gnu_sgstubs.out}}
+ "cmse-veneers-no-gnu_sgstubs"}
+ {"Secure gateway veneers: wrong entry functions" "" ""
+ "-march=armv7-m -mthumb --defsym CHECK_ERRORS=1"
+ {cmse-veneers.s}
+ {{ld cmse-veneers-wrong-entryfct.out}}
+ "cmse-veneers-wrong-entryfct"}
+ {"Secure gateway veneers (ARMv8-M Baseline)"
+ "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections" ""
+ "-march=armv8-m.base -mthumb"
+ {cmse-veneers.s}
+ {{objdump {-d -j .gnu.sgstubs} cmse-veneers.d}
+ {objdump {-h -j .gnu.sgstubs} cmse-veneers.sd}
+ {nm {} cmse-veneers.rd}}
+ "cmse-veneers-baseline"}
+ {"Secure gateway veneers (ARMv8-M Mainline)"
+ "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections" ""
+ "-march=armv8-m.main -mthumb"
+ {cmse-veneers.s}
+ {{objdump {-d -j .gnu.sgstubs} cmse-veneers.d}
+ {objdump {-h -j .gnu.sgstubs} cmse-veneers.sd}
+ {nm {} cmse-veneers.rd}}
+ "cmse-veneers-mainline"}
+
{"R_ARM_THM_JUMP19 Relocation veneers: Short"
"--section-start destsect=0x000108002 --section-start .text=0x8000" ""
"-march=armv7-m -mthumb"
diff --git a/ld/testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out b/ld/testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out
new file mode 100644
index 0000000..9d1e5ba
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out
@@ -0,0 +1,3 @@
+.*: No address assigned to the veneers output section .gnu.sgstubs
+.*: cannot size stub section: Invalid operation
+#...
diff --git a/ld/testsuite/ld-arm/cmse-veneers-wrong-entryfct.out b/ld/testsuite/ld-arm/cmse-veneers-wrong-entryfct.out
new file mode 100644
index 0000000..fd4766a
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers-wrong-entryfct.out
@@ -0,0 +1,19 @@
+.*: .*: Special symbol `__acle_se_loc_entry_veneer1' only allowed for ARMv8-M architecture or later.
+.*: .*: invalid .* symbol `.*loc_entry_veneer1'.
+.*: It must be a global or weak function symbol.
+.*: .*: invalid special symbol `__acle_se_loc_entry_veneer2'.
+.*: It must be a global or weak function symbol.
+.*: .*: invalid special symbol `__acle_se_loc_entry_veneer4'.
+.*: It must be a global or weak function symbol.
+.*: .*: invalid standard symbol `loc_entry_veneer3'.
+.*: It must be a global or weak function symbol.
+.*: .*: invalid standard symbol `loc_entry_veneer5'.
+.*: It must be a global or weak function symbol.
+.*: .*: absent standard symbol `fake_entry_veneer1'.
+.*: .*: invalid standard symbol `obj_entry_veneer1'.
+.*: It must be a global or weak function symbol.
+.*: .*: invalid special symbol `__acle_se_obj_entry_veneer2'.
+.*: It must be a global or weak function symbol.
+.*: .*: `fake_entry_veneer2' and its special symbol are in different sections.
+.*: cannot size stub section: Invalid operation
+#...
diff --git a/ld/testsuite/ld-arm/cmse-veneers.d b/ld/testsuite/ld-arm/cmse-veneers.d
new file mode 100644
index 0000000..6a44a2b
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers.d
@@ -0,0 +1,21 @@
+
+.*
+
+
+Disassembly of section \.gnu.sgstubs:
+
+00020000 <glob_entry_veneer2>:
+ 20000: e97f e97f sg
+ 20004: f7e8 b800 b\.w 8008 <__acle_se_glob_entry_veneer2>
+
+00020008 <weak_entry_veneer2>:
+ 20008: e97f e97f sg
+ 2000c: f7e7 bffe b\.w 800c <__acle_se_weak_entry_veneer2>
+
+00020010 <glob_entry_veneer1>:
+ 20010: e97f e97f sg
+ 20014: f7e7 bff4 b\.w 8000 <__acle_se_glob_entry_veneer1>
+
+00020018 <weak_entry_veneer1>:
+ 20018: e97f e97f sg
+ 2001c: f7e7 bff2 b\.w 8004 <__acle_se_weak_entry_veneer1>
diff --git a/ld/testsuite/ld-arm/cmse-veneers.rd b/ld/testsuite/ld-arm/cmse-veneers.rd
new file mode 100644
index 0000000..20fad96
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers.rd
@@ -0,0 +1,9 @@
+#...
+[0-9a-f]+ T glob_entry_fct
+#...
+[0-9a-f]+ T glob_entry_veneer1
+[0-9a-f]+ T glob_entry_veneer2
+#...
+[0-9a-f]+ W weak_entry_veneer1
+[0-9a-f]+ W weak_entry_veneer2
+#...
diff --git a/ld/testsuite/ld-arm/cmse-veneers.s b/ld/testsuite/ld-arm/cmse-veneers.s
new file mode 100644
index 0000000..d5c57f6
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers.s
@@ -0,0 +1,97 @@
+ .syntax unified
+ .thumb
+ .file "foo.c"
+ .text
+
+.macro decltype name, type
+.ifc \type,object
+ .data
+.else
+ .thumb
+ .thumb_func
+.endif
+ .type \name, %\type
+.endm
+
+
+.macro entry name, type, vis, typespc, visspc, entry_fct
+ .align 2
+.ifb \visspc
+ .\vis __acle_se_\name
+.else
+ .\visspc __acle_se_\name
+.endif
+ .\vis \name
+ .thumb
+ .thumb_func
+.ifb \typespc
+ decltype __acle_se_\name, \type
+.else
+ decltype __acle_se_\name, \typespc
+.endif
+ decltype \name, \type
+__acle_se_\name:
+ \entry_fct
+\name:
+.ifc \type,object
+ .word 42
+.else
+ nop
+.endif
+ .size \name, .-\name
+ .size __acle_se_\name, .-__acle_se_\name
+.endm
+
+
+.ifndef CHECK_ERRORS
+ @ Valid setups for veneer generation
+ entry glob_entry_veneer1, function, global
+ entry weak_entry_veneer1, function, weak
+ entry glob_entry_veneer2, function, global, visspc=weak
+ entry weak_entry_veneer2, function, weak, visspc=global
+
+ @ Valid setup for entry function without SG veneer
+ entry glob_entry_fct, function, global, entry_fct=nop
+
+.else
+ @ Invalid setups for veneer generation (visibility)
+ entry loc_entry_veneer1, function, local
+ entry loc_entry_veneer2, function, global, visspc=local
+ entry loc_entry_veneer3, function, local, visspc=global
+ entry loc_entry_veneer4, function, weak, visspc=local
+ entry loc_entry_veneer5, function, local, visspc=weak
+
+ @ Invalid setups for veneer generation (absent standard symbol)
+ .align 2
+ .global __acle_se_fake_entry_veneer1
+ .thumb
+ .thumb_func
+ .type __acle_se_fake_entry_veneer1, %function
+__acle_se_fake_entry_veneer1:
+ nop
+ .size __acle_se_fake_entry_veneer1, .-__acle_se_fake_entry_veneer1
+
+ @ Invalid setups for veneer generation (type)
+ entry obj_entry_veneer1, object, global, typespc=function
+ entry obj_entry_veneer2, function, global, typespc=object
+
+ @ Invalid setup for veneer generation (sections)
+ .section .text.sub1
+ .align 2
+ .thumb
+ .thumb_func
+ .global __acle_se_fake_entry_veneer2
+ .type __acle_se_fake_entry_veneer2, %function
+__acle_se_fake_entry_veneer2:
+ nop
+ .size __acle_se_fake_entry_veneer2, .-__acle_se_fake_entry_veneer2
+ .section .text.sub2
+ .align 2
+ .thumb
+ .thumb_func
+ .global fake_entry_veneer2
+ .type fake_entry_veneer2, %function
+fake_entry_veneer2:
+ nop
+ .size fake_entry_veneer2, .-fake_entry_veneer2
+.endif
diff --git a/ld/testsuite/ld-arm/cmse-veneers.sd b/ld/testsuite/ld-arm/cmse-veneers.sd
new file mode 100644
index 0000000..99bfc8f
--- /dev/null
+++ b/ld/testsuite/ld-arm/cmse-veneers.sd
@@ -0,0 +1,7 @@
+
+.*
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ \d+ \.gnu\.sgstubs 00000020 00020000 00020000 00010000 2\*\*5
+ CONTENTS, ALLOC, LOAD, READONLY, CODE