From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
To: <elfutils-devel@sourceware.org>
Cc: <bcain@quicinc.com>, <sidneym@quicinc.com>, <mark@klomp.org>
Subject: [PATCH 2/2] Hexagon: implement machine flag check
Date: Thu, 21 Mar 2024 18:09:10 -0300 [thread overview]
Message-ID: <0d011ba233face7165e519af8aca1bbd46f9d61b.1711055228.git.quic_mathbern@quicinc.com> (raw)
In-Reply-To: <cover.1711055228.git.quic_mathbern@quicinc.com>
This fixes the "invalid machine flag" error from eu-elflint when passing
hexagon binaries.
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
backends/hexagon_init.c | 1 +
backends/hexagon_symbol.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/backends/hexagon_init.c b/backends/hexagon_init.c
index 9c8c6d8d..1cd27513 100644
--- a/backends/hexagon_init.c
+++ b/backends/hexagon_init.c
@@ -45,6 +45,7 @@ hexagon_init (Elf *elf __attribute__ ((unused)),
{
hexagon_init_reloc (eh);
HOOK (eh, reloc_simple_type);
+ HOOK (eh, machine_flag_check);
return eh;
}
diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c
index b341243e..1e681e9f 100644
--- a/backends/hexagon_symbol.c
+++ b/backends/hexagon_symbol.c
@@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
return ELF_T_NUM;
}
}
+
+bool
+hexagon_machine_flag_check (GElf_Word flags)
+{
+ GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH;
+ /* 0x8000 covers the "tiny core" arch variants. */
+ return arch_variant == 0 || arch_variant == 0x8000;
+}
--
2.37.2
next prev parent reply other threads:[~2024-03-21 21:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 21:09 [PATCH 0/2] Add initial support for Hexagon Matheus Tavares Bernardino
2024-03-21 21:09 ` [PATCH 1/2] Add " Matheus Tavares Bernardino
2024-03-21 21:09 ` Matheus Tavares Bernardino [this message]
2024-03-21 21:13 ` [PATCH 0/2] Add initial " Brian Cain
2024-03-28 13:45 ` Mark Wielaard
2024-03-28 22:20 ` Matheus Bernardino
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=0d011ba233face7165e519af8aca1bbd46f9d61b.1711055228.git.quic_mathbern@quicinc.com \
--to=quic_mathbern@quicinc.com \
--cc=bcain@quicinc.com \
--cc=elfutils-devel@sourceware.org \
--cc=mark@klomp.org \
--cc=sidneym@quicinc.com \
/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).