[llvm] r267397 - [Hexagon] Correctly set "Flags" in ELF header

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 05:49:49 PDT 2016


Author: kparzysz
Date: Mon Apr 25 07:49:47 2016
New Revision: 267397

URL: http://llvm.org/viewvc/llvm-project?rev=267397&view=rev
Log:
[Hexagon] Correctly set "Flags" in ELF header

Added:
    llvm/trunk/test/MC/Hexagon/elf-flags.ll
Modified:
    llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp

Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp?rev=267397&r1=267396&r2=267397&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp Mon Apr 25 07:49:47 2016
@@ -157,10 +157,14 @@ public:
   HexagonTargetELFStreamer(MCStreamer &S, MCSubtargetInfo const &STI)
       : HexagonTargetStreamer(S) {
     auto Bits = STI.getFeatureBits();
-    unsigned Flags;
-    if (Bits.to_ullong() & llvm::Hexagon::ArchV5)
+    unsigned Flags = 0;
+    if (Bits[Hexagon::ArchV60])
+      Flags = ELF::EF_HEXAGON_MACH_V60;
+    else if (Bits[Hexagon::ArchV55])
+      Flags = ELF::EF_HEXAGON_MACH_V55;
+    else if (Bits[Hexagon::ArchV5])
       Flags = ELF::EF_HEXAGON_MACH_V5;
-    else
+    else if (Bits[Hexagon::ArchV4])
       Flags = ELF::EF_HEXAGON_MACH_V4;
     getStreamer().getAssembler().setELFHeaderEFlags(Flags);
   }

Added: llvm/trunk/test/MC/Hexagon/elf-flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Hexagon/elf-flags.ll?rev=267397&view=auto
==============================================================================
--- llvm/trunk/test/MC/Hexagon/elf-flags.ll (added)
+++ llvm/trunk/test/MC/Hexagon/elf-flags.ll Mon Apr 25 07:49:47 2016
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon -mcpu=hexagonv4 --filetype=obj %s -o - | llvm-readobj -file-headers -elf-output-style=GNU | FileCheck --check-prefix=CHECK-V4 %s
+; RUN: llc -march=hexagon -mcpu=hexagonv5 --filetype=obj %s -o - | llvm-readobj -file-headers -elf-output-style=GNU | FileCheck --check-prefix=CHECK-V5 %s
+; RUN: llc -march=hexagon -mcpu=hexagonv55 --filetype=obj %s -o - | llvm-readobj -file-headers -elf-output-style=GNU | FileCheck --check-prefix=CHECK-V55 %s
+; RUN: llc -march=hexagon -mcpu=hexagonv60 --filetype=obj %s -o - | llvm-readobj -file-headers -elf-output-style=GNU | FileCheck --check-prefix=CHECK-V60 %s
+
+; CHECK-V4: Flags: 0x3
+; CHECK-V5: Flags: 0x4
+; CHECK-V55: Flags: 0x5
+; CHECK-V60: Flags: 0x60




More information about the llvm-commits mailing list