summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Assembler] Better error messages for .org directiveOliver Stannard2016-12-141-10/+20
| | | | | | | | | | | | | | | | | | | | | Currently, the error messages we emit for the .org directive when the expression is not absolute or is out of range do not include the line number of the directive, so it can be hard to track down the problem if a file contains many .org directives. This patch stores the source location in the MCOrgFragment, so that it can be used for diagnostics emitted during layout. Since layout is an iterative process, and the errors are detected during each iteration, it would have been possible for errors to be reported multiple times. To prevent this, I've made the assembler bail out after each iteration if any errors have been reported. This will still allow multiple unrelated errors to be reported in the common case where they are all detected in the first round of layout. Differential Revision: https://reviews.llvm.org/D27411 llvm-svn: 289643
* [MC] Don't crash when trying to emit a relocation against .bss.Davide Italiano2016-07-261-2/+2
| | | | | | Turn that into an error instead. llvm-svn: 276783
* Fix branch relaxation in 16-bit mode.Nirav Dave2016-07-111-1/+1
| | | | | | | | | | | | | | | Thread through MCSubtargetInfo to relaxInstruction function allowing relaxation to generate jumps with 16-bit sized immediates in 16-bit mode. This fixes PR22097. Reviewers: dwmw2, tstellarAMD, craig.topper, jyknight Subscribers: jfb, arsenm, jyknight, llvm-commits, dsanders Differential Revision: http://reviews.llvm.org/D20830 llvm-svn: 275068
* There's no reason to use _ to name variables different just for construction.Eric Christopher2016-05-241-3/+3
| | | | llvm-svn: 270622
* [MCAssembler] Allow backend to finalize layout post-relaxation.Colin LeMahieu2016-04-271-0/+1
| | | | | | Differential revision: http://reviews.llvm.org/D19429 llvm-svn: 267796
* [MC] Add support for encoding CodeView variable definition rangesDavid Majnemer2016-02-051-5/+27
| | | | | | | | | | | | | | | | | | | CodeView, like most other debug formats, represents the live range of a variable so that debuggers might print them out. They use a variety of records to represent how a particular variable might be available (in a register, in a frame pointer, etc.) along with a set of ranges where this debug information is relevant. However, the format only allows us to use ranges which are limited to a maximum of 0xF000 in size. This means that we need to split our debug information into chunks of 0xF000. Because the layout of code is not known until *very* late, we must use a new fragment to record the information we need until we can know *exactly* what the range is. llvm-svn: 259868
* [codeview] Wire up the .cv_inline_linetable directiveReid Kleckner2016-02-021-0/+19
| | | | | | | | This directive emits the binary annotations that describe line and code deltas in inlined call sites. Single-stepping through inlined frames in windbg now works. llvm-svn: 259535
* Use larger write sizes for MCFillFragment.Rafael Espindola2016-01-191-3/+14
| | | | | | | This brings the pr26208 testcase down to 3.2 seconds. Not checking it in since it does create a 4GB .o file. llvm-svn: 258149
* Simplify MCFillFragment.Rafael Espindola2016-01-191-13/+3
| | | | | | | | | The value size was always 1 or 0, so we don't need to store it. In a no asserts build this takes the testcase of pr26208 from 11 to 10 seconds. llvm-svn: 258141
* [ptr-traits] Split the MCFragment type hierarchy out of the MCAssemblerChandler Carruth2015-12-291-429/+0
| | | | | | | | | | | | | | | | | | | | | | header to its own header, allowing users of fragments to have a narrower header file, and avoid circular header dependencies when getting the definition of MCSection prior to inspecting traits on MCSection pointers. This is part of a series of patches to allow LLVM to check for complete pointee types when computing its pointer traits. This is absolutely necessary to get correct (or reproducible) results for things like how many low bits are guaranteed to be zero. Note that this doesn't in any way change the design of MC, it is just moving code around to allow the *header files* to be more fine grained. Without this, it is impossible to get a complete type for MCSection where it is needed. If anyone would prefer a different slicing of the header files, I'm happy to oblige of course. =] llvm-svn: 256548
* [MC, COFF] Support link /incremental conditionallyDavid Majnemer2015-12-211-1/+2
| | | | | | | | | | | | | | | | Today, we always take into account the possibility that object files produced by MC may be consumed by an incremental linker. This results in us initialing fields which vary with time (TimeDateStamp) which harms hermetic builds (e.g. verifying a self-host went well) and produces sub-optimal code because we cannot assume anything about the relative position of functions within a section (call sites can get redirected through incremental linker thunks). Let's provide an MCTargetOption which controls this behavior so that we can disable this functionality if we know a-priori that the build will not rely on /incremental. llvm-svn: 256203
* [Assembler] Make fatal assembler errors non-fatalOliver Stannard2015-11-171-9/+20
| | | | | | | | | | | | | | Currently, if the assembler encounters an error after parsing (such as an out-of-range fixup), it reports this as a fatal error, and so stops after the first error. However, for most of these there is an obvious way to recover after emitting the error, such as emitting the fixup with a value of zero. This means that we can report on all of the errors in a file, not just the first one. MCContext::reportError records the fact that an error was encountered, so we won't actually emit an object file with the incorrect contents. Differential Revision: http://reviews.llvm.org/D14717 llvm-svn: 253328
* Simplify .org processing and make it a bit more powerful.Rafael Espindola2015-11-041-2/+9
| | | | | | | We now always create the fragment, which lets us handle things like .org after a .align. llvm-svn: 252101
* MC: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-101-1/+1
| | | | llvm-svn: 249922
* MC: Stop using Fragment::getNextNode()Duncan P. N. Exon Smith2015-10-081-7/+7
| | | | | | | | | | | | | Stop using `getNextNode()` to get an iterator to a fragment (at least, in this one place). Instead, use iterator logic directly. The `getNextNode()` interface isn't actually supposed to work for creating iterators; it's supposed to return `nullptr` (not a real iterator) if this is the last node. It's currently broken and will "happen" to work, but if we ever fix the function, we'll get some strange failures in places like this. llvm-svn: 249763
* Fix pr24486.Rafael Espindola2015-10-051-2/+14
| | | | | | | | | | | | | | | | | | This extends the work done in r233995 so that now getFragment (in addition to getSection) also works for variable symbols. With that the existing logic to decide if a-b can be computed works even if a or b are variables. Given that, the expression evaluation can avoid expanding variables as aggressively and that in turn lets the relocation code see the original variable. In order for this to work with the asm streamer, there is now a dummy fragment per section. It is used to assign a section to a symbol when no other fragment exists. This patch is a joint work by Maxim Ostapenko andy myself. llvm-svn: 249303
* Move registerSection out of line and reduce #includes. NFC.Rafael Espindola2015-10-031-0/+8
| | | | llvm-svn: 249241
* [MC] Remove MCAssembler's copy of OSDavid Majnemer2015-09-011-4/+4
| | | | | | | We can just ask the ObjectWriter for it's stream instead of caching around our own reference to it. No functionality change is intended. llvm-svn: 246604
* [MC] Split the layout part of MCAssembler::finish() into its own method. NFC.Frederic Riss2015-08-261-6/+9
| | | | | | | | | | Split a MCAssembler::layout() method out of MCAssembler::finish(). This allows running the MCSections layout separately from the streaming of the output file. This way if a client wants to use MC to generate section contents, but emit something different than the standard relocatable object files it is possible (llvm-dsymutil is such a client). llvm-svn: 246008
* Fix symbol value computation when part of the expression is weak.Rafael Espindola2015-08-201-1/+1
| | | | | | | This matches the behaviour of the gnu assembler and is part of fixing pr24486. llvm-svn: 245576
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-4/+0
| | | | | | | | | | After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
* [MC/Dwarf] Allow to specify custom parameters for linetable emission.Frederic Riss2015-08-071-1/+2
| | | | | | | | | NFC patch for current users, but llvm-dsymutil will use the new functionality to adapt to the input linetable. Based on a patch by Adrian Prantl. llvm-svn: 244318
* Use range-based for loops. NFCCraig Topper2015-08-021-31/+26
| | | | llvm-svn: 243859
* Fix spelling, NFC.Yaron Keren2015-07-041-1/+1
| | | | llvm-svn: 241392
* [MC] Align fragments when -mc-relax-all flag is usedPetr Hosek2015-06-271-6/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: Ensure that fragments are bundle aligned when instruction bundling is enabled and the -mc-relax-all flag is set. This is implicitly assumed by the bundle padding implementation but this assumption does not hold when custom alignment is being used. The change was tested by running PNaCl toolchain trybots with -mc-relax-all flag set. Fixes https://code.google.com/p/nativeclient/issues/detail?id=4063 Test Plan: Regression test attached Reviewers: mseaborn Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D10044 llvm-svn: 240869
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-2/+2
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-2/+2
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Devirtualize and pack MCFragment to reduce memory usage.Pete Cooper2015-06-171-48/+78
| | | | | | | | | | | | | MCFragment didn't really need vtables. The majority of virtual methods were just getters and setters. This removes the vtables and uses dispatch on the kind to do things like delete which needs to get the appropriate class. This reduces memory on the verify use list order test case by about 2MB out of 800MB. Reviewed by Rafael EspĂ­ndola llvm-svn: 239952
* Move IsUsedInReloc from MCSymbolELF to MCSymbol.Rafael Espindola2015-06-171-11/+1
| | | | | | There is a free bit is MCSymbol and MachO needs the same information. llvm-svn: 239933
* MC: Add target hook to control symbol quotingMatt Arsenault2015-06-091-2/+1
| | | | llvm-svn: 239370
* MC: Clean up the naming for MCMachObjectWriter. NFC.Jim Grosbach2015-06-041-1/+1
| | | | | | | | | | | | | | | | | | s/ExecutePostLayoutBinding/executePostLayoutBinding/ s/ComputeSymbolTable/computeSymbolTable/ s/BindIndirectSymbols/bindIndirectSymbols/ s/RecordTLVPRelocation/recordTLVPRelocation/ s/RecordScatteredRelocation/recordScatteredRelocation/ s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/ s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/ s/WriteNlist/writeNlist/ s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/ s/WriteSymtabLoadCommand/writeSymtabLoadCommand/ s/WriteSection/writeSection/ s/WriteSegmentLoadCommand/writeSegmentLoadCommand/ s/WriteHeader/writeHeader/ llvm-svn: 239119
* MC: Clean up naming in MCObjectWriter. NFC.Jim Grosbach2015-06-041-18/+18
| | | | | | | | | | | | | | | | | | | | s/WriteObject/writeObject/ s/RecordRelocation/recordRelocation/ s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/ s/Write8/write8/ s/WriteLE16/writeLE16/ s/WriteLE32/writeLE32/ s/WriteLE64/writeLE64/ s/WriteBE16/writeBE16/ s/WriteBE32/writeBE32/ s/WriteBE64/writeBE64/ s/Write16/write16/ s/Write32/write32/ s/Write64/write64/ s/WriteZeroes/writeZeroes/ s/WriteBytes/writeBytes/ llvm-svn: 239108
* The fragment implies the section, don't store both.Rafael Espindola2015-06-011-0/+10
| | | | | | This reduces MCSymbol from 64 to 56 bytes on x86_64. llvm-svn: 238747
* [MC] Allow backends to decide relaxation for unresolved fixups.Colin LeMahieu2015-05-301-5/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D8217 llvm-svn: 238659
* [WinCOFF] Add support for the .safeseh directiveDavid Majnemer2015-05-301-0/+18
| | | | | | | | | .safeseh adds an entry to the .sxdata section to register all the appropriate functions which may handle an exception. This entry is not a relocation to the symbol but instead the symbol table index of the function. llvm-svn: 238641
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-3/+3
| | | | llvm-svn: 238634
* Remove getData.Rafael Espindola2015-05-291-7/+5
| | | | | | This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
* Remove the MCSymbolData typedef.Rafael Espindola2015-05-291-1/+1
| | | | | | The getData member function is next. llvm-svn: 238611
* Merge MCSymbol and MCSymbolData.Rafael Espindola2015-05-291-12/+0
| | | | | | | As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be removing that in a second. llvm-svn: 238609
* Move Flags from MCSymbolData to MCSymbol.Rafael Espindola2015-05-291-1/+0
| | | | llvm-svn: 238598
* Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola2015-05-291-8/+2
| | | | llvm-svn: 238583
* Remove a trivial forwarding function. NFC.Rafael Espindola2015-05-281-1/+1
| | | | llvm-svn: 238506
* Delete MCSectionData.Rafael Espindola2015-05-271-25/+9
| | | | llvm-svn: 238331
* Move getSubsectionInsertionPoint to MCSection.Rafael Espindola2015-05-271-31/+0
| | | | llvm-svn: 238320
* Remove most uses of MCSectionData from MCAssembler.Rafael Espindola2015-05-261-12/+11
| | | | llvm-svn: 238172
* Stop using MCSectionData in MCAsmLayout.h.Rafael Espindola2015-05-261-23/+22
| | | | llvm-svn: 238170
* Return a MCSection from MCFragment::getParent().Rafael Espindola2015-05-261-5/+5
| | | | | | Another step in merging MCSectionData and MCSection. llvm-svn: 238162
* Store a MCSection in MCFragment.Rafael Espindola2015-05-251-3/+3
| | | | | | Part of the work to merge MCSectionData into MCSection. llvm-svn: 238160
* Turn MCSectionData into a field of MCSection.Rafael Espindola2015-05-251-12/+9
| | | | | | | This also changes MCAssembler to store a vector of MCSections instead of an iplist of MCSectionData. llvm-svn: 238159
* Insert MCSectionData into the section list directly in getOrCreateSectionData.Rafael Espindola2015-05-251-5/+1
| | | | | | | Removing the logic from the constructor will make it easier to merge MCSectionData and MCSection. llvm-svn: 238155
OpenPOWER on IntegriCloud