8c37241be3
* elflink.c (elf_bfd_final_link): Don't output STT_SECTION symbol into .dynsym if elf_section_data (sec)->dynindx <= 0. Adjust counting of last_local. (_bfd_elf_link_renumber_dynsyms): Don't assign dynindx to sections other than SHT_PROGBITS/SHT_NOBITS and neither for .got/.got.plt/.plt created by the linker nor !SHF_ALLOC. * elf32-i386.c (elf_i386_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. Set sh_entsize for .got section in addition to .got.plt. (elf_i386_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. (elf64_x86_64_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. Set sh_entsize for .got section in addition to .got.plt. * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_RELRO. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Likewise. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Likewise. * elflink.c (bfd_elf_size_dynamic_sections): Set elf_tdata (output_bfd)->relro from info->relro. * elf-bfd.h (struct elf_obj_tdata): Add relro field. include/ * bfdlink.h (struct bfd_link_info): Add relro, relro_start and relro_end fields. * elf/common.h (PT_GNU_EH_FRAME, PT_GNU_STACK): Add comments. (PT_GNU_RELRO): Define. binutils/ * readelf.c (get_segment_type): Handle PT_GNU_RELRO. ld/ * genscripts.sh: Generate -z combreloc -z now -z relro scripts for binaries, -shared and -pie. * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Set. * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Set. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Rename to... (OTHER_RELRO_SECTIONS): ... this. * ldlex.l (DATA_SEGMENT_RELRO_END): Add. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z relro and -z norelro. (gld${EMULATION_NAME}_list_options): Add it to usage. (gld${EMULATION_NAME}_get_script): Return -z combreloc -z now -z relro scripts when appropriate. * scripttempl/elf.sc: Unset SEPARATE_GOTPLT if RELRO_NOW is set. Create separate .got.plt section if SEPARATE_GOTPLT. Move sections which are only written during relocation handling to the beginning of RW segment. If NO_SMALL_DATA, move .got before .data. Add DATA_SEGMENT_RELRO_END directive. Include OTHER_RELRO_SECTIONS. * ldgram.y (DATA_SEGMENT_RELRO_END): Add. * ldexp.c (exp_print_token): Handle DATA_SEGMENT_RELRO_END. (fold_unary): Likewise. (fold_binary): Handle -z relro. * ldexp.h (struct exp_data_seg): Add exp_dataseg_relro_seen and exp_dataseg_relro_adjust phases. Add relro_end field. * ldmain.c (main): Initialize link_info.relro to FALSE. * ldlang.c (lang_size_sections): Handle -z relro. ld/testsuite/ * ld-i386/tlspic.rd: Adjust for section reordering changes and removal of unneeded STT_SECTION symbols from .dynsym. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbinpic.s: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsbin.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsnopic1.s: Likewise. * ld-i386/combreloc.d: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-s390/tlspic1.s: Likewise. * ld-s390/tlsbinpic.s: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlsbin.dd: Likewise. * ld-s390/tlsbin.sd: Likewise. * ld-s390/tlsbin.td: Likewise. * ld-s390/tlspic.sd: Likewise. * ld-s390/tlspic.td: Likewise. * ld-s390/tlspic1_64.s: Likewise. * ld-s390/tlsbinpic_64.s: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.sd: Likewise. * ld-s390/tlspic_64.td: Likewise. * ld-s390/tlsbin_64.td: Likewise. * ld-s390/tlsbin_64.sd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.t: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-ia64/tlspic.dd: Likewise. * ld-ia64/tlspic.sd: Likewise. * ld-ia64/tlspic.td: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlsbin.sd: Likewise. * ld-ia64/tlsbin.td: Likewise. * ld-elfvsb/elfvsb.exp: XFAIL non-PIC load offset tests on s390x. * ld-shared/shared.exp: Likewise.
235 lines
7.3 KiB
Plaintext
235 lines
7.3 KiB
Plaintext
#source: tlspic1.s
|
|
#source: tlspic2.s
|
|
#as: --64
|
|
#ld: -shared -melf_x86_64
|
|
#objdump: -drj.text
|
|
#target: x86_64-*-*
|
|
|
|
.*: +file format elf64-x86-64
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+1000 <fn1>:
|
|
+1000: 55[ ]+push %rbp
|
|
+1001: 48 89 e5[ ]+mov %rsp,%rbp
|
|
+1004: 90[ ]+nop *
|
|
+1005: 90[ ]+nop *
|
|
+1006: 90[ ]+nop *
|
|
+1007: 90[ ]+nop *
|
|
# GD
|
|
+1008: 66 48 8d 3d 80 03 10[ ]+lea 1049472\(%rip\),%rdi +# 101390 <.*>
|
|
+100f: 00 *
|
|
# -> R_X86_64_DTPMOD64 sg1
|
|
+1010: 66[ ]+data16
|
|
+1011: 66[ ]+data16
|
|
+1012: 48 e8 88 f5 ff ff[ ]+rex64 callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+1018: 90[ ]+nop *
|
|
+1019: 90[ ]+nop *
|
|
+101a: 90[ ]+nop *
|
|
+101b: 90[ ]+nop *
|
|
# GD -> IE because variable is referenced through IE too
|
|
+101c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
|
|
+1023: 00 00 *
|
|
+1025: 48 03 05 84 03 10 00[ ]+add 1049476\(%rip\),%rax +# 1013b0 <.*>
|
|
# -> R_X86_64_TPOFF64 sg2
|
|
+102c: 90[ ]+nop *
|
|
+102d: 90[ ]+nop *
|
|
+102e: 90[ ]+nop *
|
|
+102f: 90[ ]+nop *
|
|
# GD against local variable
|
|
+1030: 66 48 8d 3d 08 03 10[ ]+lea 1049352\(%rip\),%rdi +# 101340 <.*>
|
|
+1037: 00 *
|
|
# -> R_X86_64_DTPMOD64 [0 0x2000000000000000]
|
|
+1038: 66[ ]+data16
|
|
+1039: 66[ ]+data16
|
|
+103a: 48 e8 60 f5 ff ff[ ]+rex64 callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+1040: 90[ ]+nop *
|
|
+1041: 90[ ]+nop *
|
|
+1042: 90[ ]+nop *
|
|
+1043: 90[ ]+nop *
|
|
# GD -> IE against local variable referenced through IE too
|
|
+1044: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
|
|
+104b: 00 00 *
|
|
+104d: 48 03 05 fc 02 10 00[ ]+add 1049340\(%rip\),%rax +# 101350 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x24
|
|
+1054: 90[ ]+nop *
|
|
+1055: 90[ ]+nop *
|
|
+1056: 90[ ]+nop *
|
|
+1057: 90[ ]+nop *
|
|
# GD against hidden and local variable
|
|
+1058: 66 48 8d 3d 58 03 10[ ]+lea 1049432\(%rip\),%rdi +# 1013b8 <.*>
|
|
+105f: 00 *
|
|
# -> R_X86_64_DTPMOD64 [0 0x4000000000000000]
|
|
+1060: 66[ ]+data16
|
|
+1061: 66[ ]+data16
|
|
+1062: 48 e8 38 f5 ff ff[ ]+rex64 callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+1068: 90[ ]+nop *
|
|
+1069: 90[ ]+nop *
|
|
+106a: 90[ ]+nop *
|
|
+106b: 90[ ]+nop *
|
|
# GD -> IE against hidden and local variable referenced through IE too
|
|
+106c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
|
|
+1073: 00 00 *
|
|
+1075: 48 03 05 4c 03 10 00[ ]+add 1049420\(%rip\),%rax +# 1013c8 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x44
|
|
+107c: 90[ ]+nop *
|
|
+107d: 90[ ]+nop *
|
|
+107e: 90[ ]+nop *
|
|
+107f: 90[ ]+nop *
|
|
# GD against hidden but not local variable
|
|
+1080: 66 48 8d 3d e8 02 10[ ]+lea 1049320\(%rip\),%rdi +# 101370 <.*>
|
|
+1087: 00 *
|
|
# -> R_X86_64_DTPMOD64 [0 0x6000000000000000]
|
|
+1088: 66[ ]+data16
|
|
+1089: 66[ ]+data16
|
|
+108a: 48 e8 10 f5 ff ff[ ]+rex64 callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+1090: 90[ ]+nop *
|
|
+1091: 90[ ]+nop *
|
|
+1092: 90[ ]+nop *
|
|
+1093: 90[ ]+nop *
|
|
# GD -> IE against hidden but not local variable referenced through IE too
|
|
+1094: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
|
|
+109b: 00 00 *
|
|
+109d: 48 03 05 dc 02 10 00[ ]+add 1049308\(%rip\),%rax +# 101380 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x64
|
|
+10a4: 90[ ]+nop *
|
|
+10a5: 90[ ]+nop *
|
|
+10a6: 90[ ]+nop *
|
|
+10a7: 90[ ]+nop *
|
|
# LD
|
|
+10a8: 48 8d 3d b1 02 10 00[ ]+lea 1049265\(%rip\),%rdi +# 101360 <.*>
|
|
# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
|
|
+10af: e8 ec f4 ff ff[ ]+callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+10b4: 90[ ]+nop *
|
|
+10b5: 90[ ]+nop *
|
|
+10b6: 48 8d 90 20 00 00 00[ ]+lea 0x20\(%rax\),%rdx
|
|
+10bd: 90[ ]+nop *
|
|
+10be: 90[ ]+nop *
|
|
+10bf: 4c 8d 88 26 00 00 00[ ]+lea 0x26\(%rax\),%r9
|
|
+10c6: 90[ ]+nop *
|
|
+10c7: 90[ ]+nop *
|
|
+10c8: 90[ ]+nop *
|
|
+10c9: 90[ ]+nop *
|
|
# LD against hidden and local variables
|
|
+10ca: 48 8d 3d 8f 02 10 00[ ]+lea 1049231\(%rip\),%rdi +# 101360 <.*>
|
|
# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
|
|
+10d1: e8 ca f4 ff ff[ ]+callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+10d6: 90[ ]+nop *
|
|
+10d7: 90[ ]+nop *
|
|
+10d8: 48 8d 90 40 00 00 00[ ]+lea 0x40\(%rax\),%rdx
|
|
+10df: 90[ ]+nop *
|
|
+10e0: 90[ ]+nop *
|
|
+10e1: 48 8d 88 47 00 00 00[ ]+lea 0x47\(%rax\),%rcx
|
|
+10e8: 90[ ]+nop *
|
|
+10e9: 90[ ]+nop *
|
|
+10ea: 90[ ]+nop *
|
|
+10eb: 90[ ]+nop *
|
|
# LD against hidden but not local variables
|
|
+10ec: 48 8d 3d 6d 02 10 00[ ]+lea 1049197\(%rip\),%rdi +# 101360 <.*>
|
|
# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
|
|
+10f3: e8 a8 f4 ff ff[ ]+callq [0-9a-f]+ <.*>
|
|
# -> R_X86_64_JUMP_SLOT __tls_get_addr
|
|
+10f8: 90[ ]+nop *
|
|
+10f9: 90[ ]+nop *
|
|
+10fa: 4c 8d a0 60 00 00 00[ ]+lea 0x60\(%rax\),%r12
|
|
+1101: 90[ ]+nop *
|
|
+1102: 90[ ]+nop *
|
|
+1103: 48 8d 88 65 00 00 00[ ]+lea 0x65\(%rax\),%rcx
|
|
+110a: 90[ ]+nop *
|
|
+110b: 90[ ]+nop *
|
|
# IE against global var
|
|
+110c: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
|
|
+1113: 00 00 *
|
|
+1115: 90[ ]+nop *
|
|
+1116: 90[ ]+nop *
|
|
+1117: 48 03 0d 92 02 10 00[ ]+add 1049234\(%rip\),%rcx +# 1013b0 <.*>
|
|
# -> R_X86_64_TPOFF64 sg2
|
|
+111e: 90[ ]+nop *
|
|
+111f: 90[ ]+nop *
|
|
+1120: 90[ ]+nop *
|
|
+1121: 90[ ]+nop *
|
|
# IE against local var
|
|
+1122: 64 4c 8b 34 25 00 00[ ]+mov %fs:0x0,%r14
|
|
+1129: 00 00 *
|
|
+112b: 90[ ]+nop *
|
|
+112c: 90[ ]+nop *
|
|
+112d: 4c 03 35 1c 02 10 00[ ]+add 1049116\(%rip\),%r14 +# 101350 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x24
|
|
+1134: 90[ ]+nop *
|
|
+1135: 90[ ]+nop *
|
|
+1136: 90[ ]+nop *
|
|
+1137: 90[ ]+nop *
|
|
# IE against hidden and local var
|
|
+1138: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
|
|
+113f: 00 00 *
|
|
+1141: 90[ ]+nop *
|
|
+1142: 90[ ]+nop *
|
|
+1143: 48 03 0d 7e 02 10 00[ ]+add 1049214\(%rip\),%rcx +# 1013c8 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x44
|
|
+114a: 90[ ]+nop *
|
|
+114b: 90[ ]+nop *
|
|
+114c: 90[ ]+nop *
|
|
+114d: 90[ ]+nop *
|
|
# IE against hidden but not local var
|
|
+114e: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
|
|
+1155: 00 00 *
|
|
+1157: 90[ ]+nop *
|
|
+1158: 90[ ]+nop *
|
|
+1159: 48 03 0d 20 02 10 00[ ]+add 1049120\(%rip\),%rcx +# 101380 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x64
|
|
+1160: 90[ ]+nop *
|
|
+1161: 90[ ]+nop *
|
|
+1162: 90[ ]+nop *
|
|
+1163: 90[ ]+nop *
|
|
# Direct access through %fs
|
|
# IE against global var
|
|
+1164: 48 8b 0d 1d 02 10 00[ ]+mov 1049117\(%rip\),%rcx +# 101388 <.*>
|
|
# -> R_X86_64_TPOFF64 sg5
|
|
+116b: 90[ ]+nop *
|
|
+116c: 90[ ]+nop *
|
|
+116d: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
|
|
+1171: 90[ ]+nop *
|
|
+1172: 90[ ]+nop *
|
|
+1173: 90[ ]+nop *
|
|
+1174: 90[ ]+nop *
|
|
# IE against local var
|
|
+1175: 4c 8b 15 dc 01 10 00[ ]+mov 1049052\(%rip\),%r10 +# 101358 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x30
|
|
+117c: 90[ ]+nop *
|
|
+117d: 90[ ]+nop *
|
|
+117e: 64 4d 8b 22[ ]+mov %fs:\(%r10\),%r12
|
|
+1182: 90[ ]+nop *
|
|
+1183: 90[ ]+nop *
|
|
+1184: 90[ ]+nop *
|
|
+1185: 90[ ]+nop *
|
|
# IE against hidden and local var
|
|
+1186: 48 8b 15 13 02 10 00[ ]+mov 1049107\(%rip\),%rdx +# 1013a0 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x50
|
|
+118d: 90[ ]+nop *
|
|
+118e: 90[ ]+nop *
|
|
+118f: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
|
|
+1193: 90[ ]+nop *
|
|
+1194: 90[ ]+nop *
|
|
+1195: 90[ ]+nop *
|
|
+1196: 90[ ]+nop *
|
|
# IE against hidden but not local var
|
|
+1197: 48 8b 0d 0a 02 10 00[ ]+mov 1049098\(%rip\),%rcx +# 1013a8 <.*>
|
|
# -> R_X86_64_TPOFF64 *ABS*+0x70
|
|
+119e: 90[ ]+nop *
|
|
+119f: 90[ ]+nop *
|
|
+11a0: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
|
|
+11a4: 90[ ]+nop *
|
|
+11a5: 90[ ]+nop *
|
|
+11a6: 90[ ]+nop *
|
|
+11a7: 90[ ]+nop *
|
|
+11a8: c9[ ]+leaveq *
|
|
+11a9: c3[ ]+retq *
|
|
+11aa: 90[ ]+nop *
|
|
+11ab: 90[ ]+nop *
|