WIP MachO binutils port assisted by AI I may consider upstreaming this in the future.
0

Configure Feed

Select the types of activity you want to include in your feed.

Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF

Handle R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC.
Convert

add name@gottpoff(%rip), %reg
mov name@gottpoff(%rip), %reg

to

add $name@tpoff, %reg
mov $name@tpoff, %reg

and

lea name@tlsdesc(%rip), %reg

to

mov $name@tpoff, %reg
mov name@gottpoff(%rip), %reg

if the instruction is encoded with the REX2 prefix when possible.

elfcpp/

* x86_64.h (R_X86_64_CODE_4_GOTTPOFF): New.
(R_X86_64_CODE_4_GOTPC32_TLSDESC): Likewise.

gold/

* x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle
R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_4_GOTTPOFF.
(Target_x86_64::Scan::get_reference_flags): Likewise.
(Target_x86_64::Scan::local): Likewise.
(Target_x86_64::Scan::global): Likewise.
(Target_x86_64::Relocate::relocate): Likewise.
(Target_x86_64::Relocate::relocate_tls): Likewise.
(Target_x86_64::Relocate::tls_desc_gd_to_ie): Handle
R_X86_64_CODE_4_GOTPC32_TLSDESC.
(Target_x86_64::Relocate::tls_desc_gd_to_le): Likewise.
(Target_x86_64::Relocate::tls_ie_to_le): Handle.
R_X86_64_CODE_4_GOTTPOFF.
* testsuite/Makefile.am: Add x86_64_ie_to_le test.
* testsuite/Makefile.in: Regenerated.
* testsuite/x86_64_gd_to_le.s: Add R_X86_64_CODE_4_GOTPC32_TLSDESC
test.
* testsuite/x86_64_gd_to_le.sh: Check GDesc to LE conversion.
* testsuite/x86_64_ie_to_le.s: New file.
* testsuite/x86_64_ie_to_le.sh: Likewise.

H.J. Lu (Dec 28, 2023, 8:47 AM -0800) 00a17c6a a533c8df

