Skip to content

Commit da01a18

Browse files
authored
[SPARC][IAS] Set correct ELF flag values for VIS & VIS2-enabled objects
Reviewers: brad0, s-barannikov, rorth Reviewed By: s-barannikov Pull Request: llvm#130966
1 parent 3853116 commit da01a18

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/lib/Target/Sparc/MCTargetDesc/SparcTargetStreamer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ static unsigned getEFlagsForFeatureSet(const MCSubtargetInfo &STI) {
2727
if (STI.hasFeature(Sparc::FeatureV8Plus))
2828
EFlags |= ELF::EF_SPARC_32PLUS;
2929

30+
if (STI.hasFeature(Sparc::FeatureVIS))
31+
EFlags |= ELF::EF_SPARC_SUN_US1;
32+
33+
if (STI.hasFeature(Sparc::FeatureVIS2))
34+
EFlags |= ELF::EF_SPARC_SUN_US3;
35+
36+
// VIS 3 and other ISA extensions doesn't set any flags.
37+
3038
return EFlags;
3139
}
3240

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Emit correct SPARC v9 ELF flags depending on feature options.
2+
## - `-mattr=+vis` sets the EF_SPARC_SUN_US1 flag; and
3+
## - `-mattr=+vis2` sets the EF_SPARC_SUN_US3 flag.
4+
5+
# RUN: llvm-mc -filetype=obj -triple sparcv9 %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=COMMON -DFLAG_VALUE=0x0 %s
6+
# RUN: llvm-mc -filetype=obj -triple sparcv9 -mattr=+vis %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=COMMON,FLAG -DFLAG_VALUE=0x200 -DFLAG_NAME=EF_SPARC_SUN_US1 %s
7+
# RUN: llvm-mc -filetype=obj -triple sparcv9 -mattr=+vis2 %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=COMMON,FLAG -DFLAG_VALUE=0x800 -DFLAG_NAME=EF_SPARC_SUN_US3 %s
8+
9+
# COMMON: Flags [ ([[FLAG_VALUE]])
10+
# FLAG: [[FLAG_NAME]]
11+
# COMMON-NEXT: ]

0 commit comments

Comments
 (0)