aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MachObjectWriter.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-04-26Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""Tim Northover1-1/+2
A latent bug in llvm-objdump used the wrong format specifier on 32-bit targets, causing the test to fail. This fixes the issue. llvm-svn: 267582
2016-04-26Revert "ARM: put correct symbol index on indirect pointers in __thread_ptr."Renato Golin1-2/+1
This reverts commit r267488, as it broke some ARM buildbots. llvm-svn: 267541
2016-04-25ARM: put correct symbol index on indirect pointers in __thread_ptr.Tim Northover1-1/+2
Otherwise the linker has no idea what should be resolved. llvm-svn: 267488
2016-04-25ARM: put extern __thread stubs in a special section.Tim Northover1-0/+1
The linker needs to know that the symbols are thread-local to do its job properly. llvm-svn: 267473
2016-03-15[MachO] Add MachO alt-entry directive support.Lang Hames1-2/+4
This patch adds support for the MachO .alt_entry assembly directive, and uses it for global aliases with non-zero GEP offsets. The alt_entry flag indicates that a symbol should be layed out immediately after the preceding symbol. Conceptually it introduces an alternate entry point for a function or data structure. E.g.: safe_foo: // check preconditions for foo .alt_entry fast_foo fast_foo: // body of foo, can assume preconditions. The .alt_entry flag is also implicitly set on assembly aliases of the form: a = b + C where C is a non-zero constant, since these have the same effect as an alt_entry symbol: they introduce a label that cannot be moved relative to the preceding one. Setting the alt_entry flag on aliases of this form fixes http://llvm.org/PR25381. llvm-svn: 263521
2016-01-14Update to use new name alignTo().Rui Ueyama1-3/+3
llvm-svn: 257804
2015-10-28ARM: support .watchos_version_min and .tvos_version_min.Tim Northover1-2/+16
These MachO file directives are used by linkers and other tools to provide compatibility information, much like the existing .ios_version_min and .macosx_version_min. llvm-svn: 251569
2015-10-23Add a RAW mode to StringTableBuilder.Rafael Espindola1-1/+1
In this mode it just tries to tail merge the strings without imposing any other format constrains. It will not, for example, add a null byte between them. Also add support for keeping a tentative size and offset if we decide to not optimize after all. This will be used shortly in lld for merging SHF_STRINGS sections. llvm-svn: 251153
2015-10-05Fix pr24486.Rafael Espindola1-0/+12
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
2015-09-22Untabify.NAKAMURA Takumi1-3/+3
llvm-svn: 248264
2015-09-22Reformat blank lines.NAKAMURA Takumi1-2/+1
llvm-svn: 248263
2015-09-01[MC] Allow MCObjectWriter's output stream to be swapped outDavid Majnemer1-19/+20
There are occasions where it is useful to consider the entirety of the contents of a section. For example, compressed debug info needs the entire section available before it can compress it and write it out. The compressed debug info scenario was previously implemented by mirroring the implementation of writeSectionData in the ELFObjectWriter. Instead, allow the output stream to be swapped on demand. This lets callers redirect the output stream to a more convenient location before it hits the object file. No functionality change is intended. Differential Revision: http://reviews.llvm.org/D12509 llvm-svn: 246554
2015-08-26[MC/MachO] Make some MachObjectWriter methods more generic. NFC.Frederic Riss1-25/+30
Hardcode less values in some mach-o header writing routines and pass them as argument. Doing so will allow reusing this code in llvm-dsymutil. llvm-svn: 246007
2015-06-23Revert r240302 ("Bring r240130 back.").Daniel Jasper1-2/+1
This causes errors like: ld: error: blah.o: requires dynamic R_X86_64_PC32 reloc against '' which may overflow at runtime; recompile with -fPIC blah.cc:function f(): error: undefined reference to '' blah.o:g(): error: undefined reference to '' I have not yet come up with an appropriate reproduction. llvm-svn: 240394
2015-06-22Bring r240130 back.Rafael Espindola1-1/+2
Now that pr23900 is fixed, we can bring it back with no changes. Original message: Make all temporary symbols unnamed. What this does is make all symbols that would otherwise start with a .L (or L on MachO) unnamed. Some of these symbols still show up in the symbol table, but we can just make them unnamed. In order to make sure we produce identical results when going thought assembly, all .L (not just the compiler produced ones), are now unnamed. Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to 205.57MB. llvm-svn: 240302
2015-06-19Revert 240130, it caused crashes (repro in PR23900).Nico Weber1-2/+1
llvm-svn: 240193
2015-06-19Make all temporary symbols unnamed.Rafael Espindola1-1/+2
What this does is make all symbols that would otherwise start with a .L (or L on MachO) unnamed. Some of these symbols still show up in the symbol table, but we can just make them unnamed. In order to make sure we produce identical results when going thought assembly, all .L (not just the compiler produced ones), are now unnamed. Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to 205.57MB. llvm-svn: 240130
2015-06-08Remove includes of MCMachOSymbolFlags.h after it was deletedPete Cooper1-1/+0
llvm-svn: 239318
2015-06-08Move all flags logic to MCSymbolMachO.Pete Cooper1-20/+4
Also delete the now unused MCMachOSymbolFlags.h header as the only enum in there was moved to MCSymbolMachO. Similarly to ELF and COFF, manipulating the flags is now done via helpers instead of spread throughout the codebase. Reviewed by Rafael EspĂ­ndola. llvm-svn: 239316
2015-06-04MC: Clean up the naming for MCMachObjectWriter. NFC.Jim Grosbach1-24/+24
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
2015-06-04MC: Clean up naming in MCObjectWriter. NFC.Jim Grosbach1-94/+94
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
2015-06-04[MachOWriter] Use for-range and roll some duplicated code into loops.Benjamin Kramer1-43/+25
No functionality change intended. llvm-svn: 239096
2015-06-04MC: Remove obsolete MachO UseAggressiveSymbolFolding.Jim Grosbach1-3/+0
Fix the FIXME and remove this old as(1) compat option. It was useful for bringup of the integrated assembler to diff object files, but now it's just causing more relocations than strictly necessary to be generated. rdar://21201804 llvm-svn: 239084
2015-06-01MC: Tidy up LOH naming a bit. NFC.Jim Grosbach1-1/+1
llvm-svn: 238800
2015-06-01Store a bit in MCSection saying if it was registered with MCAssembler.Rafael Espindola1-15/+9
With this we can replace a SetVector with a plain std::vector. llvm-svn: 238706
2015-05-30MC: Clean up MCExpr naming. NFC.Jim Grosbach1-1/+1
llvm-svn: 238634
2015-05-29Remove getData.Rafael Espindola1-12/+7
This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
2015-05-29Remove the MCSymbolData typedef.Rafael Espindola1-3/+3
The getData member function is next. llvm-svn: 238611
2015-05-29Rename getOrCreateSymbolData to registerSymbol and return void.Rafael Espindola1-2/+2
Another step in merging MCSymbol and MCSymbolData. llvm-svn: 238607
2015-05-29Move Flags from MCSymbolData to MCSymbol.Rafael Espindola1-4/+4
llvm-svn: 238598
2015-05-29Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola1-3/+3
llvm-svn: 238583
2015-05-28Remove a trivial forwarding function. NFC.Rafael Espindola1-4/+3
llvm-svn: 238506
2015-05-27Remove uses of MCSectionData from MachObjectWriter.cpp.Rafael Espindola1-6/+4
llvm-svn: 238327
2015-05-26Remove most uses of MCSectionData from MCAssembler.Rafael Espindola1-14/+9
llvm-svn: 238172
2015-05-26Stop using MCSectionData in MCAsmLayout.h.Rafael Espindola1-18/+17
llvm-svn: 238170
2015-05-26Stop using MCSectionData in MCMachObjectWriter.h.Rafael Espindola1-19/+19
llvm-svn: 238165
2015-05-26Stop using MCSectionData in MCExpr.h.Rafael Espindola1-9/+9
llvm-svn: 238163
2015-05-26Return a MCSection from MCFragment::getParent().Rafael Espindola1-4/+5
Another step in merging MCSectionData and MCSection. llvm-svn: 238162
2015-05-25Turn MCSectionData into a field of MCSection.Rafael Espindola1-9/+12
This also changes MCAssembler to store a vector of MCSections instead of an iplist of MCSectionData. llvm-svn: 238159
2015-05-25Move HasInstructions to MCSection.Rafael Espindola1-1/+1
llvm-svn: 238150
2015-05-25Move LayoutOrder to MCSection.Rafael Espindola1-1/+1
llvm-svn: 238141
2015-05-22MC: Lift MCSymbolData::Index up to MCSymbol::Index, NFCDuncan P. N. Exon Smith1-5/+5
Lift `MCSymbolData::Index` up a level to `MCSymbol`, as preparation for packing it into the bitfield in `MCSymbol`. llvm-svn: 238001
2015-05-21Stop forwarding (get|set)Aligment from MCSectionData to MCSection.Rafael Espindola1-6/+7
llvm-svn: 237956
2015-05-21MC: Remove last use of MCSymbolData::getSymbol(), NFCDuncan P. N. Exon Smith1-3/+3
Remove the last use of `MCSymbolData::getSymbol()`. There's some *really* hairy stuff going on in `MachObjectWriter::WriteNList()` that I want to come back to. In particular, it updates `Symbol` to point at its aliasee (if any), but leaves `Data` behind, and it's not clear whether everything makes sense there. For now I've left the logic unchanged by adding `OrigSymbol` and moving the FIXME from r237750 up a bit higher. I've filed PR23598 to track looking into this. llvm-svn: 237867
2015-05-20MC: Use MCSymbol in MachObjectWriter, NFCDuncan P. N. Exon Smith1-16/+14
Replace uses of `MCSymbolData` with `MCSymbol` where both are needed, so we can remove the backpointer. llvm-svn: 237799
2015-05-20MC: Take MCSymbol in MachObjectWriter::getSymbolAddress(), NFCDuncan P. N. Exon Smith1-15/+9
Pass through an `MCSymbol` instead of an `MCSymbolData` so we can get rid of the back pointer. llvm-svn: 237750
2015-05-19MC: Use MCSymbol in MCAsmLayout::getSymbolOffset(), NFCDuncan P. N. Exon Smith1-1/+1
Continue to canonicalize on MCSymbol instead of MCSymbolData when both are needed. llvm-svn: 237749
2015-05-16MC: Use MCSymbol in RelAndSymbol, NFCDuncan P. N. Exon Smith1-1/+1
Switch from `MCSymbolData` to `MCSymbol`. llvm-svn: 237502
2015-05-16MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()Duncan P. N. Exon Smith1-2/+2
Transition one API from `MCSymbolData` to `MCSymbol`. The function needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is going away. llvm-svn: 237498
2015-05-16MC: Change MCFragment::Atom to an MCSymbol, NFCDuncan P. N. Exon Smith1-6/+1
Change `MCFragment::Atom` from an `MCSymbolData` to an `MCSymbol`, moving in the direction of removing the back-pointer. llvm-svn: 237497