+203 -37
+8
elfcpp/x86_64.h
··· 102 102 // GOT if the instruction starts at 4 103 103 // bytes before the relocation offset, 104 104 // relaxable. 105 + R_X86_64_CODE_4_GOTTPOFF = 44, // 32 bit signed PC relative offset to 106 + // GOT entry for IE symbol if the 107 + // instruction starts at 4 bytes before 108 + // the relocation offset. 109 + R_X86_64_CODE_4_GOTPC32_TLSDESC = 45, // 32-bit PC relative to TLS 110 + // descriptor in GOT if the 111 + // instruction starts at 4 bytes 112 + // before the relocation offset. 105 113 // GNU vtable garbage collection extensions. 106 114 R_X86_64_GNU_VTINHERIT = 250, 107 115 R_X86_64_GNU_VTENTRY = 251
+119 -37
gold/x86_64.cc
··· 1110 1110 // Adjust TLS relocation type based on the options and whether this 1111 1111 // is a local symbol. 1112 1112 static tls::Tls_optimization 1113 - optimize_tls_reloc(bool is_final, int r_type); 1113 + optimize_tls_reloc(bool is_final, int r_type, size_t r_offset, 1114 + const unsigned char* reloc_view); 1114 1115 1115 1116 // Get the GOT section, creating it if necessary. 1116 1117 Output_data_got<64, false>* ··· 2878 2879 2879 2880 // Optimize the TLS relocation type based on what we know about the 2880 2881 // symbol. IS_FINAL is true if the final address of this symbol is 2881 - // known at link time. 2882 + // known at link time. RELOC_VIEW points to the relocation offset. 2882 2883 2883 2884 template<int size> 2884 2885 tls::Tls_optimization 2885 - Target_x86_64<size>::optimize_tls_reloc(bool is_final, int r_type) 2886 + Target_x86_64<size>::optimize_tls_reloc(bool is_final, int r_type, 2887 + size_t r_offset, 2888 + const unsigned char* reloc_view) 2886 2889 { 2887 2890 // If we are generating a shared library, then we can't do anything 2888 2891 // in the linker. ··· 2891 2894 2892 2895 switch (r_type) 2893 2896 { 2897 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 2898 + if (r_offset <= 4 || *(reloc_view - 4) != 0xd5) 2899 + return tls::TLSOPT_NONE; 2900 + // Fall through. 2894 2901 case elfcpp::R_X86_64_TLSGD: 2895 2902 case elfcpp::R_X86_64_GOTPC32_TLSDESC: 2896 2903 case elfcpp::R_X86_64_TLSDESC_CALL: ··· 2913 2920 // Another Local-Dynamic reloc. 2914 2921 return tls::TLSOPT_TO_LE; 2915 2922 2923 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 2924 + if (r_offset <= 4 || *(reloc_view - 4) != 0xd5) 2925 + return tls::TLSOPT_NONE; 2926 + // Fall through. 2916 2927 case elfcpp::R_X86_64_GOTTPOFF: 2917 2928 // These are Initial-Exec relocs which get the thread offset 2918 2929 // from the GOT. If we know that we are linking against the ··· 2979 2990 2980 2991 case elfcpp::R_X86_64_TLSGD: // Global-dynamic 2981 2992 case elfcpp::R_X86_64_GOTPC32_TLSDESC: // Global-dynamic (from ~oliva url) 2993 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 2982 2994 case elfcpp::R_X86_64_TLSDESC_CALL: 2983 2995 case elfcpp::R_X86_64_TLSLD: // Local-dynamic 2984 2996 case elfcpp::R_X86_64_DTPOFF32: 2985 2997 case elfcpp::R_X86_64_DTPOFF64: 2986 2998 case elfcpp::R_X86_64_GOTTPOFF: // Initial-exec 2999 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 2987 3000 case elfcpp::R_X86_64_TPOFF32: // Local-exec 2988 3001 return Symbol::TLS_REF; 2989 3002 ··· 3147 3160 unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info()); 3148 3161 target->make_local_ifunc_plt_entry(symtab, layout, object, r_sym); 3149 3162 } 3163 + 3164 + const unsigned char* reloc_view = NULL; 3150 3165 3151 3166 switch (r_type) 3152 3167 { ··· 3345 3360 break; 3346 3361 3347 3362 // These are initial tls relocs, which are expected when linking 3363 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 3364 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 3365 + { 3366 + section_size_type stype; 3367 + reloc_view = object->section_contents(data_shndx, &stype, true); 3368 + } 3369 + // Fall through. 3348 3370 case elfcpp::R_X86_64_TLSGD: // Global-dynamic 3349 3371 case elfcpp::R_X86_64_GOTPC32_TLSDESC: // Global-dynamic (from ~oliva url) 3350 3372 case elfcpp::R_X86_64_TLSDESC_CALL: ··· 3355 3377 case elfcpp::R_X86_64_TPOFF32: // Local-exec 3356 3378 { 3357 3379 bool output_is_shared = parameters->options().shared(); 3380 + size_t r_offset = reloc.get_r_offset(); 3358 3381 const tls::Tls_optimization optimized_type 3359 3382 = Target_x86_64<size>::optimize_tls_reloc(!output_is_shared, 3360 - r_type); 3383 + r_type, r_offset, 3384 + reloc_view + r_offset); 3361 3385 switch (r_type) 3362 3386 { 3363 3387 case elfcpp::R_X86_64_TLSGD: // General-dynamic ··· 3386 3410 break; 3387 3411 3388 3412 case elfcpp::R_X86_64_GOTPC32_TLSDESC: 3413 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 3389 3414 target->define_tls_base_symbol(symtab, layout); 3390 3415 if (optimized_type == tls::TLSOPT_NONE) 3391 3416 { ··· 3438 3463 break; 3439 3464 3440 3465 case elfcpp::R_X86_64_GOTTPOFF: // Initial-exec 3466 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 3441 3467 layout->set_has_static_tls(); 3442 3468 if (optimized_type == tls::TLSOPT_NONE) 3443 3469 { ··· 3614 3640 if (gsym->type() == elfcpp::STT_GNU_IFUNC 3615 3641 && this->reloc_needs_plt_for_ifunc(object, r_type)) 3616 3642 target->make_plt_entry(symtab, layout, gsym); 3643 + 3644 + const unsigned char *reloc_view = NULL; 3617 3645 3618 3646 switch (r_type) 3619 3647 { ··· 3872 3900 break; 3873 3901 3874 3902 // These are initial tls relocs, which are expected for global() 3903 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 3904 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 3905 + { 3906 + section_size_type stype; 3907 + reloc_view = object->section_contents(data_shndx, &stype, true); 3908 + } 3909 + // Fall through. 3875 3910 case elfcpp::R_X86_64_TLSGD: // Global-dynamic 3876 3911 case elfcpp::R_X86_64_GOTPC32_TLSDESC: // Global-dynamic (from ~oliva url) 3877 3912 case elfcpp::R_X86_64_TLSDESC_CALL: ··· 3884 3919 // For the Initial-Exec model, we can treat undef symbols as final 3885 3920 // when building an executable. 3886 3921 const bool is_final = (gsym->final_value_is_known() || 3887 - (r_type == elfcpp::R_X86_64_GOTTPOFF && 3922 + ((r_type == elfcpp::R_X86_64_GOTTPOFF || 3923 + r_type == elfcpp::R_X86_64_CODE_4_GOTTPOFF) && 3888 3924 gsym->is_undefined() && 3889 3925 parameters->options().output_is_executable())); 3926 + size_t r_offset = reloc.get_r_offset(); 3890 3927 const tls::Tls_optimization optimized_type 3891 - = Target_x86_64<size>::optimize_tls_reloc(is_final, r_type); 3928 + = Target_x86_64<size>::optimize_tls_reloc(is_final, r_type, 3929 + r_offset, 3930 + reloc_view + r_offset); 3892 3931 switch (r_type) 3893 3932 { 3894 3933 case elfcpp::R_X86_64_TLSGD: // General-dynamic ··· 3917 3956 break; 3918 3957 3919 3958 case elfcpp::R_X86_64_GOTPC32_TLSDESC: 3959 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 3920 3960 target->define_tls_base_symbol(symtab, layout); 3921 3961 if (optimized_type == tls::TLSOPT_NONE) 3922 3962 { ··· 3965 4005 break; 3966 4006 3967 4007 case elfcpp::R_X86_64_GOTTPOFF: // Initial-exec 4008 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 3968 4009 layout->set_has_static_tls(); 3969 4010 if (optimized_type == tls::TLSOPT_NONE) 3970 4011 { ··· 4560 4601 // These are initial tls relocs, which are expected when linking 4561 4602 case elfcpp::R_X86_64_TLSGD: // Global-dynamic 4562 4603 case elfcpp::R_X86_64_GOTPC32_TLSDESC: // Global-dynamic (from ~oliva url) 4604 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 4563 4605 case elfcpp::R_X86_64_TLSDESC_CALL: 4564 4606 case elfcpp::R_X86_64_TLSLD: // Local-dynamic 4565 4607 case elfcpp::R_X86_64_DTPOFF32: 4566 4608 case elfcpp::R_X86_64_DTPOFF64: 4567 4609 case elfcpp::R_X86_64_GOTTPOFF: // Initial-exec 4610 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 4568 4611 case elfcpp::R_X86_64_TPOFF32: // Local-exec 4569 4612 this->relocate_tls(relinfo, target, relnum, rela, r_type, gsym, psymval, 4570 4613 view, address, view_size); ··· 4636 4679 const bool is_final = (gsym == NULL 4637 4680 ? !parameters->options().shared() 4638 4681 : gsym->final_value_is_known()); 4682 + size_t r_offset = rela.get_r_offset(); 4639 4683 tls::Tls_optimization optimized_type 4640 - = Target_x86_64<size>::optimize_tls_reloc(is_final, r_type); 4684 + = Target_x86_64<size>::optimize_tls_reloc(is_final, r_type, 4685 + r_offset, view); 4641 4686 switch (r_type) 4642 4687 { 4643 4688 case elfcpp::R_X86_64_TLSGD: // Global-dynamic ··· 4704 4749 break; 4705 4750 4706 4751 case elfcpp::R_X86_64_GOTPC32_TLSDESC: // Global-dynamic (from ~oliva url) 4752 + case elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC: 4707 4753 case elfcpp::R_X86_64_TLSDESC_CALL: 4708 4754 if (!is_executable && optimized_type == tls::TLSOPT_TO_LE) 4709 4755 { ··· 4729 4775 ? GOT_TYPE_TLS_OFFSET 4730 4776 : GOT_TYPE_TLS_DESC); 4731 4777 unsigned int got_offset = 0; 4732 - if (r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC 4778 + if ((r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC 4779 + || r_type == elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC) 4733 4780 && optimized_type == tls::TLSOPT_NONE) 4734 4781 { 4735 4782 // We created GOT entries in the .got.tlsdesc portion of ··· 4760 4807 } 4761 4808 else if (optimized_type == tls::TLSOPT_NONE) 4762 4809 { 4763 - if (r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC) 4810 + if (r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC 4811 + || r_type == elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC) 4764 4812 { 4765 4813 // Relocate the field with the offset of the pair of GOT 4766 4814 // entries. ··· 4845 4893 break; 4846 4894 4847 4895 case elfcpp::R_X86_64_GOTTPOFF: // Initial-exec 4896 + case elfcpp::R_X86_64_CODE_4_GOTTPOFF: 4848 4897 if (gsym != NULL 4849 4898 && gsym->is_undefined() 4850 4899 && parameters->options().output_is_executable()) ··· 5051 5100 typename elfcpp::Elf_types<size>::Elf_Addr address, 5052 5101 section_size_type view_size) 5053 5102 { 5054 - if (r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC) 5103 + if (r_type == elfcpp::R_X86_64_GOTPC32_TLSDESC 5104 + || r_type == elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC) 5055 5105 { 5056 5106 // LP64: leaq foo@tlsdesc(%rip), %rax 5057 5107 // ==> movq foo@gottpoff(%rip), %rax ··· 5060 5110 tls::check_range(relinfo, relnum, rela.get_r_offset(), view_size, -3); 5061 5111 tls::check_range(relinfo, relnum, rela.get_r_offset(), view_size, 4); 5062 5112 tls::check_tls(relinfo, relnum, rela.get_r_offset(), 5063 - (((view[-3] & 0xfb) == 0x48 5113 + ((r_type == elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC 5114 + || (view[-3] & 0xfb) == 0x48 5064 5115 || (size == 32 && (view[-3] & 0xfb) == 0x40)) 5065 5116 && view[-2] == 0x8d 5066 5117 && (view[-1] & 0xc7) == 0x05)); ··· 5127 5178 && view[-2] == 0x8d 5128 5179 && (view[-1] & 0xc7) == 0x05)); 5129 5180 view[-3] = (view[-3] & 0x48) | ((view[-3] >> 2) & 1); 5181 + view[-2] = 0xc7; 5182 + view[-1] = 0xc0 | ((view[-1] >> 3) & 7); 5183 + value -= tls_segment->memsz(); 5184 + Relocate_functions<size, false>::rela32(view, value, 0); 5185 + } 5186 + else if (r_type == elfcpp::R_X86_64_CODE_4_GOTPC32_TLSDESC) 5187 + { 5188 + // REX2: lea foo@tlsdesc(%rip), %reg 5189 + // ==> mov foo@tpoff, %reg 5190 + tls::check_range(relinfo, relnum, rela.get_r_offset(), view_size, -3); 5191 + tls::check_range(relinfo, relnum, rela.get_r_offset(), view_size, 4); 5192 + tls::check_tls(relinfo, relnum, rela.get_r_offset(), 5193 + (view[-2] == 0x8d 5194 + && (view[-1] & 0xc7) == 0x05)); 5195 + unsigned char rex2_mask = 4 | 4 << 4; 5196 + view[-3] = (view[-3] & ~rex2_mask) | ((view[-3] & rex2_mask) >> 2); 5130 5197 view[-2] = 0xc7; 5131 5198 view[-1] = 0xc0 | ((view[-1] >> 3) & 7); 5132 5199 value -= tls_segment->memsz(); ··· 5231 5298 size_t relnum, 5232 5299 Output_segment* tls_segment, 5233 5300 const elfcpp::Rela<size, false>& rela, 5234 - unsigned int, 5301 + unsigned int r_type, 5235 5302 typename elfcpp::Elf_types<size>::Elf_Addr value, 5236 5303 unsigned char* view, 5237 5304 section_size_type view_size) ··· 5250 5317 unsigned char op3 = view[-1]; 5251 5318 unsigned char reg = op3 >> 3; 5252 5319 5253 - if (op2 == 0x8b) 5320 + if (r_type == elfcpp::R_X86_64_GOTTPOFF) 5254 5321 { 5255 - // movq 5256 - if (op1 == 0x4c) 5257 - view[-3] = 0x49; 5258 - else if (size == 32 && op1 == 0x44) 5259 - view[-3] = 0x41; 5260 - view[-2] = 0xc7; 5261 - view[-1] = 0xc0 | reg; 5262 - } 5263 - else if (reg == 4) 5264 - { 5265 - // Special handling for %rsp. 5266 - if (op1 == 0x4c) 5267 - view[-3] = 0x49; 5268 - else if (size == 32 && op1 == 0x44) 5269 - view[-3] = 0x41; 5270 - view[-2] = 0x81; 5271 - view[-1] = 0xc0 | reg; 5322 + if (op2 == 0x8b) 5323 + { 5324 + // movq 5325 + if (op1 == 0x4c) 5326 + view[-3] = 0x49; 5327 + else if (size == 32 && op1 == 0x44) 5328 + view[-3] = 0x41; 5329 + view[-2] = 0xc7; 5330 + view[-1] = 0xc0 | reg; 5331 + } 5332 + else if (reg == 4) 5333 + { 5334 + // Special handling for %rsp. 5335 + if (op1 == 0x4c) 5336 + view[-3] = 0x49; 5337 + else if (size == 32 && op1 == 0x44) 5338 + view[-3] = 0x41; 5339 + view[-2] = 0x81; 5340 + view[-1] = 0xc0 | reg; 5341 + } 5342 + else 5343 + { 5344 + // addq 5345 + if (op1 == 0x4c) 5346 + view[-3] = 0x4d; 5347 + else if (size == 32 && op1 == 0x44) 5348 + view[-3] = 0x45; 5349 + view[-2] = 0x8d; 5350 + view[-1] = 0x80 | reg | (reg << 3); 5351 + } 5272 5352 } 5273 5353 else 5274 5354 { 5275 - // addq 5276 - if (op1 == 0x4c) 5277 - view[-3] = 0x4d; 5278 - else if (size == 32 && op1 == 0x44) 5279 - view[-3] = 0x45; 5280 - view[-2] = 0x8d; 5281 - view[-1] = 0x80 | reg | (reg << 3); 5355 + if (op2 == 0x8b) 5356 + op2 = 0xc7; 5357 + else 5358 + op2 = 0x81; 5359 + 5360 + unsigned char rex2_mask = 4 | 4 << 4; 5361 + view[-3] = (view[-3] & ~rex2_mask) | ((view[-3] & rex2_mask) >> 2); 5362 + view[-2] = op2; 5363 + view[-1] = 0xc0 | reg; 5282 5364 } 5283 5365 5284 5366 if (tls_segment != NULL)
+11
gold/testsuite/Makefile.am
··· 1244 1244 x86_64_gd_to_le.stdout: x86_64_gd_to_le 1245 1245 $(TEST_OBJDUMP) -dw $< > $@ 1246 1246 1247 + check_SCRIPTS += x86_64_ie_to_le.sh 1248 + check_DATA += x86_64_ie_to_le.stdout 1249 + MOSTLYCLEANFILES += x86_64_ie_to_le 1250 + 1251 + x86_64_ie_to_le.o: x86_64_ie_to_le.s 1252 + $(TEST_AS) --64 -o $@ $< 1253 + x86_64_ie_to_le: x86_64_ie_to_le.o gcctestdir/ld 1254 + gcctestdir/ld -o $@ $< 1255 + x86_64_ie_to_le.stdout: x86_64_ie_to_le 1256 + $(TEST_OBJDUMP) -dw $< > $@ 1257 + 1247 1258 check_SCRIPTS += x86_64_overflow_pc32.sh 1248 1259 check_DATA += x86_64_overflow_pc32.err 1249 1260 MOSTLYCLEANFILES += x86_64_overflow_pc32.err
+17
gold/testsuite/Makefile.in
··· 296 296 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_31 = x86_64_mov_to_lea.sh \ 297 297 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_indirect_call_to_direct.sh \ 298 298 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_gd_to_le.sh \ 299 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_ie_to_le.sh \ 299 300 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_overflow_pc32.sh \ 300 301 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x32_overflow_pc32.sh \ 301 302 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr23016_1.sh \ ··· 319 320 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_indirect_call_to_direct1.stdout \ 320 321 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_indirect_jump_to_direct1.stdout \ 321 322 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_gd_to_le.stdout \ 323 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_ie_to_le.stdout \ 322 324 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_overflow_pc32.err \ 323 325 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x32_overflow_pc32.err \ 324 326 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr23016_1.stdout \ ··· 343 345 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_indirect_call_to_direct1 \ 344 346 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_indirect_jump_to_direct1 \ 345 347 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_gd_to_le \ 348 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_ie_to_le \ 346 349 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x86_64_overflow_pc32.err \ 347 350 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ x32_overflow_pc32.err 348 351 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_34 = pr17704a_test ··· 5747 5750 --log-file $$b.log --trs-file $$b.trs \ 5748 5751 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 5749 5752 "$$tst" $(AM_TESTS_FD_REDIRECT) 5753 + x86_64_ie_to_le.sh.log: x86_64_ie_to_le.sh 5754 + @p='x86_64_ie_to_le.sh'; \ 5755 + b='x86_64_ie_to_le.sh'; \ 5756 + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ 5757 + --log-file $$b.log --trs-file $$b.trs \ 5758 + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 5759 + "$$tst" $(AM_TESTS_FD_REDIRECT) 5750 5760 x86_64_overflow_pc32.sh.log: x86_64_overflow_pc32.sh 5751 5761 @p='x86_64_overflow_pc32.sh'; \ 5752 5762 b='x86_64_overflow_pc32.sh'; \ ··· 8484 8494 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_gd_to_le: x86_64_gd_to_le.o gcctestdir/ld 8485 8495 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -o $@ $< 8486 8496 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_gd_to_le.stdout: x86_64_gd_to_le 8497 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_OBJDUMP) -dw $< > $@ 8498 + 8499 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_ie_to_le.o: x86_64_ie_to_le.s 8500 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AS) --64 -o $@ $< 8501 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_ie_to_le: x86_64_ie_to_le.o gcctestdir/ld 8502 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -o $@ $< 8503 + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_ie_to_le.stdout: x86_64_ie_to_le 8487 8504 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_OBJDUMP) -dw $< > $@ 8488 8505 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@x86_64_overflow_pc32.o: x86_64_overflow_pc32.s 8489 8506 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AS) -o $@ $<
+1
gold/testsuite/x86_64_gd_to_le.s
··· 7 7 subq $8, %rsp 8 8 .cfi_def_cfa_offset 16 9 9 leaq foo@TLSDESC(%rip), %r9 10 + leaq foo@TLSDESC(%rip), %r29 10 11 movq %r9, %rax 11 12 call *foo@TLSCALL(%rax) 12 13 addq %fs:0, %rax
+1
gold/testsuite/x86_64_gd_to_le.sh
··· 24 24 set -e 25 25 26 26 grep -q "mov[ \t]\+\$0x[a-f0-9]\+,%r9" x86_64_gd_to_le.stdout 27 + grep -q "mov[ \t]\+\$0x[a-f0-9]\+,%r29" x86_64_gd_to_le.stdout
+17
gold/testsuite/x86_64_ie_to_le.s
··· 1 + .text 2 + .p2align 4 3 + .globl _start 4 + .type _start, @function 5 + _start: 6 + addq foo@gottpoff(%rip), %r12 7 + movq foo@gottpoff(%rip), %rax 8 + addq foo@gottpoff(%rip), %r16 9 + movq foo@gottpoff(%rip), %r20 10 + .size _start, .-_start 11 + .section .tdata,"awT",@progbits 12 + .align 4 13 + .type foo, @object 14 + .size foo, 4 15 + foo: 16 + .long 30 17 + .section .note.GNU-stack,"",@progbits
+29
gold/testsuite/x86_64_ie_to_le.sh
··· 1 + #!/bin/sh 2 + 3 + # x86_64_ie_to_le.sh -- a test for IE -> LE conversion. 4 + 5 + # Copyright (C) 2023 Free Software Foundation, Inc. 6 + 7 + # This file is part of gold. 8 + 9 + # This program is free software; you can redistribute it and/or modify 10 + # it under the terms of the GNU General Public License as published by 11 + # the Free Software Foundation; either version 3 of the License, or 12 + # (at your option) any later version. 13 + 14 + # This program is distributed in the hope that it will be useful, 15 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 + # GNU General Public License for more details. 18 + 19 + # You should have received a copy of the GNU General Public License 20 + # along with this program; if not, write to the Free Software 21 + # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 22 + # MA 02110-1301, USA. 23 + 24 + set -e 25 + 26 + grep -q "add[ \t]\+\$0x[a-f0-9]\+,%r12" x86_64_ie_to_le.stdout 27 + grep -q "mov[ \t]\+\$0x[a-f0-9]\+,%rax" x86_64_ie_to_le.stdout 28 + grep -q "add[ \t]\+\$0x[a-f0-9]\+,%r16" x86_64_ie_to_le.stdout 29 + grep -q "mov[ \t]\+\$0x[a-f0-9]\+,%r20" x86_64_ie_to_le.stdout