Skip to content

Commit 3638204

Browse files
committed
Fix lld test
Created using spr 1.3.6-beta.1
2 parents 7d6bb23 + c927226 commit 3638204

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

llvm/docs/LangRef.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8381,7 +8381,7 @@ Example:
83818381

83828382
@global = global i32 1, !elf_section_properties !{i32 1879002126, i32 8}
83838383

8384-
This defines as global with type ``SHT_LLVM_CFI_JUMP_TABLE`` and entry
8384+
This defines a global with type ``SHT_LLVM_CFI_JUMP_TABLE`` and entry
83858385
size 8.
83868386

83878387

llvm/lib/IR/Verifier.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,22 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
763763
DL.getIntPtrType(GO->getType()),
764764
RangeLikeMetadataKind::AbsoluteSymbol);
765765
}
766+
767+
if (auto *Props = GO->getMetadata(LLVMContext::MD_elf_section_properties)) {
768+
Check(Props->getNumOperands() == 2,
769+
"elf_section_properties metadata must have two operands", GO, Props);
770+
if (Props->getNumOperands() == 2) {
771+
auto *Type = dyn_cast<ConstantAsMetadata>(Props->getOperand(0));
772+
Check(Type, "type field must be ConstantAsMetadata", GO, Props);
773+
auto *TypeInt = dyn_cast<ConstantInt>(Type->getValue());
774+
Check(TypeInt, "type field must be ConstantInt", GO, Props);
775+
776+
auto *Entsize = dyn_cast<ConstantAsMetadata>(Props->getOperand(1));
777+
Check(Entsize, "entsize field must be ConstantAsMetadata", GO, Props);
778+
auto *EntsizeInt = dyn_cast<ConstantInt>(Entsize->getValue());
779+
Check(EntsizeInt, "entsize field must be ConstantInt", GO, Props);
780+
}
781+
}
766782
}
767783

768784
Check(!GV.hasAppendingLinkage() || isa<GlobalVariable>(GV),

llvm/test/Transforms/MergeFunc/cfi-thunk-merging.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ attributes #3 = { noreturn nounwind }
201201
;
202202
;
203203
; LOWERTYPETESTS-LABEL: define private void @.cfi.jumptable
204-
; LOWERTYPETESTS-SAME: () #[[ATTR3:[0-9]+]] align 8 {
204+
; LOWERTYPETESTS-SAME: () #[[ATTR3:[0-9]+]] align 8 !elf_section_properties {{.*}} {
205205
; LOWERTYPETESTS-NEXT: entry:
206206
; LOWERTYPETESTS-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f)
207207
; LOWERTYPETESTS-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f_thunk)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
2+
3+
; CHECK: elf_section_properties metadata must have two operands
4+
@g1 = global i32 0, !elf_section_properties !{i32 0}
5+
; CHECK: type field must be ConstantAsMetadata
6+
@g2 = global i32 0, !elf_section_properties !{!{}, i32 0}
7+
; CHECK: entsize field must be ConstantAsMetadata
8+
@g3 = global i32 0, !elf_section_properties !{i32 0, !{}}
9+
; CHECK: type field must be ConstantInt
10+
@g4 = global i32 0, !elf_section_properties !{float 0.0, i32 0}
11+
; CHECK: entsize field must be ConstantInt
12+
@g5 = global i32 0, !elf_section_properties !{i32 0, float 0.0}

0 commit comments

Comments
 (0)