summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Give the MCStreamer class hierarchy LLVM RTTI facilities for use withChandler Carruth2013-01-311-7/+8
| | | | | | | | | | | | | | | | isa<> and dyn_cast<>. In several places, code is already hacking around the absence of this, and there seem to be several interfaces that might be lifted and/or devirtualized using this. This change was based on a discussion with Jim Grosbach about how best to handle testing for specific MCStreamer subclasses. He said that this was the correct end state, and everything else was too hacky so I decided to just make it so. No functionality should be changed here, this is just threading the kind through all the constructors and setting up the classof overloads. llvm-svn: 174113
* [MC][COFF] Delay handling symbol aliases when writingMichael J. Spencer2013-01-291-39/+0
| | | | | | Fixes PR14447 and PR9034. Patch by Nico Rieck! llvm-svn: 173839
* Expose an InitToTextSection through MCStreamer.Eli Bendersky2013-01-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to fix the following piece of code in the platform-independent AsmParser: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.SwitchSection(Ctx.getMachOSection( "__TEXT", "__text", MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, SectionKind::getText())); } } This was added for the "-n" option of llvm-mc. The proposed fix adds another virtual method to MCStreamer, called InitToTextSection. Conceptually, it's similar to the existing InitSections which initializes all common sections and switches to text. The new method is implemented by each platform streamer in a way that it sees fit. So AsmParser can now do this: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.InitToTextSection(); } } Which is much more reasonable. llvm-svn: 172450
* [MC][COFF] Switch the COFF streamer over to using the MCObjectStreamer ↵Michael J. Spencer2013-01-031-22/+14
| | | | | | version of EmitInstruction. llvm-svn: 171437
* This patch is needed to make c++ exceptions work for mips16.Reed Kotler2012-12-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mips16 is really a processor decoding mode (ala thumb 1) and in the same program, mips16 and mips32 functions can exist and can call each other. If a jal type instruction encounters an address with the lower bit set, then the processor switches to mips16 mode (if it is not already in it). If the lower bit is not set, then it switches to mips32 mode. The linker knows which functions are mips16 and which are mips32. When relocation is performed on code labels, this lower order bit is set if the code label is a mips16 code label. In general this works just fine, however when creating exception handling tables and dwarf, there are cases where you don't want this lower order bit added in. This has been traditionally distinguished in gas assembly source by using a different syntax for the label. lab1: ; this will cause the lower order bit to be added lab2=. ; this will not cause the lower order bit to be added In some cases, it does not matter because in dwarf and debug tables the difference of two labels is used and in that case the lower order bits subtract each other out. To fix this, I have added to mcstreamer the notion of a debuglabel. The default is for label and debug label to be the same. So calling EmitLabel and EmitDebugLabel produce the same result. For various reasons, there is only one set of labels that needs to be modified for the mips exceptions to work. These are the "$eh_func_beginXXX" labels. Mips overrides the debug label suffix from ":" to "=." . This initial patch fixes exceptions. More changes most likely will be needed to DwarfCFException to make all of this work for actual debugging. These changes will be to emit debug labels in some places where a simple label is emitted now. Some historical discussion on this from gcc can be found at: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00623.html http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01273.html llvm-svn: 170279
* Refactor MCInstFragment and MCDataFragment to adhere to a common interface,Eli Bendersky2012-12-071-4/+5
| | | | | | | | | which removes code duplication and prepares the ground for future additions. Full discussion: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121203/158233.html llvm-svn: 169626
* Some common functionality from WinCOFFStreamer::EmitAssignment can be nowEli Bendersky2012-12-071-3/+1
| | | | | | delegated to MCObjectStreamer. llvm-svn: 169617
* Lift EmitAssignment into MCObjectStreamer which gets rid of at least threeEli Bendersky2012-12-071-2/+0
| | | | | | duplicate implementations in format-specific streamers. llvm-svn: 169613
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-8/+8
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Hoist some grossly duplicated code from the COFF/ELF/MachO streamers into ↵Benjamin Kramer2012-10-041-42/+0
| | | | | | MCObjectStreamer. llvm-svn: 165225
* EmitZerofill should take a 64-bit size or else it's chopping off large ↵Evan Cheng2012-06-221-2/+2
| | | | | | zero-filled global. rdar://11729134 llvm-svn: 159023
* Prune some includesCraig Topper2012-03-271-1/+0
| | | | llvm-svn: 153502
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-1/+0
| | | | llvm-svn: 148578
* 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
* Section relative fixups are a coff concept, not a x86 one. Replace theRafael Espindola2011-12-241-3/+1
| | | | | | x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4. llvm-svn: 147252
* Add back the MC bits of 126425. Original patch by Nathan Jeffords. I added theRafael Espindola2011-12-171-0/+14
| | | | | | asm parsing and testcase. llvm-svn: 146801
* Don't drop alignment info on local common symbols.Benjamin Kramer2011-09-011-3/+5
| | | | | | | | | | | - 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
* Move TargetRegistry and TargetSelect from Target to Support where they belong.Evan Cheng2011-08-241-1/+1
| | | | | | These are strictly utilities for registering targets and components. llvm-svn: 138450
* Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to ↵Evan Cheng2011-07-251-6/+6
| | | | | | createMCAsmBackend. llvm-svn: 136010
* Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where ↵Evan Cheng2011-07-231-1/+1
| | | | | | they belong. llvm-svn: 135833
* Implement emission of all Win64 exception tables. Make the COFF streamer emitCharles Davis2011-05-221-0/+1
| | | | | | these tables. llvm-svn: 131833
* Make the COFF streamer emit unwind info when processing a .seh_handlerdataCharles Davis2011-05-221-0/+10
| | | | | | | | | | directive. Implement emission of Win64 EH unwind info. Pull in <cassert> in MCWin64EH.h so it can use the assert() macro. llvm-svn: 131832
* Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.Cameron Zwarich2011-02-251-18/+0
| | | | llvm-svn: 126488
* Enable DebugInfo support for COFF object files.Devang Patel2011-02-241-0/+18
| | | | | | Patch by Nathan Jeffords! llvm-svn: 126425
* 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
* Don't use PadSectionToAlignment on windows.Rafael Espindola2010-12-061-1/+1
| | | | llvm-svn: 120978
* Move EmitValueToOffset to the ObjectStreamer.Rafael Espindola2010-12-021-6/+0
| | | | llvm-svn: 120691
* Move EmitValue to MCObjectStreamer.Rafael Espindola2010-11-281-24/+0
| | | | llvm-svn: 120269
* Fixed verson of r120245.Rafael Espindola2010-11-281-18/+1
| | | | | | Factor some duplicated code into MCObjectStreamer::EmitLabel. llvm-svn: 120248
* Revert previous patch while I debug the darwin bootstrap failure.Rafael Espindola2010-11-281-0/+23
| | | | llvm-svn: 120246
* Factor some duplicated code into MCObjectStreamer::EmitLabel.Rafael Espindola2010-11-281-23/+0
| | | | llvm-svn: 120245
* Avoid code duplication in the many unsupported EmitGPRel32Value implementations.Rafael Espindola2010-11-281-5/+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
* 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
* MC'ize the '.code 16' and '.thumb_func' ARM directives.Jim Grosbach2010-11-051-0/+5
| | | | llvm-svn: 118301
* Move EmitInstruction to MCObjectStreamer so that ELF and MachO can share it.Rafael Espindola2010-11-011-0/+7
| | | | llvm-svn: 117925
* MC-COFF: Add support for default-null weak externals.Michael J. Spencer2010-10-161-3/+5
| | | | llvm-svn: 116666
* MC-COFF: Implement InitSections. Fixes PR8335.Michael J. Spencer2010-10-091-0/+39
| | | | llvm-svn: 116151
* MC-COFF: Assert on non-coff sections.Michael J. Spencer2010-10-091-0/+16
| | | | llvm-svn: 116148
* Minor cosmetic change: fix DOSish \r\n.NAKAMURA Takumi2010-10-071-4/+4
| | | | llvm-svn: 115910
* MC-COFF: Fix symbol aliases. Fixes PR8251.Michael J. Spencer2010-10-071-5/+36
| | | | llvm-svn: 115909
* Avoid some Mach-O specific alignment being done on ELF.Rafael Espindola2010-09-221-1/+1
| | | | llvm-svn: 114594
* Add a InitSections method to the streamer interface.Rafael Espindola2010-09-151-0/+4
| | | | | | | | | | | | | | The ELF implementation now creates text, data and bss to match the gnu as behavior. The text streamer still has the old MachO specific behavior since the testsuite checks that it will error when a directive is given before a setting the current section for example. A nice benefit is that -n is not required anymore when producing ELF files. llvm-svn: 114027
* MC: Fix inconsistant naming in COFF object writer. Patch by Cameron Esfahani.Michael J. Spencer2010-08-251-3/+4
| | | | llvm-svn: 112076
* Add relax all support to the COFF object streamer.Michael J. Spencer2010-07-311-2/+5
| | | | llvm-svn: 109947
* MC: Add WinCOFFStreamer implementation and merge common code from MachOMichael J. Spencer2010-07-191-37/+184
| | | | | | | | into MCObjectStreamer. Origonal Windows COFF implementation by Nathan Jedffords. llvm-svn: 108678
* introduce WinCOFFStreamer.cpp, patch by Michael Spencer!Chris Lattner2010-07-111-0/+198
llvm-svn: 108102
OpenPOWER on IntegriCloud