|| (EH)->elf.root.type == bfd_link_hash_undefined)))
/* TRUE if this input relocation should be copied to output. H->dynindx
- may be -1 if this symbol was marked to become local. */
+ may be -1 if this symbol was marked to become local. STV_PROTECTED
+ symbols with indirect external access are local. */
#define COPY_INPUT_RELOC_P(IS_X86_64, INFO, H, R_TYPE) \
((H) != NULL \
&& (H)->dynindx != -1 \
&& (X86_PCREL_TYPE_P (IS_X86_64, R_TYPE) \
- || !(bfd_link_executable (INFO) || SYMBOLIC_BIND ((INFO), (H))) \
+ || !(bfd_link_executable (INFO) \
+ || SYMBOLIC_BIND ((INFO), (H)) \
+ || ((INFO)->indirect_extern_access > 0 \
+ && ELF_ST_VISIBILITY ((H)->other) == STV_PROTECTED)) \
|| !(H)->def_regular))
/* TRUE if this is actually a static link, or it is a -Bsymbolic link
run_dump_test "pr30787"
run_dump_test "pr31047"
run_dump_test "pr32191"
+run_dump_test "pr33260"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
--- /dev/null
+#source: pr33260.s
+#as: -mrelax-relocations=yes --32
+#ld: -melf_i386 -shared -z indirect-extern-access
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
--- /dev/null
+ .text
+ .p2align 4
+ .globl my_func
+ .protected my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .p2align 4
+ .globl f
+ .type f, @function
+f:
+ .cfi_startproc
+ call __x86.get_pc_thunk.ax
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ leal vtable@GOTOFF(%eax), %eax
+ ret
+ .cfi_endproc
+ .size f, .-f
+ .section .data.rel,"aw"
+ .align 4
+ .type vtable, @object
+ .size vtable, 8
+vtable:
+ .long my_func
+ .long my_data
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
+ .globl __x86.get_pc_thunk.ax
+ .hidden __x86.get_pc_thunk.ax
+ .type __x86.get_pc_thunk.ax, @function
+__x86.get_pc_thunk.ax:
+ .cfi_startproc
+ movl (%esp), %eax
+ ret
+ .cfi_endproc
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#source: pr33260.s
+#as: -mrelax-relocations=yes --x32
+#ld: -melf32_x86_64 -shared -z indirect-extern-access
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
--- /dev/null
+#source: pr33260.s
+#as: -mrelax-relocations=yes --64 -defsym __x86_64__=1
+#ld: -melf_x86_64 -shared -z indirect-extern-access
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym.* Value +Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
--- /dev/null
+ .text
+ .p2align 4
+ .globl my_func
+ .protected my_func
+ .type my_func, @function
+my_func:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+ .size my_func, .-my_func
+ .p2align 4
+ .globl f
+ .type f, @function
+f:
+ .cfi_startproc
+ leaq vtable(%rip), %rax
+ ret
+ .cfi_endproc
+ .size f, .-f
+ .section .data.rel,"aw"
+ .type vtable, @object
+.ifdef __x86_64__
+ .align 16
+ .size vtable, 16
+.else
+ .align 8
+ .size vtable, 8
+.endif
+vtable:
+ .dc.a my_func
+ .dc.a my_data
+ .protected my_data
+ .globl my_data
+ .bss
+ .align 4
+ .type my_data, @object
+ .size my_data, 4
+my_data:
+ .zero 4
+ .section .note.GNU-stack,"",@progbits
run_dump_test "pr32591-4"
run_dump_test "pr32591-4-x32"
run_dump_test "pr32809"
+run_dump_test "pr33260"
+run_dump_test "pr33260-x32"
if { ![skip_sframe_tests] } {
run_dump_test "sframe-simple-1"