[Hexagon] Correctly set "Flags" in ELF header

llvm-svn: 267397
This commit is contained in:
Krzysztof Parzyszek 2016-04-25 12:49:47 +00:00
parent 4181657e21
commit 18108f55f4
2 changed files with 16 additions and 3 deletions

View File

@ -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);
}

View File

@ -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