Skip to content

Commit a533c8d

Browse files
committed
x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC
For add name@gottpoff(%rip), %reg mov name@gottpoff(%rip), %reg add # define R_X86_64_CODE_4_GOTTPOFF 44 and for lea name@tlsdesc(%rip), %reg add # define R_X86_64_CODE_4_GOTPC32_TLSDESC 45 if the instruction starts at 4 bytes before the relocation offset. They are similar to R_X86_64_GOTTPOFF and R_X86_64_GOTPC32_TLSDESC, respectively. Linker can covert GOTTPOFF to add $name@tpoff, %reg mov $name@tpoff, %reg and GOTPC32_TLSDESC to mov $name@tpoff, %reg mov name@gottpoff(%rip), %reg if the instruction is encoded with the REX2 prefix when possible. bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC. (R_X86_64_standard): Updated. (x86_64_reloc_map): Add BFD_RELOC_X86_64_CODE_4_GOTTPOFF and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC. (elf_x86_64_check_tls_transition): Handle R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_scan_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_CODE_4_GOTTPOFF and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. gas/ * config/tc-i386.c (tc_i386_fix_adjustable): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC. (md_assemble): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF. (output_insn): Don't add empty REX prefix with REX2 prefix. (output_disp): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC. (md_apply_fix): Likewise. (i386_validate_fix): Generate BFD_RELOC_X86_64_CODE_4_GOTTPOFF or BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC if ixp->fx_tcbit3 is set. (tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC. * testsuite/gas/i386/x86-64-gottpoff.d: New file. * testsuite/gas/i386/x86-64-gottpoff.s: Likewise. * testsuite/gas/i386/x86-64-tlsdesc.d: Likewise. * testsuite/gas/i386/x86-64-tlsdesc.s: Likewise. include/ * elf/x86-64.h (elf_x86_64_reloc_type): Add R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC ld/ * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise. * testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC tests.
1 parent 4a54cb0 commit a533c8d

File tree

14 files changed

+329
-21
lines changed

14 files changed

+329
-21
lines changed

bfd/bfd-in2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3892,6 +3892,8 @@ enum bfd_reloc_code_real
38923892
BFD_RELOC_X86_64_GOTPCRELX,
38933893
BFD_RELOC_X86_64_REX_GOTPCRELX,
38943894
BFD_RELOC_X86_64_CODE_4_GOTPCRELX,
3895+
BFD_RELOC_X86_64_CODE_4_GOTTPOFF,
3896+
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC,
38953897

38963898
/* ns32k relocations. */
38973899
BFD_RELOC_NS32K_IMM_8,

bfd/elf64-x86-64.c

Lines changed: 122 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,18 @@ static reloc_howto_type x86_64_elf_howto_table[] =
173173
HOWTO(R_X86_64_CODE_4_GOTPCRELX, 0, 4, 32, true, 0, complain_overflow_signed,
174174
bfd_elf_generic_reloc, "R_X86_64_CODE_4_GOTPCRELX", false, 0, 0xffffffff,
175175
true),
176+
HOWTO(R_X86_64_CODE_4_GOTTPOFF, 0, 4, 32, true, 0, complain_overflow_signed,
177+
bfd_elf_generic_reloc, "R_X86_64_CODE_4_GOTTPOFF", false, 0, 0xffffffff,
178+
true),
179+
HOWTO(R_X86_64_CODE_4_GOTPC32_TLSDESC, 0, 4, 32, true, 0,
180+
complain_overflow_bitfield, bfd_elf_generic_reloc,
181+
"R_X86_64_CODE_4_GOTPC32_TLSDESC", false, 0, 0xffffffff, true),
176182

177183
/* We have a gap in the reloc numbers here.
178184
R_X86_64_standard counts the number up to this point, and
179185
R_X86_64_vt_offset is the value to subtract from a reloc type of
180186
R_X86_64_GNU_VT* to form an index into this table. */
181-
#define R_X86_64_standard (R_X86_64_CODE_4_GOTPCRELX + 1)
187+
#define R_X86_64_standard (R_X86_64_CODE_4_GOTPC32_TLSDESC + 1)
182188
#define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard)
183189

