forked from OSchip/llvm-project
Check that the objc image info version is exactly 0
llvm-svn: 257953
This commit is contained in:
parent
230af4047d
commit
20de822232
|
@ -903,6 +903,14 @@ std::error_code parseObjCImageInfo(const NormalizedFile &normalizedFile,
|
||||||
" in file " + file.path() +
|
" in file " + file.path() +
|
||||||
" should be 8 bytes in size");
|
" should be 8 bytes in size");
|
||||||
|
|
||||||
|
const bool isBig = MachOLinkingContext::isBigEndian(normalizedFile.arch);
|
||||||
|
uint32_t version = read32(content.data(), isBig);
|
||||||
|
if (version)
|
||||||
|
return make_dynamic_error_code(imageInfoSection->segmentName + "/" +
|
||||||
|
imageInfoSection->sectionName +
|
||||||
|
" in file " + file.path() +
|
||||||
|
" should have version=0");
|
||||||
|
|
||||||
return std::error_code();
|
return std::error_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# RUN: not lld -flavor darwin -arch x86_64 -r %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
--- !mach-o
|
||||||
|
arch: x86_64
|
||||||
|
file-type: MH_OBJECT
|
||||||
|
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
|
||||||
|
compat-version: 0.0
|
||||||
|
current-version: 0.0
|
||||||
|
has-UUID: false
|
||||||
|
OS: unknown
|
||||||
|
sections:
|
||||||
|
- segment: __DATA
|
||||||
|
section: __objc_imageinfo
|
||||||
|
type: S_REGULAR
|
||||||
|
attributes: [ S_ATTR_NO_DEAD_STRIP ]
|
||||||
|
address: 0x0000000000000100
|
||||||
|
content: [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 ]
|
||||||
|
...
|
||||||
|
|
||||||
|
# CHECK: error: __DATA/__objc_imageinfo in file {{.*}} should have version=0
|
Loading…
Reference in New Issue