e7c3341679
* common.h (STT_IFUNC): Define. elfcpp/ * elfcpp.h (enum STT): Add STT_IFUNC. bfd/ * syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION. Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE. Renumber flags to remove gaps. (bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION. (bfd_decode_symclass): Likewise. * elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into STT_IFUNC. (elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC. (_bfd_elf_is_function_type): Likewise. * elf32-arm.c (arm_elf_find_function): Likewise. (elf32_arm_adjust_dynamic_symbol): Likewise. (elf32_arm_swap_symbol_in): Likewise. (elf32_arm_additional_program_headers): Likewise. * elf32-i386.c (is_indirect_symbol): New function. (elf_i386_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (is_indirect_symbol): New function. (elf64_x86_64_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into BSF_INDIRECT_FUNCTION. * elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support for STT_IFUNC symbols. (get_ifunc_reloc_section_name): New function. (_bfd_elf_make_ifunc_reloc_section): New function. * elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field. * bfd-in2.h: Regenerate. gas/ * config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type. * doc/as.texinfo: Document new feature. * NEWS: Mention new feature. gas/testsuite/ * gas/elf/type.s: Add test of STT_IFUNC symbol type. * gas/elf/type.e: Update expected disassembly. * gas/elf/elf.exp: Update grep of symbol types. ld/ * NEWS: Mention new feature. * pe-dll.c (process_def_file): Replace use of redundant BFD_FORT_COMM_DEFAULT_VALUE with 0. * scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn sections. ld/testsuite/ * ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc descriptions. * ld-mips-elf/reloc-1-n64.d: Likewise. * ld-i386/ifunc.d: New test. * ld-i386/ifunc.s: Source file for the new test. * ld-i386/i386.exp: Run the new test.
128 lines
2 KiB
ArmAsm
128 lines
2 KiB
ArmAsm
.file "ifunc.c"
|
|
#APP
|
|
.type func, %indirect_function
|
|
.type long_func_name, %indirect_function
|
|
.section .rodata.str1.1,"aMS",@progbits,1
|
|
.LC0:
|
|
.string "arg is %d\n"
|
|
#NO_APP
|
|
.text
|
|
.p2align 4,,15
|
|
.globl bar
|
|
.type bar, @function
|
|
bar:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
movl 8(%ebp), %eax
|
|
movl $.LC0, (%esp)
|
|
movl %eax, 4(%esp)
|
|
call printf
|
|
leave
|
|
ret
|
|
.size bar, .-bar
|
|
.section .rodata.str1.1
|
|
.LC1:
|
|
.string "main: calling func"
|
|
.section .rodata.str1.4,"aMS",@progbits,1
|
|
.align 4
|
|
.LC2:
|
|
.string "main: func finished, calling long_func_name"
|
|
.section .rodata.str1.1
|
|
.LC3:
|
|
.string "main: long_func_name finished"
|
|
.text
|
|
.p2align 4,,15
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
leal 4(%esp), %ecx
|
|
andl $-16, %esp
|
|
pushl -4(%ecx)
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
pushl %ecx
|
|
subl $4, %esp
|
|
movl $.LC1, (%esp)
|
|
call puts
|
|
call func
|
|
movl $.LC2, (%esp)
|
|
call puts
|
|
call long_func_name
|
|
movl $.LC3, (%esp)
|
|
call puts
|
|
addl $4, %esp
|
|
xorl %eax, %eax
|
|
popl %ecx
|
|
popl %ebp
|
|
leal -4(%ecx), %esp
|
|
ret
|
|
.size main, .-main
|
|
.p2align 4,,15
|
|
.globl long_func_name
|
|
.type long_func_name, @function
|
|
long_func_name:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
call rand
|
|
movl $func0, %edx
|
|
testl %eax, %eax
|
|
jne .L7
|
|
movl $func1, %edx
|
|
.L7:
|
|
movl %edx, %eax
|
|
leave
|
|
ret
|
|
.size long_func_name, .-long_func_name
|
|
.p2align 4,,15
|
|
.globl func
|
|
.type func, @function
|
|
func:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
call rand
|
|
movl $func0, %edx
|
|
testl %eax, %eax
|
|
jne .L12
|
|
movl $func1, %edx
|
|
.L12:
|
|
movl %edx, %eax
|
|
leave
|
|
ret
|
|
.size func, .-func
|
|
.section .rodata.str1.1
|
|
.LC4:
|
|
.string "func1\n"
|
|
.text
|
|
.p2align 4,,15
|
|
.globl func1
|
|
.type func1, @function
|
|
func1:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
movl $.LC4, (%esp)
|
|
call puts
|
|
leave
|
|
ret
|
|
.size func1, .-func1
|
|
.section .rodata.str1.1
|
|
.LC5:
|
|
.string "func0\n"
|
|
.text
|
|
.p2align 4,,15
|
|
.globl func0
|
|
.type func0, @function
|
|
func0:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
movl $.LC5, (%esp)
|
|
call puts
|
|
leave
|
|
ret
|
|
.size func0, .-func0
|
|
.ident "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)"
|
|
.section .note.GNU-stack,"",@progbits
|