mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-12 03:32:10 +00:00
MC: Add support for disabling "temporary label" behavior. Useful for debugging
on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cede7c0551
commit
c6cf43d258
@ -84,6 +84,11 @@ namespace llvm {
|
||||
MCDwarfLoc CurrentDwarfLoc;
|
||||
bool DwarfLocSeen;
|
||||
|
||||
/// Honor temporary labels, this is useful for debugging semantic
|
||||
/// differences between temporary and non-temporary labels (primarily on
|
||||
/// Darwin).
|
||||
bool AllowTemporaryLabels;
|
||||
|
||||
/// The dwarf line information from the .loc directives for the sections
|
||||
/// with assembled machine instructions have after seeing .loc directives.
|
||||
DenseMap<const MCSection *, MCLineSection *> MCLineSections;
|
||||
@ -109,6 +114,8 @@ namespace llvm {
|
||||
|
||||
const TargetAsmInfo &getTargetAsmInfo() const { return *TAI; }
|
||||
|
||||
void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
|
||||
|
||||
/// @name Symbol Management
|
||||
/// @{
|
||||
|
||||
|
@ -28,7 +28,8 @@ typedef StringMap<const MCSectionCOFF*> COFFUniqueMapTy;
|
||||
|
||||
MCContext::MCContext(const MCAsmInfo &mai, const TargetAsmInfo *tai) :
|
||||
MAI(mai), TAI(tai), NextUniqueID(0),
|
||||
CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0) {
|
||||
CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0),
|
||||
AllowTemporaryLabels(true) {
|
||||
MachOUniquingMap = 0;
|
||||
ELFUniquingMap = 0;
|
||||
COFFUniquingMap = 0;
|
||||
@ -76,8 +77,10 @@ MCSymbol *MCContext::GetOrCreateSymbol(StringRef Name) {
|
||||
}
|
||||
|
||||
MCSymbol *MCContext::CreateSymbol(StringRef Name) {
|
||||
// Determine whether this is an assembler temporary or normal label.
|
||||
bool isTemporary = Name.startswith(MAI.getPrivateGlobalPrefix());
|
||||
// Determine whether this is an assembler temporary or normal label, if used.
|
||||
bool isTemporary = false;
|
||||
if (AllowTemporaryLabels)
|
||||
isTemporary = Name.startswith(MAI.getPrivateGlobalPrefix());
|
||||
|
||||
StringMapEntry<bool> *NameEntry = &UsedNames.GetOrCreateValue(Name);
|
||||
if (NameEntry->getValue()) {
|
||||
|
33
test/MC/MachO/temp-labels.s
Normal file
33
test/MC/MachO/temp-labels.s
Normal file
@ -0,0 +1,33 @@
|
||||
// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -L -o - | macho-dump --dump-section-data | FileCheck %s
|
||||
|
||||
// CHECK: # Load Command 1
|
||||
// CHECK: (('command', 2)
|
||||
// CHECK: ('size', 24)
|
||||
// CHECK: ('symoff', 296)
|
||||
// CHECK: ('nsyms', 2)
|
||||
// CHECK: ('stroff', 328)
|
||||
// CHECK: ('strsize', 8)
|
||||
// CHECK: ('_string_data', '\x00_f0\x00L0\x00')
|
||||
// CHECK: ('_symbols', [
|
||||
// CHECK: # Symbol 0
|
||||
// CHECK: (('n_strx', 1)
|
||||
// CHECK: ('n_type', 0xe)
|
||||
// CHECK: ('n_sect', 1)
|
||||
// CHECK: ('n_desc', 0)
|
||||
// CHECK: ('n_value', 0)
|
||||
// CHECK: ('_string', '_f0')
|
||||
// CHECK: ),
|
||||
// CHECK: # Symbol 1
|
||||
// CHECK: (('n_strx', 5)
|
||||
// CHECK: ('n_type', 0xe)
|
||||
// CHECK: ('n_sect', 1)
|
||||
// CHECK: ('n_desc', 0)
|
||||
// CHECK: ('n_value', 4)
|
||||
// CHECK: ('_string', 'L0')
|
||||
// CHECK: ),
|
||||
// CHECK: ])
|
||||
// CHECK: ),
|
||||
_f0:
|
||||
.long 0
|
||||
L0:
|
||||
.long 0
|
@ -113,6 +113,10 @@ static cl::opt<bool>
|
||||
NoInitialTextSection("n", cl::desc(
|
||||
"Don't assume assembly file starts in the text section"));
|
||||
|
||||
static cl::opt<bool>
|
||||
SaveTempLabels("L", cl::desc(
|
||||
"Don't discard temporary labels"));
|
||||
|
||||
enum ActionType {
|
||||
AC_AsLex,
|
||||
AC_Assemble,
|
||||
@ -327,6 +331,8 @@ static int AssembleInput(const char *ProgName) {
|
||||
|
||||
const TargetAsmInfo *tai = new TargetAsmInfo(*TM);
|
||||
MCContext Ctx(*MAI, tai);
|
||||
if (SaveTempLabels)
|
||||
Ctx.setAllowTemporaryLabels(false);
|
||||
|
||||
OwningPtr<tool_output_file> Out(GetOutputStream());
|
||||
if (!Out)
|
||||
|
Loading…
x
Reference in New Issue
Block a user