mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement ELF protocol conformance loading.
This works by loading the protocols from a specially named symbol, which is generated by the linker through the help of a linker script that merges all of the protocol conformance blocks into one section with its size at the start of it and points a global symbol at the section. We do all this because unlike MachO, section information does not survive to be loaded into memory with ELF binaries. Instead, the mappings that survive are 'segments', which contain one or more sections. Information about how these relate to their original sections is difficult, if not impossible, to obtain at runtime. Swift SVN r23518
This commit is contained in:
@@ -1729,7 +1729,17 @@ namespace {
|
||||
? Twine("_$_") + CategoryName.str()
|
||||
: Twine()));
|
||||
var->setAlignment(IGM.getPointerAlignment().getValue());
|
||||
var->setSection("__DATA, __objc_const");
|
||||
switch (IGM.TargetInfo.OutputObjectFormat) {
|
||||
case llvm::Triple::MachO:
|
||||
var->setSection("__DATA, __objc_const");
|
||||
break;
|
||||
case llvm::Triple::ELF:
|
||||
var->setSection(".data");
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Don't know how to emit private global constants for "
|
||||
"the selected object format.");
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user