Skip to content

Commit 835a800

Browse files
committed
Address review feedback
1 parent 2c47c28 commit 835a800

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

llvm/include/llvm/BinaryFormat/ELF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ enum : unsigned {
12991299
// Section data is string data by default.
13001300
SHF_MIPS_STRING = 0x80000000,
13011301

1302-
// Make code section unreadable when in execute-only mode
1302+
// Section contains only program instructions and no program data.
13031303
SHF_ARM_PURECODE = 0x20000000,
13041304

13051305
// Section contains only program instructions and no program data.

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,12 @@ static unsigned getELFSectionFlags(SectionKind K, const Triple &T) {
559559
if (K.isText())
560560
Flags |= ELF::SHF_EXECINSTR;
561561

562-
if ((T.isARM() || T.isThumb()) && K.isExecuteOnly())
563-
Flags |= ELF::SHF_ARM_PURECODE;
564-
565-
if (T.isAArch64() && K.isExecuteOnly())
566-
Flags |= ELF::SHF_AARCH64_PURECODE;
562+
if (K.isExecuteOnly()) {
563+
if (T.isAArch64())
564+
Flags |= ELF::SHF_AARCH64_PURECODE;
565+
else if (T.isARM() || T.isThumb())
566+
Flags |= ELF::SHF_ARM_PURECODE;
567+
}
567568

568569
if (K.isWriteable())
569570
Flags |= ELF::SHF_WRITE;

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
295295
TM.getSubtargetImpl(*Callee)->getFeatureBits();
296296
// Adjust the feature bitsets by inverting some of the bits. This is needed
297297
// for target features that represent restrictions rather than capabilities,
298-
// for example "+execute-only".
298+
// for example a "+execute-only" callee can be inlined into a caller without
299+
// "+execute-only", but not vice versa.
299300
FeatureBitset EffectiveCallerBits = CallerBits ^ InlineInverseFeatures;
300301
FeatureBitset EffectiveCalleeBits = CalleeBits ^ InlineInverseFeatures;
301302

0 commit comments

Comments
 (0)