summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCMachOStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor data-in-code annotations.Jim Grosbach2012-05-181-1/+43
| | | | | | | | | | | | | | | | | | | | | | Use a dedicated MachO load command to annotate data-in-code regions. This is the same format the linker produces for final executable images, allowing consistency of representation and use of introspection tools for both object and executable files. Data-in-code regions are annotated via ".data_region"/".end_data_region" directive pairs, with an optional region type. data_region_directive := ".data_region" { region_type } region_type := "jt8" | "jt16" | "jt32" | "jta32" end_data_region_directive := ".end_data_region" The previous handling of ARM-style "$d.*" labels was broken and has been removed. Specifically, it didn't handle ARM vs. Thumb mode when marking the end of the section. rdar://11459456 llvm-svn: 157062
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-8/+7
| | | | llvm-svn: 149967
* Tidy up. MCAsmBackend naming conventions.Jim Grosbach2012-01-181-1/+1
| | | | llvm-svn: 148400
* Remove unnecessary default cases in switches that cover all enum values.David Blaikie2012-01-101-2/+0
| | | | llvm-svn: 147855
* Split Finish into Finish and FinishImpl to have a common place to do end ofRafael Espindola2012-01-071-3/+3
| | | | | | | | file error checking. Use that to error on an unfinished cfi_startproc. The error is not nice, but is already better than a segmentation fault. llvm-svn: 147717
* Remove obsolete FIXME.Jim Grosbach2011-11-281-2/+0
| | | | llvm-svn: 145313
* Don't drop alignment info on local common symbols.Benjamin Kramer2011-09-011-1/+2
| | | | | | | | | | | - On COFF the .lcomm directive has an alignment argument. - On ELF we fall back to .local + .comm Based on a patch by NAKAMURA Takumi. Fixes PR9337, PR9483 and PR10128. llvm-svn: 138976
* Support .code32 and .code64 in X86 assembler.Evan Cheng2011-07-271-2/+3
| | | | llvm-svn: 136197
* Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to ↵Evan Cheng2011-07-251-5/+5
| | | | | | createMCAsmBackend. llvm-svn: 136010
* Add a missing enumerator to this switch. Currently its in theChandler Carruth2011-07-251-0/+1
| | | | | | | | | | | | | | assert-path code, as previously we would have fallen off the end of the function, but please review and let me know if this should go somewhere else. This fixes a Clang warning: lib/MC/MCMachOStreamer.cpp:201:11: error: enumeration value 'MCSA_IndirectSymbol' not handled in switch [-Werror,-Wswitch-enum] switch (Attribute) { ^ 1 error generated. llvm-svn: 135976
* Move some ELF directives into ELF asm parser.Jim Grosbach2011-07-251-1/+0
| | | | | | | | | | | | | | The .local, .hidden, .internal, and .protected are not legal for all supported file formats (in particular, they're invalid for MachO). Move the parsing for them into the ELF assembly parser since that's the format they're for. Similarly, .weak is used by COFF and ELF, but not MachO, so move the parsing to the COFF and ELF asm parsers. Previously, using any of these directives on Darwin would result in an assertion failure in the parser; now we get a diagnostic as we should. rdar://9827089 llvm-svn: 135921
* Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where ↵Evan Cheng2011-07-231-1/+1
| | | | | | they belong. llvm-svn: 135833
* Unfortunately several files in MC are badly violating layering rule by usingEvan Cheng2011-07-141-1/+0
| | | | | | | | | TargetAsmInfo, which in turn pulls in TargetRegisterInfo, etc. :-( There are other cases of violations, but this is probably the worst. This patch is but one small step towards fixing this. 500 more steps to go. :-( llvm-svn: 135131
* Factor some code into a new EmitFrames method.Rafael Espindola2011-05-101-2/+1
| | | | llvm-svn: 131119
* Add r130623 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.Rafael Espindola2011-05-011-0/+3
| | | | llvm-svn: 130658
* Revert the previous patch while I figure out how to make llvm-gccRafael Espindola2011-04-301-3/+0
| | | | | | less agressive about disabling cfi on linux :-( llvm-svn: 130626
* Enable CFI on OS X.Rafael Espindola2011-04-301-0/+3
| | | | | | | | | | | | | | | Currently the output should be almost identical to the one produced by CodeGen to make the transition easier. The only two differences I know of are: * Some files get an extra advance loc of size 0. This will be fixed when relaxations are enabled. * The optimization of declaring an EH symbol as an external variable is not implemented. This is a subset of adding the nounwind attribute, so we if really this at -O0 we should probably do it at the IL level. llvm-svn: 130623
* Handle PrivateExtern eh symbols.Rafael Espindola2011-04-301-0/+2
| | | | llvm-svn: 130609
* Mark the EH symbol global or weak if the corresponding function is.Rafael Espindola2011-04-281-0/+12
| | | | llvm-svn: 130397
* Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.Cameron Zwarich2011-02-251-3/+0
| | | | llvm-svn: 126488
* Enable DebugInfo support for COFF object files.Devang Patel2011-02-241-0/+3
| | | | | | Patch by Nathan Jeffords! llvm-svn: 126425
* Add support for pushsection and popsection. Patch by Joerg Sonnenberger.Rafael Espindola2011-02-161-1/+1
| | | | llvm-svn: 125629
* MC/Mach-O/Thumb: Set the thumb bit in the symbol table.Daniel Dunbar2010-12-291-2/+6
| | | | llvm-svn: 122630
* ARM Fixups relative to thumb functions need to have the low bit of the valueJim Grosbach2010-12-141-0/+4
| | | | | | set for interworking to work properly. rdar://8755956 llvm-svn: 121778
* Fixed version of 121434 with no new memory leaks.Rafael Espindola2010-12-101-9/+1
| | | | llvm-svn: 121471
* Revert my previous patch to make the valgrind bots happy.Rafael Espindola2010-12-101-1/+9
| | | | llvm-svn: 121461
* Initial support for the cfi directives. This is just enough to getRafael Espindola2010-12-091-9/+1
| | | | | | | | | | | f: .cfi_startproc nop .cfi_endproc assembled (on ELF). llvm-svn: 121434
* Let target asm backends see assembler flags as they go by. Use that to handleJim Grosbach2010-12-081-0/+3
| | | | | | thumb vs. arm mode differences in WriteNopData(). llvm-svn: 121219
* Sorry for such a large commit. The summary is that only MachO cares about theRafael Espindola2010-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | actuall addresses in a .o file, so it is better to let the MachO writer compute it. This is good for two reasons. First, areas that shouldn't care about addresses now don't have access to it. Second, the layout of each section is independent. I should use this in a subsequent commit to speed it up. Most of the patch is just removing the section address computation. The two interesting parts are the change on how we handle padding in the end of sections and how MachO can get the address of a-b when a and b are in different sections. Since now the expression evaluation normally doesn't know the section address, it will think that a-b needs relocation and let the MachO writer know. Once it has computed the section addresses, it calls back the expression evaluation with the section addresses to resolve these expressions. The remaining problem is the handling of padding. Currently it will create a special alignment fragment at the end. Since that fragment doesn't update the alignment of the section, it needs the real address to be computed. Since now the layout will not compute a-b with a and b in different sections, the only effect that the special alignment fragment has is update the address size of the section. This can also be done by the MachO writer. llvm-svn: 121076
* Try to resolve symbol differences early, and if successful create a plainRafael Espindola2010-12-031-4/+1
| | | | | | | data fragment. This reduces the time to assemble the test in 8711 from 60s to 54s. llvm-svn: 120767
* Move EmitValueToOffset to the ObjectStreamer.Rafael Espindola2010-12-021-7/+0
| | | | llvm-svn: 120691
* Add EmitInstToFragment to the generic object streamer.Rafael Espindola2010-12-021-18/+0
| | | | llvm-svn: 120690
* Move EmitValue to MCObjectStreamer.Rafael Espindola2010-11-281-21/+0
| | | | llvm-svn: 120269
* Fixed verson of r120245.Rafael Espindola2010-11-281-16/+4
| | | | | | Factor some duplicated code into MCObjectStreamer::EmitLabel. llvm-svn: 120248
* Revert previous patch while I debug the darwin bootstrap failure.Rafael Espindola2010-11-281-1/+16
| | | | llvm-svn: 120246
* Factor some duplicated code into MCObjectStreamer::EmitLabel.Rafael Espindola2010-11-281-16/+1
| | | | llvm-svn: 120245
* Avoid code duplication in the many unsupported EmitGPRel32Value implementations.Rafael Espindola2010-11-281-3/+0
| | | | llvm-svn: 120243
* Define generic 1, 2 and 4 byte pc relative relocations. They are commonRafael Espindola2010-11-281-1/+1
| | | | | | and at least the 4 byte one will be needed to implement the .cfi_* directives. llvm-svn: 120240
* Added support for the Mach-O .symbol_resolver directive. rdar://8673046Kevin Enderby2010-11-191-0/+4
| | | | llvm-svn: 119816
* Change some methods in MCDwarf.cpp to be able to handle an arbitraryRafael Espindola2010-11-191-1/+4
| | | | | | | | | | | | MCStreamer instead of just MCObjectStreamer. Address changes cannot be as efficient as we have to use DW_LNE_set_addres, but at least most of the logic is shared. This will be used so that, with CodeGen still using EmitDwarfLocDirective, llvm-gcc is able to produce debug_line sections without needing an assembler that supports .loc. llvm-svn: 119777
* Add .loc methods to the streamer.Rafael Espindola2010-11-161-6/+0
| | | | | | | Next: Add support for the !HasDotLocAndDotFile case to the MCAsmStreamer and then switch codegen to use it. llvm-svn: 119384
* Parse and record the gnu_unique_object type.Rafael Espindola2010-11-131-0/+1
| | | | llvm-svn: 118980
* Add '.code 32' assembler directive to MC streamers.Jim Grosbach2010-11-051-0/+1
| | | | llvm-svn: 118309
* MC'ize the '.code 16' and '.thumb_func' ARM directives.Jim Grosbach2010-11-051-1/+7
| | | | llvm-svn: 118301
* syntaxunified directive is a no-op for MachO writing.Jim Grosbach2010-11-051-0/+1
| | | | llvm-svn: 118287
* Move EmitInstruction to MCObjectStreamer so that ELF and MachO can share it.Rafael Espindola2010-11-011-37/+2
| | | | llvm-svn: 117925
* This adds a Darwin x86_64 relocation encoding for a subtraction expressionKevin Enderby2010-10-021-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where both symbols are "local", that is non-external symbols, and there is no "base" for the symbols used in the expression, that is the section has no non-temporary symbols. This case looks like this: % cat local_reloc_A-B.s .long 0 LB: .long 1 .long LA - LB - 4 .long 2 LA: .long 3 which llvm-mc will not encode without this patch, generates a "unsupported local relocations in difference" error, but the Darwin assembler will encode with relocation entries like this: % otool -rv a.out l.out a.out: Relocation information (__TEXT,__text) 2 entries address pcrel length extern type scattered symbolnum/value 00000008 False long False SUB False 1 (__TEXT,__text) 00000008 False long False UNSIGND False 1 (__TEXT,__text) which is very similar to what is encoded when the symbols don't have the leading 'L' and they are not temporary symbols. Which llvm-mc and the Darwin assembler will encoded like this: Relocation information (__TEXT,__text) 2 entries address pcrel length extern type scattered symbolnum/value 00000008 False long True SUB False B 00000008 False long True UNSIGND False A This is the missing relocation encoding needed to allow the Mach-O x86 Dwarf file and line table to be emitted. So this patch also removes the TODO from the if() statement in MCMachOStreamer::Finish() that didn't call MCDwarfFileTable::Emit() for 64-bit targets. llvm-svn: 115389
* This is the last major patch to implement support for the .loc directiveKevin Enderby2010-09-301-204/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | and output the dwarf line number tables. This contains the code to emit and encode the dwarf line tables from the previously gathered information in the MCLineSection objects. This contains all the details to encode the line and address deltas into the dwarf line table. To do this an MCDwarfLineAddrFragment has been added. Also this moves the interface code out of Mach-O streamer into MCDwarf so it should be useable by other object file formats. There is now one call to be made from an MCObjectStreamer EmitInstruction() method: MCLineEntry::Make(this, getCurrentSection()); to create a line entry after each instruction is assembled. And one call call to be made from an MCObjectStreamer Finish() method: MCDwarfFileTable::Emit(this, DwarfLineSection); when getContext().hasDwarfFiles() is true and is passed a object file specific MCSection where to emit the dwarf file and the line tables. This appears to now be correct for 32-bit targets, at least x86. But the relocation entries for 64-bit Darwin needs some further work which is next up to work on. So for now the 64-bit Mach-O target does not output the dwarf file and line tables. llvm-svn: 115157
* Silence a GCC warning about not handling all flags in this switch, weChandler Carruth2010-09-301-2/+2
| | | | | | specifically assert on unexpected flags. llvm-svn: 115143
* Avoid some Mach-O specific alignment being done on ELF.Rafael Espindola2010-09-221-1/+1
| | | | llvm-svn: 114594
OpenPOWER on IntegriCloud