加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LoongArch-Add-support-for-TLS-LD-GD-DESC-relaxation.patch 62.27 KB
一键复制 编辑 原始数据 按行查看 历史
油屋 提交于 2024-10-31 14:15 . backport master to 2.41
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611
From b71b59b2ff4e169cbed791a1738ba7ac40e1ed49 Mon Sep 17 00:00:00 2001
From: mengqinggang <mengqinggang@loongson.cn>
Date: Mon, 11 Dec 2023 16:08:20 +0800
Subject: [PATCH 028/123] LoongArch: Add support for TLS LD/GD/DESC relaxation
The pcalau12i + addi.d of TLS LD/GD/DESC relax to pcaddi.
Relaxation is only performed when the TLS model transition is not possible.
---
bfd/bfd-in2.h | 3 +
bfd/elfnn-loongarch.c | 174 +++++++-
bfd/elfxx-loongarch.c | 60 +++
bfd/libbfd.h | 3 +
bfd/reloc.c | 7 +
gas/config/tc-loongarch.c | 8 +-
gas/testsuite/gas/loongarch/macro_op.d | 128 +++---
gas/testsuite/gas/loongarch/macro_op_32.d | 120 +++---
.../gas/loongarch/macro_op_large_abs.d | 160 +++----
.../gas/loongarch/macro_op_large_pc.d | 160 +++----
include/elf/loongarch.h | 4 +
ld/testsuite/ld-loongarch-elf/macro_op.d | 391 +++++++++---------
ld/testsuite/ld-loongarch-elf/macro_op_32.d | 120 +++---
13 files changed, 795 insertions(+), 543 deletions(-)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index d210e71b..d7b762d4 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7356,6 +7356,9 @@ assembler and not (currently) written to any object files. */
BFD_RELOC_LARCH_TLS_DESC64_HI12,
BFD_RELOC_LARCH_TLS_DESC_LD,
BFD_RELOC_LARCH_TLS_DESC_CALL,
+ BFD_RELOC_LARCH_TLS_LD_PCREL20_S2,
+ BFD_RELOC_LARCH_TLS_GD_PCREL20_S2,
+ BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2,
BFD_RELOC_UNUSED
};
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 13fddd63..d46bcd77 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -2285,7 +2285,9 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section,
case R_LARCH_TLS_DESC_LO12:
case R_LARCH_TLS_DESC64_LO20:
case R_LARCH_TLS_DESC64_HI12:
-
+ case R_LARCH_TLS_LD_PCREL20_S2:
+ case R_LARCH_TLS_GD_PCREL20_S2:
+ case R_LARCH_TLS_DESC_PCREL20_S2:
r = loongarch_check_offset (rel, input_section);
if (r != bfd_reloc_ok)
break;
@@ -3667,6 +3669,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_LARCH_TLS_GD_HI20:
case R_LARCH_TLS_DESC_PC_HI20:
case R_LARCH_TLS_DESC_HI20:
+ case R_LARCH_TLS_LD_PCREL20_S2:
+ case R_LARCH_TLS_GD_PCREL20_S2:
+ case R_LARCH_TLS_DESC_PCREL20_S2:
BFD_ASSERT (rel->r_addend == 0);
unresolved_reloc = false;
@@ -3675,7 +3680,8 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
is_ie = true;
if (r_type == R_LARCH_TLS_DESC_PC_HI20
- || r_type == R_LARCH_TLS_DESC_HI20)
+ || r_type == R_LARCH_TLS_DESC_HI20
+ || r_type == R_LARCH_TLS_DESC_PCREL20_S2)
is_desc = true;
bfd_vma got_off = 0;
@@ -3806,7 +3812,11 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| r_type == R_LARCH_TLS_IE_PC_HI20
|| r_type == R_LARCH_TLS_DESC_PC_HI20)
RELOCATE_CALC_PC32_HI20 (relocation, pc);
-
+ else if (r_type == R_LARCH_TLS_LD_PCREL20_S2
+ || r_type == R_LARCH_TLS_GD_PCREL20_S2
+ || r_type == R_LARCH_TLS_DESC_PCREL20_S2)
+ relocation -= pc;
+ /* else {} ABS relocations. */
break;
case R_LARCH_TLS_DESC_PC_LO12:
@@ -4237,6 +4247,85 @@ loongarch_relax_align (bfd *abfd, asection *sec,
addend - need_nop_bytes, link_info);
}
+/* Relax pcalau12i + addi.d of TLS LD/GD/DESC to pcaddi. */
+static bool
+loongarch_relax_tls_ld_gd_desc (bfd *abfd, asection *sec, asection *sym_sec,
+ Elf_Internal_Rela *rel_hi, bfd_vma symval,
+ struct bfd_link_info *info, bool *again)
+{
+ bfd_byte *contents = elf_section_data (sec)->this_hdr.contents;
+ Elf_Internal_Rela *rel_lo = rel_hi + 2;
+ uint32_t pca = bfd_get (32, abfd, contents + rel_hi->r_offset);
+ uint32_t add = bfd_get (32, abfd, contents + rel_lo->r_offset);
+ uint32_t rd = pca & 0x1f;
+
+ /* This section's output_offset need to subtract the bytes of instructions
+ relaxed by the previous sections, so it needs to be updated beforehand.
+ size_input_section already took care of updating it after relaxation,
+ so we additionally update once here. */
+ sec->output_offset = sec->output_section->size;
+ bfd_vma pc = sec_addr (sec) + rel_hi->r_offset;
+
+ /* If pc and symbol not in the same segment, add/sub segment alignment.
+ FIXME: if there are multiple readonly segments? */
+ if (!(sym_sec->flags & SEC_READONLY))
+ {
+ if (symval > pc)
+ pc -= info->maxpagesize;
+ else if (symval < pc)
+ pc += info->maxpagesize;
+ }
+
+ const uint32_t addi_d = 0x02c00000;
+ const uint32_t pcaddi = 0x18000000;
+
+ /* Is pcalau12i + addi.d insns? */
+ if ((ELFNN_R_TYPE (rel_lo->r_info) != R_LARCH_GOT_PC_LO12
+ && ELFNN_R_TYPE (rel_lo->r_info) != R_LARCH_TLS_DESC_PC_LO12)
+ || (ELFNN_R_TYPE ((rel_lo + 1)->r_info) != R_LARCH_RELAX)
+ || (ELFNN_R_TYPE ((rel_hi + 1)->r_info) != R_LARCH_RELAX)
+ || (rel_hi->r_offset + 4 != rel_lo->r_offset)
+ || ((add & addi_d) != addi_d)
+ /* Is pcalau12i $rd + addi.d $rd,$rd? */
+ || ((add & 0x1f) != rd)
+ || (((add >> 5) & 0x1f) != rd)
+ /* Can be relaxed to pcaddi? */
+ || (symval & 0x3) /* 4 bytes align. */
+ || ((bfd_signed_vma)(symval - pc) < (bfd_signed_vma)(int32_t)0xffe00000)
+ || ((bfd_signed_vma)(symval - pc) > (bfd_signed_vma)(int32_t)0x1ffffc))
+ return false;
+
+ /* Continue next relax trip. */
+ *again = true;
+
+ pca = pcaddi | rd;
+ bfd_put (32, abfd, pca, contents + rel_hi->r_offset);
+
+ /* Adjust relocations. */
+ switch (ELFNN_R_TYPE (rel_hi->r_info))
+ {
+ case R_LARCH_TLS_LD_PC_HI20:
+ rel_hi->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info),
+ R_LARCH_TLS_LD_PCREL20_S2);
+ break;
+ case R_LARCH_TLS_GD_PC_HI20:
+ rel_hi->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info),
+ R_LARCH_TLS_GD_PCREL20_S2);
+ break;
+ case R_LARCH_TLS_DESC_PC_HI20:
+ rel_hi->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info),
+ R_LARCH_TLS_DESC_PCREL20_S2);
+ break;
+ default:
+ break;
+ }
+ rel_lo->r_info = ELFNN_R_INFO (0, R_LARCH_NONE);
+
+ loongarch_relax_delete_bytes (abfd, sec, rel_lo->r_offset, 4, info);
+
+ return true;
+}
+
static bool
loongarch_elf_relax_section (bfd *abfd, asection *sec,
struct bfd_link_info *info,
@@ -4281,15 +4370,23 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
for (unsigned int i = 0; i < sec->reloc_count; i++)
{
- Elf_Internal_Rela *rel = relocs + i;
- asection *sym_sec;
+ char symtype;
bfd_vma symval;
- unsigned long r_symndx = ELFNN_R_SYM (rel->r_info);
- unsigned long r_type = ELFNN_R_TYPE (rel->r_info);
+ asection *sym_sec;
bool local_got = false;
- char symtype;
+ Elf_Internal_Rela *rel = relocs + i;
struct elf_link_hash_entry *h = NULL;
+ unsigned long r_type = ELFNN_R_TYPE (rel->r_info);
+ unsigned long r_symndx = ELFNN_R_SYM (rel->r_info);
+ /* Four kind of relocations:
+ Normal: symval is the symbol address.
+ R_LARCH_ALIGN: symval is the address of the last NOP instruction
+ added by this relocation, and then adds 4 more.
+ R_LARCH_CALL36: symval is the symbol address for local symbols,
+ or the PLT entry address of the symbol. (Todo)
+ R_LARCHL_TLS_LD/GD/DESC_PC_HI20: symval is the GOT entry address
+ of the symbol. */
if (r_symndx < symtab_hdr->sh_info)
{
Elf_Internal_Sym *sym = (Elf_Internal_Sym *)symtab_hdr->contents
@@ -4297,7 +4394,24 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
continue;
- if (sym->st_shndx == SHN_UNDEF || R_LARCH_ALIGN == r_type)
+ if (R_LARCH_TLS_LD_PC_HI20 == r_type
+ || R_LARCH_TLS_GD_PC_HI20 == r_type
+ || R_LARCH_TLS_DESC_PC_HI20 == r_type)
+ {
+ if (loongarch_can_relax_tls (info, r_type, h, abfd, r_symndx))
+ continue;
+ else
+ {
+ sym_sec = htab->elf.sgot;
+ symval = elf_local_got_offsets (abfd)[r_symndx];
+ char tls_type = _bfd_loongarch_elf_tls_type (abfd, h,
+ r_symndx);
+ if (R_LARCH_TLS_DESC_PC_HI20 == r_type
+ && GOT_TLS_GD_BOTH_P (tls_type))
+ symval += 2 * GOT_ENTRY_SIZE;
+ }
+ }
+ else if (sym->st_shndx == SHN_UNDEF || R_LARCH_ALIGN == r_type)
{
sym_sec = sec;
symval = rel->r_offset;
@@ -4322,7 +4436,26 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
if (h != NULL && h->type == STT_GNU_IFUNC)
continue;
- if ((h->root.type == bfd_link_hash_defined
+ /* The GOT entry of tls symbols must in current execute file or
+ shared object. */
+ if (R_LARCH_TLS_LD_PC_HI20 == r_type
+ || R_LARCH_TLS_GD_PC_HI20 == r_type
+ || R_LARCH_TLS_DESC_PC_HI20 == r_type)
+ {
+ if (loongarch_can_relax_tls (info, r_type, h, abfd, r_symndx))
+ continue;
+ else
+ {
+ sym_sec = htab->elf.sgot;
+ symval = h->got.offset;
+ char tls_type = _bfd_loongarch_elf_tls_type (abfd, h,
+ r_symndx);
+ if (R_LARCH_TLS_DESC_PC_HI20 == r_type
+ && GOT_TLS_GD_BOTH_P (tls_type))
+ symval += 2 * GOT_ENTRY_SIZE;
+ }
+ }
+ else if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section != NULL
&& h->root.u.def.section->output_section != NULL)
@@ -4351,7 +4484,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
if (symtype != STT_SECTION)
symval += rel->r_addend;
}
- /* For R_LARCH_ALIGN, symval is sec_addr (sym_sec) + rel->r_offset
+ /* For R_LARCH_ALIGN, symval is sec_addr (sec) + rel->r_offset
+ (alingmeng - 4).
If r_symndx is 0, alignmeng-4 is r_addend.
If r_symndx > 0, alignment-4 is 2^(r_addend & 0xff)-4. */
@@ -4392,6 +4525,25 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
info, again);
}
break;
+
+ case R_LARCH_TLS_LD_PC_HI20:
+ if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
+ loongarch_relax_tls_ld_gd_desc (abfd, sec, sym_sec, rel, symval,
+ info, again);
+ break;
+
+ case R_LARCH_TLS_GD_PC_HI20:
+ if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
+ loongarch_relax_tls_ld_gd_desc (abfd, sec, sym_sec, rel, symval,
+ info, again);
+ break;
+
+ case R_LARCH_TLS_DESC_PC_HI20:
+ if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
+ loongarch_relax_tls_ld_gd_desc (abfd, sec, sym_sec, rel, symval,
+ info, again);
+ break;
+
default:
break;
}
diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c
index 30a941a8..310e6d62 100644
--- a/bfd/elfxx-loongarch.c
+++ b/bfd/elfxx-loongarch.c
@@ -1775,6 +1775,60 @@ static loongarch_reloc_howto_type loongarch_howto_table[] =
BFD_RELOC_LARCH_TLS_DESC_CALL, /* bfd_reloc_code_real_type. */
NULL, /* adjust_reloc_bits. */
"desc_call"), /* larch_reloc_type_name. */
+
+ /* For pcaddi, ld_pc_hi20 + ld_pc_lo12 can relax to ld_pcrel20_s2. */
+ LOONGARCH_HOWTO (R_LARCH_TLS_LD_PCREL20_S2, /* type (124). */
+ 2, /* rightshift. */
+ 4, /* size. */
+ 20, /* bitsize. */
+ false, /* pc_relative. */
+ 5, /* bitpos. */
+ complain_overflow_signed, /* complain_on_overflow. */
+ bfd_elf_generic_reloc, /* special_function. */
+ "R_LARCH_TLS_LD_PCREL20_S2", /* name. */
+ false, /* partial_inplace. */
+ 0, /* src_mask. */
+ 0x1ffffe0, /* dst_mask. */
+ true, /* pcrel_offset. */
+ BFD_RELOC_LARCH_TLS_LD_PCREL20_S2, /* bfd_reloc_code_real_type. */
+ reloc_sign_bits, /* adjust_reloc_bits. */
+ "ld_pcrel_20"), /* larch_reloc_type_name. */
+
+ /* For pcaddi, gd_pc_hi20 + gd_pc_lo12 can relax to gd_pcrel20_s2. */
+ LOONGARCH_HOWTO (R_LARCH_TLS_GD_PCREL20_S2, /* type (125). */
+ 2, /* rightshift. */
+ 4, /* size. */
+ 20, /* bitsize. */
+ false, /* pc_relative. */
+ 5, /* bitpos. */
+ complain_overflow_signed, /* complain_on_overflow. */
+ bfd_elf_generic_reloc, /* special_function. */
+ "R_LARCH_TLS_GD_PCREL20_S2", /* name. */
+ false, /* partial_inplace. */
+ 0, /* src_mask. */
+ 0x1ffffe0, /* dst_mask. */
+ true, /* pcrel_offset. */
+ BFD_RELOC_LARCH_TLS_GD_PCREL20_S2, /* bfd_reloc_code_real_type. */
+ reloc_sign_bits, /* adjust_reloc_bits. */
+ "gd_pcrel_20"), /* larch_reloc_type_name. */
+
+ /* For pcaddi, desc_pc_hi20 + desc_pc_lo12 can relax to desc_pcrel20_s2. */
+ LOONGARCH_HOWTO (R_LARCH_TLS_DESC_PCREL20_S2, /* type (126). */
+ 2, /* rightshift. */
+ 4, /* size. */
+ 20, /* bitsize. */
+ false, /* pc_relative. */
+ 5, /* bitpos. */
+ complain_overflow_signed, /* complain_on_overflow. */
+ bfd_elf_generic_reloc, /* special_function. */
+ "R_LARCH_TLS_DESC_PCREL20_S2", /* name. */
+ false, /* partial_inplace. */
+ 0, /* src_mask. */
+ 0x1ffffe0, /* dst_mask. */
+ true, /* pcrel_offset. */
+ BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2, /* bfd_reloc_code_real_type. */
+ reloc_sign_bits, /* adjust_reloc_bits. */
+ "desc_pcrel_20"), /* larch_reloc_type_name. */
};
reloc_howto_type *
@@ -1783,7 +1837,9 @@ loongarch_elf_rtype_to_howto (bfd *abfd, unsigned int r_type)
if(r_type < R_LARCH_count)
{
/* For search table fast. */
+ /*
BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count);
+ */
if (loongarch_howto_table[r_type].howto.type == r_type)
return (reloc_howto_type *)&loongarch_howto_table[r_type];
@@ -1802,7 +1858,9 @@ loongarch_elf_rtype_to_howto (bfd *abfd, unsigned int r_type)
reloc_howto_type *
loongarch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
{
+ /*
BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count);
+ */
for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++)
if (loongarch_howto_table[i].howto.name
@@ -1821,7 +1879,9 @@ reloc_howto_type *
loongarch_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
+ /*
BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count);
+ */
/* Fast search for new reloc types. */
if (BFD_RELOC_LARCH_B16 <= code && code < BFD_RELOC_LARCH_RELAX)
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index a474b971..b5af327f 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -3538,6 +3538,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_LARCH_TLS_DESC64_HI12",
"BFD_RELOC_LARCH_TLS_DESC_LD",
"BFD_RELOC_LARCH_TLS_DESC_CALL",
+ "BFD_RELOC_LARCH_TLS_LD_PCREL20_S2",
+ "BFD_RELOC_LARCH_TLS_GD_PCREL20_S2",
+ "BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 5af98afb..4782f0f6 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8188,6 +8188,13 @@ ENUMX
ENUMX
BFD_RELOC_LARCH_TLS_DESC_CALL
+ENUMX
+ BFD_RELOC_LARCH_TLS_LD_PCREL20_S2
+ENUMX
+ BFD_RELOC_LARCH_TLS_GD_PCREL20_S2
+ENUMX
+ BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2
+
ENUMDOC
LARCH relocations.
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 1658025f..def26daf 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -682,7 +682,7 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2,
esc_ch1, esc_ch2, bit_field, arg);
if (ip->reloc_info[0].type >= BFD_RELOC_LARCH_B16
- && ip->reloc_info[0].type <= BFD_RELOC_LARCH_TLS_DESC_CALL)
+ && ip->reloc_info[0].type <= BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2)
{
/* As we compact stack-relocs, it is no need for pop operation.
But break out until here in order to check the imm field.
@@ -694,7 +694,11 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2,
&& (BFD_RELOC_LARCH_PCALA_HI20 == reloc_type
|| BFD_RELOC_LARCH_PCALA_LO12 == reloc_type
|| BFD_RELOC_LARCH_GOT_PC_HI20 == reloc_type
- || BFD_RELOC_LARCH_GOT_PC_LO12 == reloc_type))
+ || BFD_RELOC_LARCH_GOT_PC_LO12 == reloc_type
+ || BFD_RELOC_LARCH_TLS_LD_PC_HI20 == reloc_type
+ || BFD_RELOC_LARCH_TLS_GD_PC_HI20 == reloc_type
+ || BFD_RELOC_LARCH_TLS_DESC_PC_HI20 == reloc_type
+ || BFD_RELOC_LARCH_TLS_DESC_PC_LO12 == reloc_type))
{
ip->reloc_info[ip->reloc_num].type = BFD_RELOC_LARCH_RELAX;
ip->reloc_info[ip->reloc_num].value = const_0;
diff --git a/gas/testsuite/gas/loongarch/macro_op.d b/gas/testsuite/gas/loongarch/macro_op.d
index 32860864..47f8f45c 100644
--- a/gas/testsuite/gas/loongarch/macro_op.d
+++ b/gas/testsuite/gas/loongarch/macro_op.d
@@ -2,70 +2,72 @@
#objdump: -dr
#skip: loongarch32-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.text>:
-[ ]+0:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+4:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+8:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+c:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+10:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+10:[ ]+R_LARCH_GOT_PC_HI20[ ]+\.L1
-[ ]+10:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+14:[ ]+28c00084[ ]+ld\.d[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+14:[ ]+R_LARCH_GOT_PC_LO12[ ]+\.L1
-[ ]+14:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+18:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+18:[ ]+R_LARCH_GOT_PC_HI20[ ]+\.L1
-[ ]+18:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+1c:[ ]+28c00084[ ]+ld\.d[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+1c:[ ]+R_LARCH_GOT_PC_LO12[ ]+\.L1
-[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$a0, \$zero
+ c: 02bffc04 li.w \$a0, -1
+ 10: 1a000004 pcalau12i \$a0, 0
+ 10: R_LARCH_GOT_PC_HI20 .L1
+ 10: R_LARCH_RELAX \*ABS\*
+ 14: 28c00084 ld.d \$a0, \$a0, 0
+ 14: R_LARCH_GOT_PC_LO12 .L1
+ 14: R_LARCH_RELAX \*ABS\*
+ 18: 1a000004 pcalau12i \$a0, 0
+ 18: R_LARCH_GOT_PC_HI20 .L1
+ 18: R_LARCH_RELAX \*ABS\*
+ 1c: 28c00084 ld.d \$a0, \$a0, 0
+ 1c: R_LARCH_GOT_PC_LO12 .L1
+ 1c: R_LARCH_RELAX \*ABS\*
+ 20: 1a000004 pcalau12i \$a0, 0
+ 20: R_LARCH_PCALA_HI20 .L1
+ 20: R_LARCH_RELAX \*ABS\*
+ 24: 02c00084 addi.d \$a0, \$a0, 0
+ 24: R_LARCH_PCALA_LO12 .L1
+ 24: R_LARCH_RELAX \*ABS\*
+ 28: 14000004 lu12i.w \$a0, 0
+ 28: R_LARCH_MARK_LA \*ABS\*
+ 28: R_LARCH_ABS_HI20 .L1
+ 2c: 03800084 ori \$a0, \$a0, 0x0
+ 2c: R_LARCH_ABS_LO12 .L1
+ 30: 16000004 lu32i.d \$a0, 0
+ 30: R_LARCH_ABS64_LO20 .L1
+ 34: 03000084 lu52i.d \$a0, \$a0, 0
+ 34: R_LARCH_ABS64_HI12 .L1
+ 38: 1a000004 pcalau12i \$a0, 0
+ 38: R_LARCH_PCALA_HI20 .L1
+ 38: R_LARCH_RELAX \*ABS\*
+ 3c: 02c00084 addi.d \$a0, \$a0, 0
+ 3c: R_LARCH_PCALA_LO12 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 1a000004 pcalau12i \$a0, 0
+ 40: R_LARCH_GOT_PC_HI20 .L1
+ 40: R_LARCH_RELAX \*ABS\*
+ 44: 28c00084 ld.d \$a0, \$a0, 0
+ 44: R_LARCH_GOT_PC_LO12 .L1
+ 44: R_LARCH_RELAX \*ABS\*
+ 48: 14000004 lu12i.w \$a0, 0
+ 48: R_LARCH_TLS_LE_HI20 TLS1
+ 4c: 03800084 ori \$a0, \$a0, 0x0
+ 4c: R_LARCH_TLS_LE_LO12 TLS1
+ 50: 1a000004 pcalau12i \$a0, 0
+ 50: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 54: 28c00084 ld.d \$a0, \$a0, 0
+ 54: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 58: R_LARCH_RELAX \*ABS\*
+ 5c: 02c00084 addi.d \$a0, \$a0, 0
+ 5c: R_LARCH_GOT_PC_LO12 TLS1
+ 5c: R_LARCH_RELAX \*ABS\*
+ 60: 1a000004 pcalau12i \$a0, 0
+ 60: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 60: R_LARCH_RELAX \*ABS\*
+ 64: 02c00084 addi.d \$a0, \$a0, 0
+ 64: R_LARCH_GOT_PC_LO12 TLS1
+ 64: R_LARCH_RELAX \*ABS\*
diff --git a/gas/testsuite/gas/loongarch/macro_op_32.d b/gas/testsuite/gas/loongarch/macro_op_32.d
index 188026a5..a7349aa8 100644
--- a/gas/testsuite/gas/loongarch/macro_op_32.d
+++ b/gas/testsuite/gas/loongarch/macro_op_32.d
@@ -2,66 +2,68 @@
#objdump: -dr
#skip: loongarch64-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.L1>:
-[ ]+0:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+4:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+8:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+c:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+10:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+10:[ ]+R_LARCH_GOT_PC_HI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]+5c:[ ]+02800084[ ]+addi.w[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+5c:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1
-[ ]+5c:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
+0+ <.L1>:
+ 0: 00150004 move \$a0, \$zero
+ 4: 02bffc04 li.w \$a0, -1
+ 8: 00150004 move \$a0, \$zero
+ c: 02bffc04 li.w \$a0, -1
+ 10: 1a000004 pcalau12i \$a0, 0
+ 10: R_LARCH_GOT_PC_HI20 .L1
+ 10: R_LARCH_RELAX \*ABS\*
+ 14: 28800084 ld.w \$a0, \$a0, 0
+ 14: R_LARCH_GOT_PC_LO12 .L1
+ 14: R_LARCH_RELAX \*ABS\*
+ 18: 1a000004 pcalau12i \$a0, 0
+ 18: R_LARCH_GOT_PC_HI20 .L1
+ 18: R_LARCH_RELAX \*ABS\*
+ 1c: 28800084 ld.w \$a0, \$a0, 0
+ 1c: R_LARCH_GOT_PC_LO12 .L1
+ 1c: R_LARCH_RELAX \*ABS\*
+ 20: 1a000004 pcalau12i \$a0, 0
+ 20: R_LARCH_PCALA_HI20 .L1
+ 20: R_LARCH_RELAX \*ABS\*
+ 24: 02800084 addi.w \$a0, \$a0, 0
+ 24: R_LARCH_PCALA_LO12 .L1
+ 24: R_LARCH_RELAX \*ABS\*
+ 28: 14000004 lu12i.w \$a0, 0
+ 28: R_LARCH_MARK_LA \*ABS\*
+ 28: R_LARCH_ABS_HI20 .L1
+ 2c: 03800084 ori \$a0, \$a0, 0x0
+ 2c: R_LARCH_ABS_LO12 .L1
+ 30: 1a000004 pcalau12i \$a0, 0
+ 30: R_LARCH_PCALA_HI20 .L1
+ 30: R_LARCH_RELAX \*ABS\*
+ 34: 02800084 addi.w \$a0, \$a0, 0
+ 34: R_LARCH_PCALA_LO12 .L1
+ 34: R_LARCH_RELAX \*ABS\*
+ 38: 1a000004 pcalau12i \$a0, 0
+ 38: R_LARCH_GOT_PC_HI20 .L1
+ 38: R_LARCH_RELAX \*ABS\*
+ 3c: 28800084 ld.w \$a0, \$a0, 0
+ 3c: R_LARCH_GOT_PC_LO12 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 14000004 lu12i.w \$a0, 0
+ 40: R_LARCH_TLS_LE_HI20 TLS1
+ 44: 03800084 ori \$a0, \$a0, 0x0
+ 44: R_LARCH_TLS_LE_LO12 TLS1
+ 48: 1a000004 pcalau12i \$a0, 0
+ 48: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 4c: 28800084 ld.w \$a0, \$a0, 0
+ 4c: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 50: 1a000004 pcalau12i \$a0, 0
+ 50: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 50: R_LARCH_RELAX \*ABS\*
+ 54: 02800084 addi.w \$a0, \$a0, 0
+ 54: R_LARCH_GOT_PC_LO12 TLS1
+ 54: R_LARCH_RELAX \*ABS\*
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 58: R_LARCH_RELAX \*ABS\*
+ 5c: 02800084 addi.w \$a0, \$a0, 0
+ 5c: R_LARCH_GOT_PC_LO12 TLS1
+ 5c: R_LARCH_RELAX \*ABS\*
diff --git a/gas/testsuite/gas/loongarch/macro_op_large_abs.d b/gas/testsuite/gas/loongarch/macro_op_large_abs.d
index 0c49f68e..729e878f 100644
--- a/gas/testsuite/gas/loongarch/macro_op_large_abs.d
+++ b/gas/testsuite/gas/loongarch/macro_op_large_abs.d
@@ -1,85 +1,89 @@
-#as: -mla-global-with-abs
+#as:
#objdump: -dr
#skip: loongarch32-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.L1>:
-[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.L1
-[ ]+0:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+4:[ ]+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H_GOT64_PC_HI12[ ]+TLS1
-[ ]+8c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1
+0+ <.L1>:
+ 0: 1a000004 pcalau12i \$a0, 0
+ 0: R_LARCH_PCALA_HI20 .L1
+ 0: R_LARCH_RELAX \*ABS\*
+ 4: 02c00005 li.d \$a1, 0
+ 4: R_LARCH_PCALA_LO12 .L1
+ 4: R_LARCH_RELAX \*ABS\*
+ 8: 16000005 lu32i.d \$a1, 0
+ 8: R_LARCH_PCALA64_LO20 .L1
+ c: 030000a5 lu52i.d \$a1, \$a1, 0
+ c: R_LARCH_PCALA64_HI12 .L1
+ 10: 00109484 add.d \$a0, \$a0, \$a1
+ 14: 1a000004 pcalau12i \$a0, 0
+ 14: R_LARCH_GOT_PC_HI20 .L1
+ 14: R_LARCH_RELAX \*ABS\*
+ 18: 02c00005 li.d \$a1, 0
+ 18: R_LARCH_GOT_PC_LO12 .L1
+ 18: R_LARCH_RELAX \*ABS\*
+ 1c: 16000005 lu32i.d \$a1, 0
+ 1c: R_LARCH_GOT64_PC_LO20 .L1
+ 20: 030000a5 lu52i.d \$a1, \$a1, 0
+ 20: R_LARCH_GOT64_PC_HI12 .L1
+ 24: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 28: 1a000004 pcalau12i \$a0, 0
+ 28: R_LARCH_PCALA_HI20 .L1
+ 28: R_LARCH_RELAX \*ABS\*
+ 2c: 02c00005 li.d \$a1, 0
+ 2c: R_LARCH_PCALA_LO12 .L1
+ 2c: R_LARCH_RELAX \*ABS\*
+ 30: 16000005 lu32i.d \$a1, 0
+ 30: R_LARCH_PCALA64_LO20 .L1
+ 34: 030000a5 lu52i.d \$a1, \$a1, 0
+ 34: R_LARCH_PCALA64_HI12 .L1
+ 38: 00109484 add.d \$a0, \$a0, \$a1
+ 3c: 1a000004 pcalau12i \$a0, 0
+ 3c: R_LARCH_GOT_PC_HI20 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 02c00005 li.d \$a1, 0
+ 40: R_LARCH_GOT_PC_LO12 .L1
+ 40: R_LARCH_RELAX \*ABS\*
+ 44: 16000005 lu32i.d \$a1, 0
+ 44: R_LARCH_GOT64_PC_LO20 .L1
+ 48: 030000a5 lu52i.d \$a1, \$a1, 0
+ 48: R_LARCH_GOT64_PC_HI12 .L1
+ 4c: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 50: 14000004 lu12i.w \$a0, 0
+ 50: R_LARCH_TLS_LE_HI20 TLS1
+ 54: 03800084 ori \$a0, \$a0, 0x0
+ 54: R_LARCH_TLS_LE_LO12 TLS1
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 5c: 02c00005 li.d \$a1, 0
+ 5c: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 60: 16000005 lu32i.d \$a1, 0
+ 60: R_LARCH_TLS_IE64_PC_LO20 TLS1
+ 64: 030000a5 lu52i.d \$a1, \$a1, 0
+ 64: R_LARCH_TLS_IE64_PC_HI12 TLS1
+ 68: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 6c: 1a000004 pcalau12i \$a0, 0
+ 6c: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 6c: R_LARCH_RELAX \*ABS\*
+ 70: 02c00005 li.d \$a1, 0
+ 70: R_LARCH_GOT_PC_LO12 TLS1
+ 70: R_LARCH_RELAX \*ABS\*
+ 74: 16000005 lu32i.d \$a1, 0
+ 74: R_LARCH_GOT64_PC_LO20 TLS1
+ 78: 030000a5 lu52i.d \$a1, \$a1, 0
+ 78: R_LARCH_GOT64_PC_HI12 TLS1
+ 7c: 00109484 add.d \$a0, \$a0, \$a1
+ 80: 1a000004 pcalau12i \$a0, 0
+ 80: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 80: R_LARCH_RELAX \*ABS\*
+ 84: 02c00005 li.d \$a1, 0
+ 84: R_LARCH_GOT_PC_LO12 TLS1
+ 84: R_LARCH_RELAX \*ABS\*
+ 88: 16000005 lu32i.d \$a1, 0
+ 88: R_LARCH_GOT64_PC_LO20 TLS1
+ 8c: 030000a5 lu52i.d \$a1, \$a1, 0
+ 8c: R_LARCH_GOT64_PC_HI12 TLS1
+ 90: 00109484 add.d \$a0, \$a0, \$a1
diff --git a/gas/testsuite/gas/loongarch/macro_op_large_pc.d b/gas/testsuite/gas/loongarch/macro_op_large_pc.d
index 0c49f68e..729e878f 100644
--- a/gas/testsuite/gas/loongarch/macro_op_large_pc.d
+++ b/gas/testsuite/gas/loongarch/macro_op_large_pc.d
@@ -1,85 +1,89 @@
-#as: -mla-global-with-abs
+#as:
#objdump: -dr
#skip: loongarch32-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.L1>:
-[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.L1
-[ ]+0:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+4:[ ]+02c00005[ ]+li\.d[ ]+\$a1,[ ]+0
-[ ]+4:[ ]+R_LARCH_PCALA_LO12[ ]+.L1
-[ ]+4:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+8:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0
-[ ]+8:[ ]+R_LARCH_PCALA64_LO20[ ]+.L1
-[ ]+c:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0
-[ ]+c:[ ]+R_LARCH_PCALA64_HI12[ ]+.L1
-[ ]+10:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1
-[ ]+14:[ ]+14000004[ ]+lu12i.w[ ]+\$a0,[ ]+0
-[ ]+14:[ ]+R_LARCH_MARK_LA[ ]+\*ABS\*
-[ ]+14:[ ]+R_LARCH_ABS_HI20[ ]+.L1
-[ ]+18:[ ]+03800084[ ]+ori[ ]+\$a0,[ ]+\$a0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18: R_LARCH_RELAX \*ABS\*
+ 1c: 16000005 lu32i.d \$a1, 0
+ 1c: R_LARCH_GOT64_PC_LO20 .L1
+ 20: 030000a5 lu52i.d \$a1, \$a1, 0
+ 20: R_LARCH_GOT64_PC_HI12 .L1
+ 24: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 28: 1a000004 pcalau12i \$a0, 0
+ 28: R_LARCH_PCALA_HI20 .L1
+ 28: R_LARCH_RELAX \*ABS\*
+ 2c: 02c00005 li.d \$a1, 0
+ 2c: R_LARCH_PCALA_LO12 .L1
+ 2c: R_LARCH_RELAX \*ABS\*
+ 30: 16000005 lu32i.d \$a1, 0
+ 30: R_LARCH_PCALA64_LO20 .L1
+ 34: 030000a5 lu52i.d \$a1, \$a1, 0
+ 34: R_LARCH_PCALA64_HI12 .L1
+ 38: 00109484 add.d \$a0, \$a0, \$a1
+ 3c: 1a000004 pcalau12i \$a0, 0
+ 3c: R_LARCH_GOT_PC_HI20 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 02c00005 li.d \$a1, 0
+ 40: R_LARCH_GOT_PC_LO12 .L1
+ 40: R_LARCH_RELAX \*ABS\*
+ 44: 16000005 lu32i.d \$a1, 0
+ 44: R_LARCH_GOT64_PC_LO20 .L1
+ 48: 030000a5 lu52i.d \$a1, \$a1, 0
+ 48: R_LARCH_GOT64_PC_HI12 .L1
+ 4c: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 50: 14000004 lu12i.w \$a0, 0
+ 50: R_LARCH_TLS_LE_HI20 TLS1
+ 54: 03800084 ori \$a0, \$a0, 0x0
+ 54: R_LARCH_TLS_LE_LO12 TLS1
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 5c: 02c00005 li.d \$a1, 0
+ 5c: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 60: 16000005 lu32i.d \$a1, 0
+ 60: R_LARCH_TLS_IE64_PC_LO20 TLS1
+ 64: 030000a5 lu52i.d \$a1, \$a1, 0
+ 64: R_LARCH_TLS_IE64_PC_HI12 TLS1
+ 68: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 6c: 1a000004 pcalau12i \$a0, 0
+ 6c: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 6c: R_LARCH_RELAX \*ABS\*
+ 70: 02c00005 li.d \$a1, 0
+ 70: R_LARCH_GOT_PC_LO12 TLS1
+ 70: R_LARCH_RELAX \*ABS\*
+ 74: 16000005 lu32i.d \$a1, 0
+ 74: R_LARCH_GOT64_PC_LO20 TLS1
+ 78: 030000a5 lu52i.d \$a1, \$a1, 0
+ 78: R_LARCH_GOT64_PC_HI12 TLS1
+ 7c: 00109484 add.d \$a0, \$a0, \$a1
+ 80: 1a000004 pcalau12i \$a0, 0
+ 80: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 80: R_LARCH_RELAX \*ABS\*
+ 84: 02c00005 li.d \$a1, 0
+ 84: R_LARCH_GOT_PC_LO12 TLS1
+ 84: R_LARCH_RELAX \*ABS\*
+ 88: 16000005 lu32i.d \$a1, 0
+ 88: R_LARCH_GOT64_PC_LO20 TLS1
+ 8c: 030000a5 lu52i.d \$a1, \$a1, 0
+ 8c: R_LARCH_GOT64_PC_HI12 TLS1
+ 90: 00109484 add.d \$a0, \$a0, \$a1
diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h
index 41e9fe4d..6cfee164 100644
--- a/include/elf/loongarch.h
+++ b/include/elf/loongarch.h
@@ -273,6 +273,10 @@ RELOC_NUMBER (R_LARCH_TLS_DESC64_HI12, 118)
RELOC_NUMBER (R_LARCH_TLS_DESC_LD, 119)
RELOC_NUMBER (R_LARCH_TLS_DESC_CALL, 120)
+RELOC_NUMBER (R_LARCH_TLS_LD_PCREL20_S2, 124)
+RELOC_NUMBER (R_LARCH_TLS_GD_PCREL20_S2, 125)
+RELOC_NUMBER (R_LARCH_TLS_DESC_PCREL20_S2, 126)
+
END_RELOC_NUMBERS (R_LARCH_count)
/* Processor specific flags for the ELF header e_flags field. */
diff --git a/ld/testsuite/ld-loongarch-elf/macro_op.d b/ld/testsuite/ld-loongarch-elf/macro_op.d
index edc71bc0..f0d87c03 100644
--- a/ld/testsuite/ld-loongarch-elf/macro_op.d
+++ b/ld/testsuite/ld-loongarch-elf/macro_op.d
@@ -1,200 +1,205 @@
#as:
#objdump: -dr
+#skip: loongarch32-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.L1>:
-[ ]+0:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+4:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+8:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+c:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+10:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+10:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1
-[ ]+10:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+14:[ ]+28c00084[ ]+ld.d[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+14:[ ]+R_LARCH_GOT_PC_LO12[ ]+.L1
-[ ]+14:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+18:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+18:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1
-[ ]+18:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+1c:[ ]+28c00084[ ]+ld.d[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+1c:[ ]+R_LARCH_GOT_PC_LO12[ ]+.L1
-[ ]+1c:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+20:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+20:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1
-[ ]+20:[ ]+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.d[ ]+\$a1,[ ]+0
-[ ]+140:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1
-[ ]+140:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+144:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0
-[ ]+144:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1
-[ ]+148:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0
-[ ]+148:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1
-[ ]+14c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1
+0+ <.L1>:
+ 0: 00150004 move \$a0, \$zero
+ 4: 02bffc04 li.w \$a0, -1
+ 8: 00150004 move \$a0, \$zero
+ c: 02bffc04 li.w \$a0, -1
+ 10: 1a000004 pcalau12i \$a0, 0
+ 10: R_LARCH_GOT_PC_HI20 .L1
+ 10: R_LARCH_RELAX \*ABS\*
+ 14: 28c00084 ld.d \$a0, \$a0, 0
+ 14: R_LARCH_GOT_PC_LO12 .L1
+ 14: R_LARCH_RELAX \*ABS\*
+ 18: 1a000004 pcalau12i \$a0, 0
+ 18: R_LARCH_GOT_PC_HI20 .L1
+ 18: R_LARCH_RELAX \*ABS\*
+ 1c: 28c00084 ld.d \$a0, \$a0, 0
+ 1c: R_LARCH_GOT_PC_LO12 .L1
+ 1c: R_LARCH_RELAX \*ABS\*
+ 20: 1a000004 pcalau12i \$a0, 0
+ 20: R_LARCH_GOT_PC_HI20 .L1
+ 20: R_LARCH_RELAX \*ABS\*
+ 24: 02c00005 li.d \$a1, 0
+ 24: R_LARCH_GOT_PC_LO12 .L1
+ 24: R_LARCH_RELAX \*ABS\*
+ 28: 16000005 lu32i.d \$a1, 0
+ 28: R_LARCH_GOT64_PC_LO20 .L1
+ 2c: 030000a5 lu52i.d \$a1, \$a1, 0
+ 2c: R_LARCH_GOT64_PC_HI12 .L1
+ 30: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 34: 1a000004 pcalau12i \$a0, 0
+ 34: R_LARCH_GOT_PC_HI20 .L1
+ 34: R_LARCH_RELAX \*ABS\*
+ 38: 28c00084 ld.d \$a0, \$a0, 0
+ 38: R_LARCH_GOT_PC_LO12 .L1
+ 38: R_LARCH_RELAX \*ABS\*
+ 3c: 1a000004 pcalau12i \$a0, 0
+ 3c: R_LARCH_GOT_PC_HI20 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 02c00005 li.d \$a1, 0
+ 40: R_LARCH_GOT_PC_LO12 .L1
+ 40: R_LARCH_RELAX \*ABS\*
+ 44: 16000005 lu32i.d \$a1, 0
+ 44: R_LARCH_GOT64_PC_LO20 .L1
+ 48: 030000a5 lu52i.d \$a1, \$a1, 0
+ 48: R_LARCH_GOT64_PC_HI12 .L1
+ 4c: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 50: 1a000004 pcalau12i \$a0, 0
+ 50: R_LARCH_GOT_PC_HI20 .L1
+ 50: R_LARCH_RELAX \*ABS\*
+ 54: 28c00084 ld.d \$a0, \$a0, 0
+ 54: R_LARCH_GOT_PC_LO12 .L1
+ 54: R_LARCH_RELAX \*ABS\*
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_GOT_PC_HI20 .L1
+ 58: R_LARCH_RELAX \*ABS\*
+ 5c: 02c00005 li.d \$a1, 0
+ 5c: R_LARCH_GOT_PC_LO12 .L1
+ 5c: R_LARCH_RELAX \*ABS\*
+ 60: 16000005 lu32i.d \$a1, 0
+ 60: R_LARCH_GOT64_PC_LO20 .L1
+ 64: 030000a5 lu52i.d \$a1, \$a1, 0
+ 64: R_LARCH_GOT64_PC_HI12 .L1
+ 68: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 6c: 1a000004 pcalau12i \$a0, 0
+ 6c: R_LARCH_PCALA_HI20 .L1
+ 6c: R_LARCH_RELAX \*ABS\*
+ 70: 02c00084 addi.d \$a0, \$a0, 0
+ 70: R_LARCH_PCALA_LO12 .L1
+ 70: R_LARCH_RELAX \*ABS\*
+ 74: 1a000004 pcalau12i \$a0, 0
+ 74: R_LARCH_PCALA_HI20 .L1
+ 74: R_LARCH_RELAX \*ABS\*
+ 78: 02c00005 li.d \$a1, 0
+ 78: R_LARCH_PCALA_LO12 .L1
+ 78: R_LARCH_RELAX \*ABS\*
+ 7c: 16000005 lu32i.d \$a1, 0
+ 7c: R_LARCH_PCALA64_LO20 .L1
+ 80: 030000a5 lu52i.d \$a1, \$a1, 0
+ 80: R_LARCH_PCALA64_HI12 .L1
+ 84: 00109484 add.d \$a0, \$a0, \$a1
+ 88: 1a000004 pcalau12i \$a0, 0
+ 88: R_LARCH_PCALA_HI20 .L1
+ 88: R_LARCH_RELAX \*ABS\*
+ 8c: 02c00084 addi.d \$a0, \$a0, 0
+ 8c: R_LARCH_PCALA_LO12 .L1
+ 8c: R_LARCH_RELAX \*ABS\*
+ 90: 1a000004 pcalau12i \$a0, 0
+ 90: R_LARCH_PCALA_HI20 .L1
+ 90: R_LARCH_RELAX \*ABS\*
+ 94: 02c00005 li.d \$a1, 0
+ 94: R_LARCH_PCALA_LO12 .L1
+ 94: R_LARCH_RELAX \*ABS\*
+ 98: 16000005 lu32i.d \$a1, 0
+ 98: R_LARCH_PCALA64_LO20 .L1
+ 9c: 030000a5 lu52i.d \$a1, \$a1, 0
+ 9c: R_LARCH_PCALA64_HI12 .L1
+ a0: 00109484 add.d \$a0, \$a0, \$a1
+ a4: 14000004 lu12i.w \$a0, 0
+ a4: R_LARCH_MARK_LA \*ABS\*
+ a4: R_LARCH_ABS_HI20 .L1
+ a8: 03800084 ori \$a0, \$a0, 0x0
+ a8: R_LARCH_ABS_LO12 .L1
+ ac: 16000004 lu32i.d \$a0, 0
+ ac: R_LARCH_ABS64_LO20 .L1
+ b0: 03000084 lu52i.d \$a0, \$a0, 0
+ b0: R_LARCH_ABS64_HI12 .L1
+ b4: 1a000004 pcalau12i \$a0, 0
+ b4: R_LARCH_PCALA_HI20 .L1
+ b4: R_LARCH_RELAX \*ABS\*
+ b8: 02c00084 addi.d \$a0, \$a0, 0
+ b8: R_LARCH_PCALA_LO12 .L1
+ b8: R_LARCH_RELAX \*ABS\*
+ bc: 1a000004 pcalau12i \$a0, 0
+ bc: R_LARCH_PCALA_HI20 .L1
+ bc: R_LARCH_RELAX \*ABS\*
+ c0: 02c00084 addi.d \$a0, \$a0, 0
+ c0: R_LARCH_PCALA_LO12 .L1
+ c0: R_LARCH_RELAX \*ABS\*
+ c4: 1a000004 pcalau12i \$a0, 0
+ c4: R_LARCH_PCALA_HI20 .L1
+ c4: R_LARCH_RELAX \*ABS\*
+ c8: 02c00005 li.d \$a1, 0
+ c8: R_LARCH_PCALA_LO12 .L1
+ c8: R_LARCH_RELAX \*ABS\*
+ cc: 16000005 lu32i.d \$a1, 0
+ cc: R_LARCH_PCALA64_LO20 .L1
+ d0: 030000a5 lu52i.d \$a1, \$a1, 0
+ d0: R_LARCH_PCALA64_HI12 .L1
+ d4: 00109484 add.d \$a0, \$a0, \$a1
+ d8: 1a000004 pcalau12i \$a0, 0
+ d8: R_LARCH_GOT_PC_HI20 .L1
+ d8: R_LARCH_RELAX \*ABS\*
+ dc: 28c00084 ld.d \$a0, \$a0, 0
+ dc: R_LARCH_GOT_PC_LO12 .L1
+ dc: R_LARCH_RELAX \*ABS\*
+ e0: 1a000004 pcalau12i \$a0, 0
+ e0: R_LARCH_GOT_PC_HI20 .L1
+ e0: R_LARCH_RELAX \*ABS\*
+ e4: 02c00005 li.d \$a1, 0
+ e4: R_LARCH_GOT_PC_LO12 .L1
+ e4: R_LARCH_RELAX \*ABS\*
+ e8: 16000005 lu32i.d \$a1, 0
+ e8: R_LARCH_GOT64_PC_LO20 .L1
+ ec: 030000a5 lu52i.d \$a1, \$a1, 0
+ ec: R_LARCH_GOT64_PC_HI12 .L1
+ f0: 380c1484 ldx.d \$a0, \$a0, \$a1
+ f4: 14000004 lu12i.w \$a0, 0
+ f4: R_LARCH_TLS_LE_HI20 TLS1
+ f8: 03800084 ori \$a0, \$a0, 0x0
+ f8: R_LARCH_TLS_LE_LO12 TLS1
+ fc: 1a000004 pcalau12i \$a0, 0
+ fc: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 100: 28c00084 ld.d \$a0, \$a0, 0
+ 100: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 104: 1a000004 pcalau12i \$a0, 0
+ 104: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 108: 02c00005 li.d \$a1, 0
+ 108: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 10c: 16000005 lu32i.d \$a1, 0
+ 10c: R_LARCH_TLS_IE64_PC_LO20 TLS1
+ 110: 030000a5 lu52i.d \$a1, \$a1, 0
+ 110: R_LARCH_TLS_IE64_PC_HI12 TLS1
+ 114: 380c1484 ldx.d \$a0, \$a0, \$a1
+ 118: 1a000004 pcalau12i \$a0, 0
+ 118: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 118: R_LARCH_RELAX \*ABS\*
+ 11c: 02c00084 addi.d \$a0, \$a0, 0
+ 11c: R_LARCH_GOT_PC_LO12 TLS1
+ 11c: R_LARCH_RELAX \*ABS\*
+ 120: 1a000004 pcalau12i \$a0, 0
+ 120: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 120: R_LARCH_RELAX \*ABS\*
+ 124: 02c00005 li.d \$a1, 0
+ 124: R_LARCH_GOT_PC_LO12 TLS1
+ 124: R_LARCH_RELAX \*ABS\*
+ 128: 16000005 lu32i.d \$a1, 0
+ 128: R_LARCH_GOT64_PC_LO20 TLS1
+ 12c: 030000a5 lu52i.d \$a1, \$a1, 0
+ 12c: R_LARCH_GOT64_PC_HI12 TLS1
+ 130: 00109484 add.d \$a0, \$a0, \$a1
+ 134: 1a000004 pcalau12i \$a0, 0
+ 134: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 134: R_LARCH_RELAX \*ABS\*
+ 138: 02c00084 addi.d \$a0, \$a0, 0
+ 138: R_LARCH_GOT_PC_LO12 TLS1
+ 138: R_LARCH_RELAX \*ABS\*
+ 13c: 1a000004 pcalau12i \$a0, 0
+ 13c: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 13c: R_LARCH_RELAX \*ABS\*
+ 140: 02c00005 li.d \$a1, 0
+ 140: R_LARCH_GOT_PC_LO12 TLS1
+ 140: R_LARCH_RELAX \*ABS\*
+ 144: 16000005 lu32i.d \$a1, 0
+ 144: R_LARCH_GOT64_PC_LO20 TLS1
+ 148: 030000a5 lu52i.d \$a1, \$a1, 0
+ 148: R_LARCH_GOT64_PC_HI12 TLS1
+ 14c: 00109484 add.d \$a0, \$a0, \$a1
diff --git a/ld/testsuite/ld-loongarch-elf/macro_op_32.d b/ld/testsuite/ld-loongarch-elf/macro_op_32.d
index 188026a5..a7349aa8 100644
--- a/ld/testsuite/ld-loongarch-elf/macro_op_32.d
+++ b/ld/testsuite/ld-loongarch-elf/macro_op_32.d
@@ -2,66 +2,68 @@
#objdump: -dr
#skip: loongarch64-*-*
-.*:[ ]+file format .*
+.*: file format .*
Disassembly of section .text:
-00000000.* <.L1>:
-[ ]+0:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+4:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+8:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero
-[ ]+c:[ ]+02bffc04[ ]+li\.w[ ]+\$a0,[ ]+-1
-[ ]+10:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+10:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1
-[ ]+10:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+14:[ ]+28800084[ ]+ld.w[ ]+\$a0,[ ]+\$a0,[ ]+0
-[ ]+14:[ ]+R_LARCH_GOT_PC_LO12[ ]+.L1
-[ ]+14:[ ]+R_LARCH_RELAX[ ]+\*ABS\*
-[ ]+18:[ ]+1a000004[ ]+pcalau12i[ ]+\$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bffc04 li.w \$a0, -1
+ 10: 1a000004 pcalau12i \$a0, 0
+ 10: R_LARCH_GOT_PC_HI20 .L1
+ 10: R_LARCH_RELAX \*ABS\*
+ 14: 28800084 ld.w \$a0, \$a0, 0
+ 14: R_LARCH_GOT_PC_LO12 .L1
+ 14: R_LARCH_RELAX \*ABS\*
+ 18: 1a000004 pcalau12i \$a0, 0
+ 18: R_LARCH_GOT_PC_HI20 .L1
+ 18: R_LARCH_RELAX \*ABS\*
+ 1c: 28800084 ld.w \$a0, \$a0, 0
+ 1c: R_LARCH_GOT_PC_LO12 .L1
+ 1c: R_LARCH_RELAX \*ABS\*
+ 20: 1a000004 pcalau12i \$a0, 0
+ 20: R_LARCH_PCALA_HI20 .L1
+ 20: R_LARCH_RELAX \*ABS\*
+ 24: 02800084 addi.w \$a0, \$a0, 0
+ 24: R_LARCH_PCALA_LO12 .L1
+ 24: R_LARCH_RELAX \*ABS\*
+ 28: 14000004 lu12i.w \$a0, 0
+ 28: R_LARCH_MARK_LA \*ABS\*
+ 28: R_LARCH_ABS_HI20 .L1
+ 2c: 03800084 ori \$a0, \$a0, 0x0
+ 2c: R_LARCH_ABS_LO12 .L1
+ 30: 1a000004 pcalau12i \$a0, 0
+ 30: R_LARCH_PCALA_HI20 .L1
+ 30: R_LARCH_RELAX \*ABS\*
+ 34: 02800084 addi.w \$a0, \$a0, 0
+ 34: R_LARCH_PCALA_LO12 .L1
+ 34: R_LARCH_RELAX \*ABS\*
+ 38: 1a000004 pcalau12i \$a0, 0
+ 38: R_LARCH_GOT_PC_HI20 .L1
+ 38: R_LARCH_RELAX \*ABS\*
+ 3c: 28800084 ld.w \$a0, \$a0, 0
+ 3c: R_LARCH_GOT_PC_LO12 .L1
+ 3c: R_LARCH_RELAX \*ABS\*
+ 40: 14000004 lu12i.w \$a0, 0
+ 40: R_LARCH_TLS_LE_HI20 TLS1
+ 44: 03800084 ori \$a0, \$a0, 0x0
+ 44: R_LARCH_TLS_LE_LO12 TLS1
+ 48: 1a000004 pcalau12i \$a0, 0
+ 48: R_LARCH_TLS_IE_PC_HI20 TLS1
+ 4c: 28800084 ld.w \$a0, \$a0, 0
+ 4c: R_LARCH_TLS_IE_PC_LO12 TLS1
+ 50: 1a000004 pcalau12i \$a0, 0
+ 50: R_LARCH_TLS_LD_PC_HI20 TLS1
+ 50: R_LARCH_RELAX \*ABS\*
+ 54: 02800084 addi.w \$a0, \$a0, 0
+ 54: R_LARCH_GOT_PC_LO12 TLS1
+ 54: R_LARCH_RELAX \*ABS\*
+ 58: 1a000004 pcalau12i \$a0, 0
+ 58: R_LARCH_TLS_GD_PC_HI20 TLS1
+ 58: R_LARCH_RELAX \*ABS\*
+ 5c: 02800084 addi.w \$a0, \$a0, 0
+ 5c: R_LARCH_GOT_PC_LO12 TLS1
+ 5c: R_LARCH_RELAX \*ABS\*
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化