/// have names in the .o file. This is often "." or "L".
const char *PrivateGlobalPrefix; // Defaults to "."
+ /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
+ /// emitted before jump tables with the specified prefix.
+ const char *JumpTableSpecialLabelPrefix; // Default to null.
+
/// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
/// will enclose any GlobalVariable (that isn't a function)
///
const char *getPrivateGlobalPrefix() const {
return PrivateGlobalPrefix;
}
+ const char *getJumpTableSpecialLabelPrefix() const {
+ return JumpTableSpecialLabelPrefix;
+ }
const char *getGlobalVarAddrPrefix() const {
return GlobalVarAddrPrefix;
}
if (EmittedSets.insert(JTBBs[ii]).second)
printSetLabel(i, JTBBs[ii]);
+ // On some targets (e.g. darwin) we want to emit two consequtive labels
+ // before each jump table. The first label is never referenced, but tells
+ // the assembler and linker the extents of the jump table object. The
+ // second label is actually referenced by the code.
+ if (const char *JTLabelPrefix = TAI->getJumpTableSpecialLabelPrefix())
+ O << JTLabelPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n";
+
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << i << ":\n";
<< '_' << i << "_set_" << JTBBs[ii]->getNumber();
} else if (IsPic) {
printBasicBlockLabel(JTBBs[ii], false, false);
- //If the arch uses custom Jump Table directives, don't calc relative to JT
+ // If the arch uses custom Jump Table directives, don't calc relative to
+ // JT
if (!HadJTEntryDirective)
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
<< getFunctionNumber() << '_' << i;