aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectWriter.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2017-06-06Sort the remaining #include lines in include/... and lib/....Chandler Carruth1-2/+2
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
2017-04-08MC: Remove unused virtual function MCObjectWriter::isWeak. NFC.Peter Collingbourne1-2/+0
llvm-svn: 299817
2017-02-08[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko1-2/+2
minor fixes (NFC). llvm-svn: 294526
2015-10-05Fix pr24486.Rafael Espindola1-2/+8
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-06-04MC: Clean up naming in MCObjectWriter. NFC.Jim Grosbach1-3/+3
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-05-29Remove getData.Rafael Espindola1-4/+2
This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
2015-05-29Remove the MCSymbolData typedef.Rafael Espindola1-2/+2
The getData member function is next. llvm-svn: 238611
2015-05-28Remove a trivial forwarding function. NFC.Rafael Espindola1-2/+2
llvm-svn: 238506
2015-05-26Return a MCSection from MCFragment::getParent().Rafael Espindola1-1/+1
Another step in merging MCSectionData and MCSection. llvm-svn: 238162
2015-05-20MC: Use MCSymbol in MCObjectWriter::isWeak(), NFCDuncan P. N. Exon Smith1-1/+1
Continue to prefer `MCSymbol` when we need both. llvm-svn: 237798
2015-05-16MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()Duncan P. N. Exon Smith1-4/+4
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-04-17Compute A-B when A or B is weak.Rafael Espindola1-4/+3
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
2015-04-06Remove unnecessary uses of AliasedSymbol.Rafael Espindola1-2/+2
As pr19627 points out, every use of AliasedSymbol is likely a bug. The main use was to avoid the oddity of a variable showing up as undefined. That was fixed in r233995, which made these calls nops. llvm-svn: 234169
2015-04-06Be consistent when deciding if a relocation is needed.Rafael Espindola1-10/+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
2015-03-25clang-format bits of code to make another patch readable.Rafael Espindola1-5/+3
llvm-svn: 233203
2015-03-25Fix fixup evaluation when deciding what to relocate with.Rafael Espindola1-0/+2
The previous logic was to first try without relocations at all and failing that stop on the first defined symbol. That was inefficient and incorrect in the case part of the expression could be simplified and another part could not (see included test). We now stop the evaluation when we get to a variable whose value can change (i.e. is weak). llvm-svn: 233187
2012-08-08Move [SU]LEB128 encoding to a utility header.Jim Grosbach1-34/+0
These functions are very generic. There's no reason for them to be tied to MCObjectWriter. llvm-svn: 161545
2012-01-31Fixed a crash in llvm-mc for Mach-O when a symbol difference expression uses aKevin Enderby1-0/+2
symbol from an assignment. In this case the symbol did not have a fragment so MCObjectWriter::IsSymbolRefDifferenceFullyResolved() should not have been calling IsSymbolRefDifferenceFullyResolvedImpl() with a NULL fragment and should just have returned false in that case. llvm-svn: 149442
2011-11-05Add an option to pad an uleb128 to MCObjectWriter and remove the uleb128 ↵Benjamin Kramer1-2/+10
encoding from the DWARF asm printer. As a side effect we now print dwarf ulebs with .ascii directives. llvm-svn: 143809
2011-02-16Gas is very inconsistent about when a relaxation/relocation is needed. DoRafael Espindola1-0/+12
the right thing and stop trying to copy it. Fixes PR8944. llvm-svn: 125648
2010-12-24Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We nowRafael Espindola1-3/+9
have a single point where targets test if a relocation is needed. llvm-svn: 122549
2010-12-18Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.Rafael Espindola1-0/+21
llvm-svn: 122148
2010-09-30This is the last major patch to implement support for the .loc directiveKevin Enderby1-0/+26
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
2010-03-19MC/Mach-O: Move to MachObjectWriter.{h,cpp}.Daniel Dunbar1-1/+1
llvm-svn: 98952
2010-03-19MC: Split MCObjectWriter out of MCAssembler.cpp.Daniel Dunbar1-0/+15
llvm-svn: 98949