From: mengqinggang <mengqinggang@loongson.cn>
To: binutils@sourceware.org
Cc: xuchenghua@loongson.cn, liuzhensong@loongson.cn,
chenglulu@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name,
maskray@google.com, mengqinggang <mengqinggang@loongson.cn>
Subject: [PATCH v1 1/6] LoongArch: include: Add support for linker relaxation.
Date: Mon, 5 Dec 2022 16:04:48 +0800 [thread overview]
Message-ID: <20221205080453.1352069-2-mengqinggang@loongson.cn> (raw)
In-Reply-To: <20221205080453.1352069-1-mengqinggang@loongson.cn>
Add relocs and gas LARCH_opts.relax option.
include/ChangeLog:
* elf/loongarch.h: Add relocs.
* opcode/loongarch.h: Add LARCH_opts.relax and macro LARCH_NOP.
---
include/elf/loongarch.h | 20 ++++++++++++++++++++
include/opcode/loongarch.h | 3 +++
2 files changed, 23 insertions(+)
diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h
index a6341b46791..0ecddd17b37 100644
--- a/include/elf/loongarch.h
+++ b/include/elf/loongarch.h
@@ -229,6 +229,26 @@ RELOC_NUMBER (R_LARCH_32_PCREL, 99)
/* RELAX. */
RELOC_NUMBER (R_LARCH_RELAX, 100)
+/* relax delete. */
+RELOC_NUMBER (R_LARCH_DELETE, 101)
+
+/* relax align. */
+RELOC_NUMBER (R_LARCH_ALIGN, 102)
+
+/* pcaddi. */
+RELOC_NUMBER (R_LARCH_PCREL20_S2, 103)
+
+/* cfa. */
+RELOC_NUMBER (R_LARCH_CFA, 104)
+
+/* DW_CFA_advance_loc. */
+RELOC_NUMBER (R_LARCH_ADD6, 105)
+RELOC_NUMBER (R_LARCH_SUB6, 106)
+
+/* unsinged leb128. */
+RELOC_NUMBER (R_LARCH_ADD_ULEB128, 107)
+RELOC_NUMBER (R_LARCH_SUB_ULEB128, 108)
+
END_RELOC_NUMBERS (R_LARCH_count)
/* Processor specific flags for the ELF header e_flags field. */
diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h
index c3922348a56..71570e9acc2 100644
--- a/include/opcode/loongarch.h
+++ b/include/opcode/loongarch.h
@@ -28,6 +28,8 @@ extern "C"
{
#endif
+ #define LARCH_NOP 0x03400000
+
typedef uint32_t insn_t;
struct loongarch_opcode
@@ -228,6 +230,7 @@ dec2 : [1-9][0-9]?
#define ase_gpcr isa.use_la_global_with_pcrel
#define ase_gabs isa.use_la_global_with_abs
+ int relax;
} LARCH_opts;
extern size_t loongarch_insn_length (insn_t insn);
--
2.36.0
next prev parent reply other threads:[~2022-12-05 8:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 8:04 [PATCH v1 0/6] LoongArch linker relaxation support mengqinggang
2022-12-05 8:04 ` mengqinggang [this message]
2022-12-05 8:24 ` [PATCH v1 1/6] LoongArch: include: Add support for linker relaxation Xi Ruoyao
2022-12-06 2:59 ` mengqinggang
2022-12-05 8:04 ` [PATCH v1 2/6] LoongArch: bfd: " mengqinggang
2022-12-05 8:04 ` [PATCH v1 3/6] LoongArch: opcodes: " mengqinggang
2022-12-05 9:43 ` Andreas Schwab
2022-12-05 8:04 ` [PATCH v1 4/6] LoongArch: binutils: " mengqinggang
2022-12-05 8:04 ` [PATCH v1 5/6] LoongArch: gas: " mengqinggang
2022-12-05 9:47 ` Andreas Schwab
2022-12-05 8:04 ` [PATCH v1 6/6] LoongArch: ld: " mengqinggang
2022-12-05 8:31 ` Xi Ruoyao
2022-12-05 8:43 ` [PATCH v1 0/6] LoongArch linker relaxation support Xi Ruoyao
2022-12-06 1:58 ` mengqinggang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221205080453.1352069-2-mengqinggang@loongson.cn \
--to=mengqinggang@loongson.cn \
--cc=binutils@sourceware.org \
--cc=chenglulu@loongson.cn \
--cc=i.swmail@xen0n.name \
--cc=liuzhensong@loongson.cn \
--cc=maskray@google.com \
--cc=xry111@xry111.site \
--cc=xuchenghua@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).