summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFObjectWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename HasData to IsRegistered.Rafael Espindola2015-06-011-1/+1
| | | | | | | | | There is no MCSectionData, so the old name is now meaningless. Also remove some asserts/checks that were there just because the information they used was in MCSectionData. llvm-svn: 238708
* Remove trivial forwarding function.Rafael Espindola2015-06-011-1/+1
| | | | llvm-svn: 238707
* Store a bit in MCSection saying if it was registered with MCAssembler.Rafael Espindola2015-06-011-1/+1
| | | | | | With this we can replace a SetVector with a plain std::vector. llvm-svn: 238706
* [WinCOFF] Add support for the .safeseh directiveDavid Majnemer2015-05-301-17/+27
| | | | | | | | | .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
* Remove getData.Rafael Espindola2015-05-291-18/+10
| | | | | | This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
* Remove the MCSymbolData typedef.Rafael Espindola2015-05-291-6/+6
| | | | | | The getData member function is next. llvm-svn: 238611
* Move Flags from MCSymbolData to MCSymbol.Rafael Espindola2015-05-291-5/+4
| | | | llvm-svn: 238598
* Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola2015-05-291-3/+3
| | | | llvm-svn: 238583
* Remove a trivial forwarding function. NFC.Rafael Espindola2015-05-281-4/+4
| | | | llvm-svn: 238506
* Use range loops for accessing file names. NFC.Rafael Espindola2015-05-281-6/+5
| | | | llvm-svn: 238446
* Stop using MCSectionData in WinCOFFObjectWriter.cpp.Rafael Espindola2015-05-271-15/+8
| | | | llvm-svn: 238329
* clang-format WinCOFFObjectWriter.cpp. NFC.Rafael Espindola2015-05-271-82/+102
| | | | llvm-svn: 238328
* Remove most uses of MCSectionData from MCAssembler.Rafael Espindola2015-05-261-1/+1
| | | | llvm-svn: 238172
* Stop using MCSectionData in MCAsmLayout.h.Rafael Espindola2015-05-261-2/+1
| | | | llvm-svn: 238170
* Return a MCSection from MCFragment::getParent().Rafael Espindola2015-05-261-5/+4
| | | | | | Another step in merging MCSectionData and MCSection. llvm-svn: 238162
* Turn MCSectionData into a field of MCSection.Rafael Espindola2015-05-251-4/+5
| | | | | | | This also changes MCAssembler to store a vector of MCSections instead of an iplist of MCSectionData. llvm-svn: 238159
* Stop forwarding (get|set)Aligment from MCSectionData to MCSection.Rafael Espindola2015-05-211-1/+1
| | | | llvm-svn: 237956
* MC: Stop using MCSymbolData::getSymbol() in WinCOFF, NFCDuncan P. N. Exon Smith2015-05-201-26/+23
| | | | | | Move APIs over from `MCSymbolData` to `MCSymbol`. llvm-svn: 237826
* MC: Use MCSymbol in MCObjectWriter::isWeak(), NFCDuncan P. N. Exon Smith2015-05-201-3/+3
| | | | | | Continue to prefer `MCSymbol` when we need both. llvm-svn: 237798
* MC: Use MCSymbol in MCAsmLayout::getSymbolOffset(), NFCDuncan P. N. Exon Smith2015-05-191-3/+3
| | | | | | | Continue to canonicalize on MCSymbol instead of MCSymbolData when both are needed. llvm-svn: 237749
* MC: Clean up method names in MCContext.Jim Grosbach2015-05-181-3/+3
| | | | | | | The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
* MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()Duncan P. N. Exon Smith2015-05-161-4/+5
| | | | | | | | Transition one API from `MCSymbolData` to `MCSymbol`. The function needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is going away. llvm-svn: 237498
* MC: Change MCAssembler::Symbols to store MCSymbol, NFCDuncan P. N. Exon Smith2015-05-161-3/+3
| | | | | | | | Instead of storing a list of the `MCSymbolData` in use, store the `MCSymbol`s. Churning in the direction of removing the back pointer from `MCSymbolData`. llvm-svn: 237496
* Don't omit the constant when computing a cross-section relative relocation.Andy Ayers2015-05-141-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D9692 llvm-svn: 237327
* Compute A-B when A or B is weak.Rafael Espindola2015-04-171-6/+4
| | | | | | | | | | | | | | | | | | | | Similar to r235222, but for the weak symbol case. In an "ideal" assembler/object format an expression would always refer to the final value and A-B would only be computed from a section in the same comdat as A and B with A and B strong. Unfortunately that is not the case with debug info on ELF, so we need an heuristic. Since we need an heuristic, we may as well use the same one as gas: * call weak_sym : produces a relocation, even if in the same section. * A - weak_sym and weak_sym -A: don't produce a relocation if we can compute it. This fixes pr23272 and changes the fix of pr22815 to match what gas does. llvm-svn: 235227
* Add a proper fix for pr23025.Rafael Espindola2015-04-171-4/+16
| | | | | | | Instead of avoiding looking past every global symbol, only do so if the symbol is in a comdat. llvm-svn: 235181
* [mc] Clean up emission of byte sequencesBenjamin Kramer2015-04-171-2/+1
| | | | | | No functional change intended. llvm-svn: 235178
* Use raw_pwrite_stream in the object writer/streamer.Rafael Espindola2015-04-141-3/+3
| | | | | | The ELF object writer will take advantage of that in the next commit. llvm-svn: 234950
* Define a function with "... llvm::func...".Rafael Espindola2015-04-091-6/+5
| | | | | | | | | | | | Using this instead of namespace llvm { func... } Has the advantage that the build fails with a compiler error if it gets out of sync with the .h file. llvm-svn: 234515
* Be consistent when deciding if a relocation is needed.Rafael Espindola2015-04-061-4/+6
| | | | | | | | | | | | | | Before when deciding if we needed a relocation in A-B, we wore only checking if A was weak. This fixes the asymmetry. The "InSet" argument should probably be renamed to "ForValue", since InSet is very MachO specific, but doing so in this patch would make it hard to read. This fixes PR22815. llvm-svn: 234165
* Remove more superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-301-3/+1
| | | | | | Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev. llvm-svn: 233555
* Fix PR23025.Rafael Espindola2015-03-261-0/+8
| | | | | | | | | | | | | | | There is something in link.exe that requires a relocation to use a global symbol. Not doing so breaks the chrome build on windows. This patch sets isWeak for that to work. To compensate, we then need to look past those symbols when not creating relocations. This patch includes an ELF test that matches GNU as behaviour. I am still reducing the chrome build issue and will add a test once that is done. llvm-svn: 233318
* Unbreak buildbotsDavid Majnemer2015-02-111-1/+2
| | | | | | The next offset should be updated as well. llvm-svn: 228883
* MC, COFF: Align section contents to a four byte boundaryDavid Majnemer2015-02-111-2/+9
| | | | llvm-svn: 228879
* MC: Calculate intra-section symbol differences correctly for COFFDavid Majnemer2015-02-091-6/+11
| | | | | | This fixes PR22060. llvm-svn: 228565
* ARM: fail less catastrophically on invalid Windows inputSaleem Abdulrasool2015-01-221-2/+3
| | | | | | | | | | | | Windows supports a restricted set of relocations (compared to ARM ELF). In some cases, we may end up generating an unsupported relocation. This can occur with bad input to the assembler in particular (the frontend should never generate code that cannot be compiled). Generate an error rather than just aborting. The change in the API is driven by the desire to provide a slightly more helpful message for debugging purposes. llvm-svn: 226779
* Add r224985 back with fixes.Rafael Espindola2015-01-191-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fixes are to note that AArch64 has additional restrictions on when local relocations can be used. In particular, ld64 requires that relocations to cstring/cfstrings use linker visible symbols. Original message: In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 226503
* Revert "Add r224985 back with two fixes."Rafael Espindola2015-01-141-4/+8
| | | | | | This reverts commit r225644 while I debug a regression. llvm-svn: 226022
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Add r224985 back with two fixes.Rafael Espindola2015-01-121-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One is that AArch64 has additional restrictions on when local relocations can be used. We have to take those into consideration when deciding to put a L symbol in the symbol table or not. The other is that ld64 requires the relocations to cstring to use linker visible symbols on AArch64. Thanks to Michael Zolotukhin for testing this! Remove doesSectionRequireSymbols. In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 225644
* Revert r225048: It broke ObjC on AArch64.Lang Hames2015-01-061-4/+8
| | | | | | I've filed http://llvm.org/PR22100 to track this issue. llvm-svn: 225228
* Add r224985 back with a fix.Rafael Espindola2014-12-311-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issues was that AArch64 has additional restrictions on when local relocations can be used. We have to take those into consideration when deciding to put a L symbol in the symbol table or not. Original message: Remove doesSectionRequireSymbols. In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 225048
* Revert "Remove doesSectionRequireSymbols."Rafael Espindola2014-12-311-4/+8
| | | | | | | | This reverts commit r224985. I am investigating why it made an Apple bot unhappy. llvm-svn: 225044
* Remove doesSectionRequireSymbols.Rafael Espindola2014-12-301-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 224985
* clang-formatted ranged loops and assignment, NFC.Yaron Keren2014-12-041-12/+12
| | | | llvm-svn: 223344
* MC, COFF: Use relocations for function references inside the sectionDavid Majnemer2014-11-111-0/+18
| | | | | | | | | | | | | | | | | | Referencing one symbol from another in the same section does not generally require a relocation. However, the MS linker has a feature called /INCREMENTAL which enables incremental links. It achieves this by creating thunks to the actual function and redirecting all relocations to point to the thunk. This breaks down with the old scheme if you have a function which references, say, itself. On x86_64, we would use %rip relative addressing to reference the start of the function from out current position. This would lead to miscompiles because other references might reference the thunk instead, breaking function pointer equality. This fixes PR21520. llvm-svn: 221678
* speling.Nico Weber2014-11-111-1/+1
| | | | llvm-svn: 221652
* MC: Bit pack MCSymbolData.Benjamin Kramer2014-10-111-4/+4
| | | | | | | | | On x86_64 this brings it from 80 bytes to 64 bytes. Also make any member variables private and clean up uses to go through the existing accessors. NFC. llvm-svn: 219573
* WinCOFFObjectWriter: optimize the string table for common sufficesHans Wennborg2014-09-291-85/+33
| | | | | | | | This is a follow-up from r207670 which did the same for ELF. Differential Revision: http://reviews.llvm.org/D5530 llvm-svn: 218636
* WinCOFFObjectWriter.cpp: make write_uint32_le more efficientHans Wennborg2014-09-281-6/+4
| | | | llvm-svn: 218574
OpenPOWER on IntegriCloud