[llvm-dev] [hexagon] bug fix for ELFHeaderEFlags

Mingjie Xing via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 11 17:56:05 PDT 2016


I run into a problem that llvm can't write the correct ELFHeaderEFlags
for hexagonv4. The following patch can fix it.

Index: lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
--- lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp    (revision 265917)
+++ lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp    (working copy)
@@ -122,7 +122,7 @@
       : HexagonTargetStreamer(S) {
     auto Bits = STI.getFeatureBits();
     unsigned Flags;
-    if (Bits.to_ullong() & llvm::Hexagon::ArchV5)
+    if (Bits[Hexagon::ArchV5])
       Flags = ELF::EF_HEXAGON_MACH_V5;
       Flags = ELF::EF_HEXAGON_MACH_V4;

Maybe hexagon port maintainer has a better solution to handle
Hexagon::ArchV60 etc.

Best regards,

More information about the llvm-dev mailing list