mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
0955507f6e
2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add a new parameter for the input import library bfd. * bfd-in2.h: Regenerate. * elf32-arm.c (struct elf32_arm_link_hash_table): New in_implib_bfd and new_cmse_stub_offset fields. (stub_hash_newfunc): Initialize stub_offset and stub_template_size to -1. (elf32_arm_add_stub): Likewise for stub_offset. (arm_new_stubs_start_offset_ptr): New function. (arm_build_one_stub): Only allocate a stub_offset if it is -1. Allow empty SG veneers to have zero relocations. (arm_size_one_stub): Only initialize stub size and template information for non empty veneers. Do not update veneer section size if veneer already has an offset. (elf32_arm_create_stub): Return the stub entry pointer or NULL instead of a boolean indicating success or failure. (cmse_scan): Change stub_changed parameter into an integer pointer parameter cmse_stub_created to count the number of stub created and adapt to change of return value in elf32_arm_create_stub. (cmse_entry_fct_p): New function. (arm_list_new_cmse_stub): Likewise. (set_cmse_veneer_addr_from_implib): Likewise. (elf32_arm_size_stubs): Define cmse_stub_created, pass its address to cmse_scan instead of that of cmse_stub_changed to compute the number of stub created and use it to initialize stub_changed. Call set_cmse_veneer_addr_from_implib after all cmse_scan. Adapt to change of return value in elf32_arm_create_stub. Use arm_stub_section_start_offset () if not NULL to initialize size of secure gateway veneers section. Initialize stub_offset of Cortex-A8 erratum fix to -1. Use ret to hold return value. (elf32_arm_build_stubs): Use arm_stub_section_start_offset () if not NULL to initialize size of secure gateway veneers section. Adapt comment to stress the importance of zeroing veneer section content. (bfd_elf32_arm_set_target_relocs): Add new in_implib_bfd parameter to initialize eponymous field in struct elf32_arm_link_hash_table. ld/ * emultempl/armelf.em (in_implib_filename): Declare and initialize new variable. (arm_elf_create_output_section_statements): Open import input library file for writing and pass resulting in_implib_bfd to bfd_elf32_arm_set_target_relocs. (PARSE_AND_LIST_PROLOGUE): Define OPTION_IN_IMPLIB option. (PARSE_AND_LIST_LONGOPTS): Define --in-implib option. (PARSE_AND_LIST_OPTIONS): Add help message for --in-implib option. (PARSE_AND_LIST_ARGS_CASES): Handle new OPTION_IN_IMPLIB case. * ld.texinfo (--cmse-implib): Update to mention --in-implib. (--in-implib): Document new option. * NEWS: Likewise. * testsuite/ld-arm/arm-elf.exp (Secure gateway import library generation): add --defsym VER=1 to gas CLI. (Secure gateway import library generation: errors): Likewise. (Input secure gateway import library): New test. (Input secure gateway import library: no output import library): Likewise. (Input secure gateway import library: not an SG input import library): Likewise. (Input secure gateway import library: earlier stub section base): Likewise. (Input secure gateway import library: later stub section base): Likewise. (Input secure gateway import library: veneer comeback): Likewise. (Input secure gateway import library: entry function change): Likewise. * testsuite/ld-arm/cmse-implib.s: Add input import library testing. * testsuite/ld-arm/cmse-implib.rd: Update accordingly. * testsuite/ld-arm/cmse-new-implib.out: New file. * testsuite/ld-arm/cmse-new-implib.rd: Likewise. * testsuite/ld-arm/cmse-new-implib-no-output.out: Likewise. * testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out: Likewise. * testsuite/ld-arm/cmse-new-earlier-later-implib.out: Likewise. * testsuite/ld-arm/cmse-new-comeback-implib.rd: Likewise. * testsuite/ld-arm/cmse-new-wrong-implib.out: Likewise.
76 lines
1.7 KiB
ArmAsm
76 lines
1.7 KiB
ArmAsm
.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
|
|
.if (VER >= 2)
|
|
entry exported_entry_veneer1, global
|
|
.endif
|
|
.if (VER != 4)
|
|
entry exported_entry_veneer2, global
|
|
.else
|
|
entry exported_entry_veneer2, weak
|
|
.endif
|
|
.if (VER != 2)
|
|
entry exported_entry_veneer3, global
|
|
.endif
|
|
.if (VER > 1)
|
|
entry exported_entry_veneer4, global
|
|
.endif
|
|
|
|
@ Valid setup for entry function without veneer generation
|
|
entry exported_entry_fct1, global, sg
|
|
.if (VER != 4)
|
|
entry exported_entry_fct2, global, sg
|
|
.else
|
|
@ Invalid setup for entry function without veneer generation
|
|
entry exported_entry_fct2, global, nop
|
|
.endif
|
|
|
|
@ 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
|