184190
/* GNU extension to record C++ vtable hierarchy. */
@@ -248,6 +254,8 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
248254
{ BFD_RELOC_X86_64_GOTPCRELX, R_X86_64_GOTPCRELX, },
249255
{ BFD_RELOC_X86_64_REX_GOTPCRELX, R_X86_64_REX_GOTPCRELX, },
250256
{ BFD_RELOC_X86_64_CODE_4_GOTPCRELX, R_X86_64_CODE_4_GOTPCRELX, },
257+
{ BFD_RELOC_X86_64_CODE_4_GOTTPOFF, R_X86_64_CODE_4_GOTTPOFF, },
258+
{ BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC, R_X86_64_CODE_4_GOTPC32_TLSDESC, },
251259
{ BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, },
252260
{ BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
253261
};
@@ -1262,6 +1270,19 @@ elf_x86_64_check_tls_transition (bfd *abfd,
12621270
return (r_type == R_X86_64_PC32 || r_type == R_X86_64_PLT32);
12631271
}
12641272

1273+
case R_X86_64_CODE_4_GOTTPOFF:
1274+
/* Check transition from IE access model:
1275+
mov foo@gottpoff(%rip), %reg
1276+
add foo@gottpoff(%rip), %reg
1277+
where reg is one of r16 to r31. */
1278+
1279+
if (offset < 4
1280+
|| (offset + 4) > sec->size
1281+
|| contents[offset - 4] != 0xd5)
1282+
return false;
1283+
1284+
goto check_gottpoff;
1285+
12651286
case R_X86_64_GOTTPOFF:
12661287
/* Check transition from IE access model:
12671288
mov foo@gottpoff(%rip), %reg
@@ -1288,13 +1309,26 @@ elf_x86_64_check_tls_transition (bfd *abfd,
12881309
return false;
12891310
}
12901311

1312+
check_gottpoff:
12911313
val = bfd_get_8 (abfd, contents + offset - 2);
12921314
if (val != 0x8b && val != 0x03)
12931315
return false;
12941316

12951317
val = bfd_get_8 (abfd, contents + offset - 1);
12961318
return (val & 0xc7) == 5;
12971319

1320+
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
1321+
/* Check transition from GDesc access model:
1322+
lea x@tlsdesc(%rip), %reg
1323+
where reg is one of r16 to r31. */
1324+
1325+
if (offset < 4
1326+
|| (offset + 4) > sec->size
1327+
|| contents[offset - 4] != 0xd5)
1328+
return false;
1329+
1330+
goto check_tlsdesc;
1331+
12981332
case R_X86_64_GOTPC32_TLSDESC:
12991333
/* Check transition from GDesc access model:
13001334
leaq x@tlsdesc(%rip), %rax <--- LP64 mode.
@@ -1312,6 +1346,7 @@ elf_x86_64_check_tls_transition (bfd *abfd,
13121346
if (val != 0x48 && (ABI_64_P (abfd) || val != 0x40))
13131347
return false;
13141348

1349+
check_tlsdesc:
13151350
if (bfd_get_8 (abfd, contents + offset - 2) != 0x8d)
13161351
return false;
13171352

@@ -1378,8 +1413,10 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
13781413
{
13791414
case R_X86_64_TLSGD:
13801415
case R_X86_64_GOTPC32_TLSDESC:
1416+
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
13811417
case R_X86_64_TLSDESC_CALL:
13821418
case R_X86_64_GOTTPOFF:
1419+
case R_X86_64_CODE_4_GOTTPOFF:
13831420
if (bfd_link_executable (info))
13841421
{
13851422
if (h == NULL)
@@ -1399,6 +1436,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
13991436

14001437
if (to_type == R_X86_64_TLSGD
14011438
|| to_type == R_X86_64_GOTPC32_TLSDESC
1439+
|| to_type == R_X86_64_CODE_4_GOTPC32_TLSDESC
14021440
|| to_type == R_X86_64_TLSDESC_CALL)
14031441
{
14041442
if (tls_type == GOT_TLS_IE)
@@ -1424,7 +1462,9 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
14241462
}
14251463

14261464
/* Return TRUE if there is no transition. */
1427-
if (from_type == to_type)
1465+
if (from_type == to_type
1466+
|| (from_type == R_X86_64_CODE_4_GOTTPOFF
1467+
&& to_type == R_X86_64_GOTTPOFF))
14281468
return true;
14291469

