summaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorMatheus Tavares Bernardino <[email protected]>2024-04-04 14:19:40 -0300
committerMark Wielaard <[email protected]>2024-04-04 21:23:54 +0200
commit3704fc0297a03769c60dcfc730948bd4728d1765 (patch)
tree9fc585bc0b0f47934ad4e56931e08eb710f2f897 /backends
parent7cf68d0b84d7990d03c4ab15c210952f7c735c2a (diff)
Hexagon: implement machine flag check
This fixes the "invalid machine flag" error from eu-elflint when passing hexagon binaries. * backends/hexagon_init.c (hexagon_init): Hook machine_flag_check * backends/hexagon_symbol.c (hexagon_machine_flag_check): new function * libelf/elf-knowledge.h: add EF_HEXAGON_TINY constant Signed-off-by: Matheus Tavares Bernardino <[email protected]>
Diffstat (limited to 'backends')
-rw-r--r--backends/hexagon_init.c1
-rw-r--r--backends/hexagon_symbol.c7
2 files changed, 8 insertions, 0 deletions
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..5f6e0fe5 100644
--- a/backends/hexagon_symbol.c
+++ b/backends/hexagon_symbol.c
@@ -56,3 +56,10 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
return ELF_T_NUM;
}
}
+
+bool
+hexagon_machine_flag_check (GElf_Word flags)
+{
+ GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | EF_HEXAGON_MACH);
+ return (flags & reserved_flags) == 0;
+}