]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Hexagon: implement machine flag check
authorMatheus Tavares Bernardino <quic_mathbern@quicinc.com>
Thu, 4 Apr 2024 17:19:40 +0000 (14:19 -0300)
committerMark Wielaard <mark@klomp.org>
Thu, 4 Apr 2024 19:23:54 +0000 (21:23 +0200)
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 <quic_mathbern@quicinc.com>
backends/hexagon_init.c
backends/hexagon_symbol.c
libelf/elf-knowledge.h

index 9c8c6d8d7238302e2df67ced2e9611555808b2bd..1cd275132973183b02dd5486b99d21c6b8f075a6 100644 (file)
@@ -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;
 }
index b341243ecd3d997da3642818de8e71d8a0ddc0d3..5f6e0fe5c7b718b6e80066577c4e512aef574f58 100644 (file)
@@ -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;
+}
index 7153593418bc729a1d3cf68f81d3265c0e2cacb0..23e34ca13c8f0ebe398b12c9f68ad6b6941f3c12 100644 (file)
 #define EF_HEXAGON_MACH_V71T 0x00008071 /* Hexagon V71T */
 #define EF_HEXAGON_MACH_V73  0x00000073 /* Hexagon V73 */
 #define EF_HEXAGON_MACH      0x000003ff /* Hexagon V.. */
+#define EF_HEXAGON_TINY      0x00008000 /* Hexagon V..T */
 
 /* Special section indices.  */
 #define SHN_HEXAGON_SCOMMON    0xff00 /* Other access sizes */