14301470
/* Check if the transition can be performed. */
@@ -2132,6 +2172,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
21322172
break;
21332173

21342174
case R_X86_64_GOTTPOFF:
2175+
case R_X86_64_CODE_4_GOTTPOFF:
21352176
if (!bfd_link_executable (info))
21362177
info->flags |= DF_STATIC_TLS;
21372178
/* Fall through */
@@ -2146,6 +2187,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
21462187
case R_X86_64_GOTPCREL64:
21472188
case R_X86_64_GOTPLT64:
21482189
case R_X86_64_GOTPC32_TLSDESC:
2190+
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
21492191
case R_X86_64_TLSDESC_CALL:
21502192
/* This symbol requires a global offset table entry. */
21512193
{
@@ -2167,9 +2209,11 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
21672209
tls_type = GOT_TLS_GD;
21682210
break;
21692211
case R_X86_64_GOTTPOFF:
2212+
case R_X86_64_CODE_4_GOTTPOFF:
21702213
tls_type = GOT_TLS_IE;
21712214
break;
21722215
case R_X86_64_GOTPC32_TLSDESC:
2216+
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
21732217
case R_X86_64_TLSDESC_CALL:
21742218
tls_type = GOT_TLS_GDESC;
21752219
break;
@@ -3518,8 +3562,10 @@ elf_x86_64_relocate_section (bfd *output_bfd,
35183562

35193563
case R_X86_64_TLSGD:
35203564
case R_X86_64_GOTPC32_TLSDESC:
3565+
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
35213566
case R_X86_64_TLSDESC_CALL:
35223567
case R_X86_64_GOTTPOFF:
3568+
case R_X86_64_CODE_4_GOTTPOFF:
35233569
tls_type = GOT_UNKNOWN;
35243570
if (h == NULL && local_got_offsets)
35253571
tls_type = elf_x86_local_got_tls_type (input_bfd) [r_symndx];
@@ -3660,6 +3706,37 @@ elf_x86_64_relocate_section (bfd *output_bfd,
36603706
contents + roff);
36613707
continue;
36623708
}
3709+
else if (r_type == R_X86_64_CODE_4_GOTPC32_TLSDESC)
3710+
{
3711+
/* GDesc -> LE transition.
3712+
It's originally something like:
3713+
lea x@tlsdesc(%rip), %reg
3714+
3715+
Change it to:
3716+
mov $x@tpoff, %reg
3717+
where reg is one of r16 to r31. */
3718+
3719+
unsigned int val, rex2;
3720+
unsigned int rex2_mask = REX_R | REX_R << 4;
3721+
3722+
if (roff < 4)
3723+
goto corrupt_input;
3724+
rex2 = bfd_get_8 (input_bfd, contents + roff - 3);
3725+
val = bfd_get_8 (input_bfd, contents + roff - 1);
3726+
/* Move the R bits to the B bits in REX2 payload
3727+
byte. */
3728+
bfd_put_8 (output_bfd,
3729+
((rex2 & ~rex2_mask)
3730+
| (rex2 & rex2_mask) >> 2),
3731+
contents + roff - 3);
3732+
bfd_put_8 (output_bfd, 0xc7, contents + roff - 2);
3733+
bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
3734+
contents + roff - 1);
3735+
bfd_put_32 (output_bfd,
3736+
elf_x86_64_tpoff (info, relocation),
3737+
contents + roff);
3738+
continue;
3739+
}
36633740
else if (r_type == R_X86_64_TLSDESC_CALL)
36643741
{
36653742
/* GDesc -> LE transition.
@@ -3799,6 +3876,46 @@ elf_x86_64_relocate_section (bfd *output_bfd,
37993876
contents + roff);
38003877
continue;
38013878
}
3879+
else if (r_type == R_X86_64_CODE_4_GOTTPOFF)
3880+
{
3881+
/* IE->LE transition:
3882+
Originally it can be one of:
3883+
mov foo@gottpoff(%rip), %reg
3884+
add foo@gottpoff(%rip), %reg
3885+
We change it into:
3886+
mov $foo@tpoff, %reg
3887+
add $foo@tpoff, %reg
3888+
where reg is one of r16 to r31. */
3889+
3890+
unsigned int rex2, type, reg;
3891+
unsigned int rex2_mask = REX_R | REX_R << 4;
3892+
3893+
if (roff < 4)
3894+
goto corrupt_input;
3895+
3896+
rex2 = bfd_get_8 (input_bfd, contents + roff - 3);
3897+
type = bfd_get_8 (input_bfd, contents + roff - 2);
3898+
reg = bfd_get_8 (input_bfd, contents + roff - 1);
3899+
reg >>= 3;
3900+
/* Move the R bits to the B bits in REX2 payload
3901+
byte. */
3902+
if (type == 0x8b)
3903+
type = 0xc7;
3904+
else
3905+
type = 0x81;
3906+
bfd_put_8 (output_bfd,
3907+
((rex2 & ~rex2_mask)
3908+
| (rex2 & rex2_mask) >> 2),
3909+
contents + roff - 3);
3910+
bfd_put_8 (output_bfd, type,
3911+
contents + roff - 2);
3912+
bfd_put_8 (output_bfd, 0xc0 | reg,
3913+
contents + roff - 1);
3914+
bfd_put_32 (output_bfd,
3915+
elf_x86_64_tpoff (info, relocation),
3916+
contents + roff);
3917+
continue;
3918+
}
38023919
else
38033920
BFD_ASSERT (false);
38043921
}
@@ -3905,6 +4022,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
39054022
if (r_type_tls == r_type)
39064023
{
39074024
if (r_type == R_X86_64_GOTPC32_TLSDESC
4025+
|| r_type == R_X86_64_CODE_4_GOTPC32_TLSDESC
39084026
|| r_type == R_X86_64_TLSDESC_CALL)
39094027
relocation = htab->elf.sgotplt->output_section->vma
39104028
+ htab->elf.sgotplt->output_offset
@@ -4000,7 +4118,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
40004118
wrel++;
40014119
continue;
40024120
}
4003-
else if (r_type == R_X86_64_GOTPC32_TLSDESC)
4121+
else if (r_type == R_X86_64_GOTPC32_TLSDESC
4122+
|| r_type == R_X86_64_CODE_4_GOTPC32_TLSDESC)
40044123
{
40054124
/* GDesc -> IE transition.
40064125
It's originally something like:

bfd/libbfd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
14611461
"BFD_RELOC_X86_64_GOTPCRELX",
14621462
"BFD_RELOC_X86_64_REX_GOTPCRELX",
14631463
"BFD_RELOC_X86_64_CODE_4_GOTPCRELX",
1464+
"BFD_RELOC_X86_64_CODE_4_GOTTPOFF",
1465+
"BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC",
14641466
"BFD_RELOC_NS32K_IMM_8",
14651467
"BFD_RELOC_NS32K_IMM_16",
14661468
"BFD_RELOC_NS32K_IMM_32",

bfd/reloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,6 +2477,10 @@ ENUMX
24772477
BFD_RELOC_X86_64_REX_GOTPCRELX
24782478
ENUMX
24792479
BFD_RELOC_X86_64_CODE_4_GOTPCRELX
2480+
ENUMX
2481+
BFD_RELOC_X86_64_CODE_4_GOTTPOFF
2482+
ENUMX
2483+
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC
24802484
ENUMDOC
24812485
x86-64/elf relocations.
24822486

gas/config/tc-i386.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,10 +3601,12 @@ tc_i386_fix_adjustable (fixS *fixP)
36013601
|| fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF32
36023602
|| fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF64
36033603
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTTPOFF
3604+
|| fixP->fx_r_type == BFD_RELOC_X86_64_CODE_4_GOTTPOFF
36043605
|| fixP->fx_r_type == BFD_RELOC_X86_64_TPOFF32
36053606
|| fixP->fx_r_type == BFD_RELOC_X86_64_TPOFF64
36063607
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTOFF64
36073608
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTPC32_TLSDESC
3609+
|| fixP->fx_r_type == BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC
36083610
|| fixP->fx_r_type == BFD_RELOC_X86_64_TLSDESC_CALL
36093611
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
36103612
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
@@ -5632,6 +5634,7 @@ md_assemble (char *line)
56325634
case BFD_RELOC_386_TLS_GOTIE:
56335635
case BFD_RELOC_386_TLS_LE_32:
56345636
case BFD_RELOC_X86_64_GOTTPOFF:
5637+
case BFD_RELOC_X86_64_CODE_4_GOTTPOFF:
56355638
case BFD_RELOC_X86_64_TLSLD:
56365639
as_bad (_("TLS relocation cannot be used with `%s'"), insn_name (&i.tm));
56375640
return;
@@ -10477,6 +10480,7 @@ output_insn (const struct last_insn *last_insn)
1047710480
is also needed for lea with R_X86_64_GOTPC32_TLSDESC
1047810481
relocation for GDesc -> IE/LE optimization. */
1047910482
if (x86_elf_abi == X86_64_X32_ABI
10483+
&& !is_apx_rex2_encoding ()
1048010484
&& i.operands == 2
1048110485
&& (i.reloc[0] == BFD_RELOC_X86_64_GOTTPOFF
1048210486
|| i.reloc[0] == BFD_RELOC_X86_64_GOTPC32_TLSDESC)
@@ -10842,7 +10846,9 @@ output_disp (fragS *insn_start_frag, offsetT insn_start_off)
1084210846
case BFD_RELOC_X86_64_TLSGD:
1084310847
case BFD_RELOC_X86_64_TLSLD:
1084410848
case BFD_RELOC_X86_64_GOTTPOFF:
10849+
case BFD_RELOC_X86_64_CODE_4_GOTTPOFF:
1084510850
case BFD_RELOC_X86_64_GOTPC32_TLSDESC:
10851+
case BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC:
1084610852
case BFD_RELOC_X86_64_TLSDESC_CALL:
1084710853
i.has_gotpc_tls_reloc = true;
1084810854
default:
@@ -14356,7 +14362,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
1435614362
case BFD_RELOC_X86_64_TLSGD:
1435714363
case BFD_RELOC_X86_64_TLSLD:
1435814364
case BFD_RELOC_X86_64_GOTTPOFF:
14365+
case BFD_RELOC_X86_64_CODE_4_GOTTPOFF:
1435914366
case BFD_RELOC_X86_64_GOTPC32_TLSDESC:
14367+
case BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC:
1436014368
value = 0; /* Fully resolved at runtime. No addend. */
1436114369
/* Fallthrough */
1436214370
case BFD_RELOC_386_TLS_LE:
@@ -15929,6 +15937,14 @@ i386_validate_fix (fixS *fixp)
1592915937
return IS_ELF && fixp->fx_addsy
1593015938
&& (!S_IS_DEFINED (fixp->fx_addsy)
1593115939
|| S_IS_EXTERNAL (fixp->fx_addsy));
15940+
15941+
if (fixp->fx_tcbit3)
15942+
{
15943+
if (fixp->fx_r_type == BFD_RELOC_X86_64_GOTTPOFF)
15944+
fixp->fx_r_type = BFD_RELOC_X86_64_CODE_4_GOTTPOFF;
15945+
else if (fixp->fx_r_type == BFD_RELOC_X86_64_GOTPC32_TLSDESC)
15946+
fixp->fx_r_type = BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC;
15947+
}
1593215948
#endif
1593315949

1593415950
if (fixp->fx_subsy)
@@ -16073,6 +16089,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
1607316089
case BFD_RELOC_X86_64_DTPOFF32:
1607416090
case BFD_RELOC_X86_64_DTPOFF64:
1607516091
case BFD_RELOC_X86_64_GOTTPOFF:
16092+
case BFD_RELOC_X86_64_CODE_4_GOTTPOFF:
1607616093
case BFD_RELOC_X86_64_TPOFF32:
1607716094
case BFD_RELOC_X86_64_TPOFF64:
1607816095
case BFD_RELOC_X86_64_GOTOFF64:
@@ -16083,6 +16100,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
1608316100
case BFD_RELOC_X86_64_GOTPLT64:
1608416101
case BFD_RELOC_X86_64_PLTOFF64:
1608516102
case BFD_RELOC_X86_64_GOTPC32_TLSDESC:
16103+
case BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC:
1608616104
case BFD_RELOC_X86_64_TLSDESC_CALL:
1608716105
case BFD_RELOC_RVA:
1608816106
case BFD_RELOC_VTABLE_ENTRY:
@@ -16215,7 +16233,9 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
1621516233
case BFD_RELOC_X86_64_TLSGD:
1621616234
case BFD_RELOC_X86_64_TLSLD:
1621716235
case BFD_RELOC_X86_64_GOTTPOFF:
16236+
case BFD_RELOC_X86_64_CODE_4_GOTTPOFF:
1621816237
case BFD_RELOC_X86_64_GOTPC32_TLSDESC:
16238+
case BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC:
1621916239
case BFD_RELOC_X86_64_TLSDESC_CALL:
1622016240
rel->addend = fixp->fx_offset - fixp->fx_size;
1622116241
break;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#as:
2+
#objdump: -dwr
3+
#name: x86-64 gottpoff
4+
5+
.*: +file format .*
6+
7+
8+
Disassembly of section .text:
9+
10+
0+ <_start>:
11+
+[a-f0-9]+: 48 03 05 00 00 00 00 add 0x0\(%rip\),%rax # 7 <_start\+0x7> 3: R_X86_64_GOTTPOFF foo-0x4
12+
+[a-f0-9]+: 48 8b 05 00 00 00 00 mov 0x0\(%rip\),%rax # e <_start\+0xe> a: R_X86_64_GOTTPOFF foo-0x4
13+
+[a-f0-9]+: d5 48 03 05 00 00 00 00 add 0x0\(%rip\),%r16 # 16 <_start\+0x16> 12: R_X86_64_CODE_4_GOTTPOFF foo-0x4
14+
+[a-f0-9]+: d5 48 8b 25 00 00 00 00 mov 0x0\(%rip\),%r20 # 1e <_start\+0x1e> 1a: R_X86_64_CODE_4_GOTTPOFF foo-0x4
15+
+[a-f0-9]+: 48 03 05 00 00 00 00 add 0x0\(%rip\),%rax # 25 <_start\+0x25> 21: R_X86_64_GOTTPOFF foo-0x4
16+
+[a-f0-9]+: 48 8b 05 00 00 00 00 mov 0x0\(%rip\),%rax # 2c <_start\+0x2c> 28: R_X86_64_GOTTPOFF foo-0x4
17+
+[a-f0-9]+: d5 48 03 05 00 00 00 00 add 0x0\(%rip\),%r16 # 34 <_start\+0x34> 30: R_X86_64_CODE_4_GOTTPOFF foo-0x4
18+
+[a-f0-9]+: d5 48 8b 25 00 00 00 00 mov 0x0\(%rip\),%r20 # 3c <_start\+0x3c> 38: R_X86_64_CODE_4_GOTTPOFF foo-0x4
19+
#pass

0 commit comments

Comments
 (0)