From: Alexey Sheplyakov <asheplyakov@basealt.ru>
To: elfutils-devel@sourceware.org
Cc: Alexey Sheplyakov <asheplyakov@basealt.ru>
Subject: [PATCH] LoongArch: implemented a basic machine flag check
Date: Mon, 20 Mar 2023 18:45:02 +0400 [thread overview]
Message-ID: <20230320144502.3807720-1-asheplyakov@basealt.ru> (raw)
With this patch I can use eu-elflint to verify LoongArch ELF
binaries. Previously eu-elflint was complaining about invalid
machine flags:
$ ./src/elflint --gnu-ld ./src/elflint
invalid machine flags: 0x43
$ echo $?
1
Signed-off-by: Alexey Sheplyakov <asheplyakov@basealt.ru>
---
backends/loongarch_init.c | 1 +
backends/loongarch_symbol.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/backends/loongarch_init.c b/backends/loongarch_init.c
index a8ed9e81..59d8cc3d 100644
--- a/backends/loongarch_init.c
+++ b/backends/loongarch_init.c
@@ -45,6 +45,7 @@ loongarch_init (Elf *elf __attribute__ ((unused)),
{
loongarch_init_reloc (eh);
HOOK (eh, reloc_simple_type);
+ HOOK (eh, machine_flag_check);
return eh;
}
diff --git a/backends/loongarch_symbol.c b/backends/loongarch_symbol.c
index 8ba66a09..43306ab8 100644
--- a/backends/loongarch_symbol.c
+++ b/backends/loongarch_symbol.c
@@ -72,3 +72,10 @@ loongarch_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
return ELF_T_NUM;
}
}
+
+bool
+loongarch_machine_flag_check (GElf_Word flags)
+{
+ return ((flags &~ (EF_LARCH_ABI_MODIFIER_MASK
+ | EF_LARCH_OBJABI_V1)) == 0);
+}
--
2.33.5
next reply other threads:[~2023-03-20 14:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 14:45 Alexey Sheplyakov [this message]
2023-03-20 22:35 ` Mark Wielaard
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=20230320144502.3807720-1-asheplyakov@basealt.ru \
--to=asheplyakov@basealt.ru \
--cc=elfutils-devel@sourceware.org \
/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).