llvm-6502/lib/MC
Kevin Enderby 4f066b6db8 The integrated darwin assembler can hang in an infinite loop (or get an assert
with a debug build) with this buggy .indirect_symbol directive usage:

% cat test.s
x: .indirect_symbol _y

The assertion is because it is trying to get the symbol index for the
symbol _y when it is writing out the indirect symbol table. This line of
code in MachObjectWriter::WriteObject() :

        Write32(Asm.getSymbolData(*it->Symbol).getIndex());

And while there is a symbol _y it does not have any getSymbolData set which
is only done in MachObjectWriter::BindIndirectSymbols() for pointer sections
or stub sections.  I added a check and an error in there to catch this in case
something slips through.

But to get a better error the parser should detect when a .indirect_symbol
directive is used and it is not in a pointer section or stub section.  To make
that work I moved the handling of the indirect symbol out of the target
independent AsmParser code into the DarwinAsmParser code that can check
for the proper Mach-O section types.

rdar://14825505


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189497 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 17:50:59 +00:00
..
MCDisassembler
MCParser The integrated darwin assembler can hang in an infinite loop (or get an assert 2013-08-28 17:50:59 +00:00
CMakeLists.txt MC CFG: Add YAML MCModule representation to enable MC CFG testing. 2013-08-21 07:29:02 +00:00
ELFObjectWriter.cpp
LLVMBuild.txt
MachObjectWriter.cpp The integrated darwin assembler can hang in an infinite loop (or get an assert 2013-08-28 17:50:59 +00:00
Makefile
MCAsmBackend.cpp Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]). 2013-07-15 04:27:47 +00:00
MCAsmInfo.cpp Remove support for the .debug_inlined section. No known software 2013-08-28 04:04:28 +00:00
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
MCAsmStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCAssembler.cpp Move assert above first use of variable that we'd be asserting on. 2013-08-07 18:51:09 +00:00
MCAtom.cpp MC CFG: Remap enough for data too, analoguous to r188873. 2013-08-21 19:40:28 +00:00
MCCodeEmitter.cpp
MCCodeGenInfo.cpp
MCContext.cpp
MCDisassembler.cpp
MCDwarf.cpp
MCELF.cpp
MCELFObjectTargetWriter.cpp
MCELFStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCExpr.cpp
MCExternalSymbolizer.cpp
MCFunction.cpp Style cleanup following David's review for r188876. 2013-08-21 19:40:25 +00:00
MCInst.cpp
MCInstPrinter.cpp Pacify GCC, which worries about falling off the end of the switch. 2013-08-02 09:37:20 +00:00
MCInstrAnalysis.cpp
MCLabel.cpp
MCMachObjectTargetWriter.cpp
MCMachOStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCModule.cpp MC CFG: Split MCBasicBlocks to mirror atom splitting. 2013-08-21 07:28:24 +00:00
MCModuleYAML.cpp MC CFG: Add YAML MCModule representation to enable MC CFG testing. 2013-08-21 07:29:02 +00:00
MCNullStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCObjectDisassembler.cpp Revert "Fix the build broken by r189315." and "Move everything depending on Object/MachOFormat.h over to Support/MachO.h." 2013-08-27 05:38:30 +00:00
MCObjectFileInfo.cpp [-cxx-abi microsoft] Stick zero initialized symbols into the .bss section for COFF 2013-08-13 01:23:53 +00:00
MCObjectStreamer.cpp Add 'const' qualifiers to static const char* variables. 2013-07-16 01:17:10 +00:00
MCObjectSymbolizer.cpp Revert "Fix the build broken by r189315." and "Move everything depending on Object/MachOFormat.h over to Support/MachO.h." 2013-08-27 05:38:30 +00:00
MCObjectWriter.cpp
MCPureStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCRegisterInfo.cpp
MCRelocationInfo.cpp
MCSection.cpp
MCSectionCOFF.cpp
MCSectionELF.cpp
MCSectionMachO.cpp
MCStreamer.cpp Fix wrong code offset for unwind code SET_FPREG. 2013-08-27 04:16:16 +00:00
MCSubtargetInfo.cpp
MCSymbol.cpp
MCSymbolizer.cpp
MCValue.cpp
MCWin64EH.cpp Fix wrong code offset for unwind code SET_FPREG. 2013-08-27 04:16:16 +00:00
SubtargetFeature.cpp
WinCOFFObjectWriter.cpp MC: Support larger COFF string tables 2013-07-29 12:30:12 +00:00
WinCOFFStreamer.cpp [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00