From 54ddd295b505efe4b07cc1e939d4e150032603d8 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 4 Aug 2016 15:54:57 +0100 Subject: 2016-08-04 Thomas Preud'homme bfd/ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add one parameter. * bfd-in2.h: Regenerate. * elf32-arm.c (struct elf32_arm_link_hash_table): Declare new cmse_implib field. (bfd_elf32_arm_set_target_relocs): Add new parameter to initialize cmse_implib field in struct elf32_arm_link_hash_table. (elf32_arm_filter_cmse_symbols): New function. (elf32_arm_filter_implib_symbols): Likewise. (elf_backend_filter_implib_symbols): Define to elf32_arm_filter_implib_symbols. ld/ * emultempl/armelf.em (cmse_implib): Declare and define this new static variable. (arm_elf_create_output_section_statements): Add new cmse_implib parameter. (OPTION_CMSE_IMPLIB): Define macro. (PARSE_AND_LIST_LONGOPTS): Add entry for new --cmse-implib switch. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_CMSE_IMPLIB case. * ld.texinfo (--cmse-implib): Document new option. * testsuite/ld-arm/arm-elf.exp (Secure gateway import library generation): New test. (Secure gateway import library generation: errors): Likewise. * testsuite/ld-arm/cmse-implib.s: New file. * testsuite/ld-arm/cmse-implib-errors.out: Likewise. * testsuite/ld-arm/cmse-implib.rd: Likewise. --- ld/testsuite/ld-arm/arm-elf.exp | 12 +++++++ ld/testsuite/ld-arm/cmse-implib-errors.out | 7 ++++ ld/testsuite/ld-arm/cmse-implib.rd | 13 +++++++ ld/testsuite/ld-arm/cmse-implib.s | 58 ++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 ld/testsuite/ld-arm/cmse-implib-errors.out create mode 100644 ld/testsuite/ld-arm/cmse-implib.rd create mode 100644 ld/testsuite/ld-arm/cmse-implib.s (limited to 'ld/testsuite/ld-arm') diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index b3c8a84..5524085 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -668,6 +668,18 @@ set armeabitests_nonacl { {objdump {-h -j .gnu.sgstubs} cmse-veneers.sd} {nm {} cmse-veneers.rd}} "cmse-veneers-mainline"} + {"Secure gateway import library generation: errors" + "--section-start .gnu.sgstubs=0x20000 --out-implib=tmpdir/cmse-implib.lib --cmse-implib" "" + "-march=armv8-m.base -mthumb --defsym CHECK_ERRORS=1" + {cmse-implib.s} + {{ld cmse-implib-errors.out}} + "cmse-implib"} + {"Secure gateway import library generation" + "--section-start .gnu.sgstubs=0x20000 --out-implib=tmpdir/cmse-implib.lib --cmse-implib" "" + "-march=armv8-m.base -mthumb" + {cmse-implib.s} + {{readelf {-s tmpdir/cmse-implib.lib} cmse-implib.rd}} + "cmse-implib"} {"R_ARM_THM_JUMP19 Relocation veneers: Short" "--section-start destsect=0x000108002 --section-start .text=0x8000" "" diff --git a/ld/testsuite/ld-arm/cmse-implib-errors.out b/ld/testsuite/ld-arm/cmse-implib-errors.out new file mode 100644 index 0000000..0026f6b --- /dev/null +++ b/ld/testsuite/ld-arm/cmse-implib-errors.out @@ -0,0 +1,7 @@ +.*: .*: absent standard symbol `not_exported_fct2'. +.*: .*: invalid special symbol `__acle_se_not_exported_pseudoentry_var'. +.*: It must be a global or weak function symbol. +.*: .*: invalid standard symbol `not_exported_pseudoentry_var'. +.*: It must be a global or weak function symbol. +.* cannot size stub section: Invalid operation +#... diff --git a/ld/testsuite/ld-arm/cmse-implib.rd b/ld/testsuite/ld-arm/cmse-implib.rd new file mode 100644 index 0000000..c5f7aef --- /dev/null +++ b/ld/testsuite/ld-arm/cmse-implib.rd @@ -0,0 +1,13 @@ +File: tmpdir/cmse-implib.lib + +Symbol table '.symtab' contains 5 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 00000000 0 NOTYPE LOCAL DEFAULT UND + 1: 00020001 8 FUNC GLOBAL DEFAULT ABS exported_entry_veneer3 + 2: [0-9a-f]+ 6 FUNC GLOBAL DEFAULT ABS exported_entry_fct1 + 3: 00020009 8 FUNC GLOBAL DEFAULT ABS exported_entry_veneer2 + 4: [0-9a-f]+ 6 FUNC GLOBAL DEFAULT ABS exported_entry_fct2 + +File: tmpdir/cmse-implib + +#... diff --git a/ld/testsuite/ld-arm/cmse-implib.s b/ld/testsuite/ld-arm/cmse-implib.s new file mode 100644 index 0000000..a42da63 --- /dev/null +++ b/ld/testsuite/ld-arm/cmse-implib.s @@ -0,0 +1,58 @@ + .syntax unified + .text + +.macro entry name, vis, entry_fct + .align 2 + .\vis \name + .\vis __acle_se_\name + .thumb + .thumb_func + .type \name, %function + .type __acle_se_\name, %function +\name: +.ifnb \entry_fct + \entry_fct +.endif +__acle_se_\name: + nop + .size \name, .-\name + .size __acle_se_\name, .-__acle_se_\name +.endm + + @ Valid setups for veneer generation + entry exported_entry_veneer2, global + entry exported_entry_veneer3, global + + @ Valid setup for entry function without veneer generation + entry exported_entry_fct1, global, sg + entry exported_entry_fct2, global, sg + + @ Normal symbol not exported to SG import library + .align 2 + .global not_exported_fct1 + .type not_exported_fct1, %function +not_exported_fct1: + nop + .size not_exported_fct1, .-not_exported_fct1 + +.ifdef CHECK_ERRORS + @ Invalid setups for export to SG import library + .align 2 + .global __acle_se_not_exported_fct2 + .type __acle_se_not_exported_fct2, %function +__acle_se_not_exported_fct2: + nop + .size __acle_se_not_exported_fct2, .-__acle_se_not_exported_fct2 + + .align 2 + .global __acle_se_not_exported_pseudoentry_var + .global not_exported_pseudoentry_var + .data + .type __acle_se_not_exported_pseudoentry_var, %object + .type not_exported_pseudoentry_var, %object + .size not_exported_pseudoentry_var, 4 + .size __acle_se_not_exported_pseudoentry_var, 4 +__acle_se_not_exported_pseudoentry_var: +not_exported_pseudoentry_var: + .word 42 +.endif -- cgit v1.1