aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
* Minor cosmetic change: fix DOSish \r\n.NAKAMURA Takumi2010-10-071-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115910 91177308-0d34-0410-b5e6-96231b3b80d8
* MC-COFF: Fix symbol aliases. Fixes PR8251.Michael J. Spencer2010-10-071-5/+36
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115909 91177308-0d34-0410-b5e6-96231b3b80d8
* Another case of 256 sections not being enough :-)Rafael Espindola2010-10-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115858 91177308-0d34-0410-b5e6-96231b3b80d8
* Get binding and visibility info from the the alias, but Type from the symbolRafael Espindola2010-10-061-3/+25
| | | | | | being aliased. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115836 91177308-0d34-0410-b5e6-96231b3b80d8
* MC: Add missing forward in MCLoggingStreamer.Michael J. Spencer2010-10-061-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115830 91177308-0d34-0410-b5e6-96231b3b80d8
* If a symbol is global, reloc against it even if it is in a mergeable section.Rafael Espindola2010-10-061-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115817 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure weak symbols are listed after the local ones.Rafael Espindola2010-10-062-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115795 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly handle GOTPCREL relocations.Rafael Espindola2010-10-061-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115793 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a relocation against the symbol if it is a PLT and the symbol is in anotherRafael Espindola2010-10-051-2/+11
| | | | | | section. Common because of linkonce sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115718 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement more alias cases.Rafael Espindola2010-10-051-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115699 91177308-0d34-0410-b5e6-96231b3b80d8
* 256 sections should be enough for anyone...Rafael Espindola2010-10-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115687 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash in a strange .size directive.Rafael Espindola2010-10-051-5/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115684 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Punctuation.Michael J. Spencer2010-10-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115657 91177308-0d34-0410-b5e6-96231b3b80d8
* MC-COFF: Fix (PR8278) temporary symbol relocations.Michael J. Spencer2010-10-051-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115656 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for a fill value in the .zero directive.Rafael Espindola2010-10-051-1/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115655 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a simple alias case and refactor the code a bit so that theRafael Espindola2010-10-051-17/+35
| | | | | | isInSymtab and isLocal logic in the two loops don't get easily out of sync. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115643 91177308-0d34-0410-b5e6-96231b3b80d8
* Produce a undefined reference to _GLOBAL_OFFSET_TABLE_ when needed.Rafael Espindola2010-10-051-1/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115623 91177308-0d34-0410-b5e6-96231b3b80d8
* On ELF we need to know which symbols are used in relocations to decide ifRafael Espindola2010-10-054-77/+47
| | | | | | | they should be in the symbol table or not. Instead of "guessing", just compute the symbol table after the relocations are known. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115619 91177308-0d34-0410-b5e6-96231b3b80d8
* Incorporate suggestions by Daniel Dunbar after his review. Thanks Daniel!Kevin Enderby2010-10-043-9/+5
| | | | | | | | | | | | | | | | | | 1) Changed ValidateDwarfFileNumber() to isValidDwarfFileNumber() to be better named. Since it is just a predicate and isn't actually changing any state. 2) Added a missing return in the comments for setCurrentDwarfLoc() in include/llvm/MC/MCContext.h for fix formatting. 3) Changed clearDwarfLocSeen() to ClearDwarfLocSeen() since it does change state. 4) Simplified the last test in isValidDwarfFileNumber() to just a one line boolean test of MCDwarfFiles[FileNumber] != 0 for the final return statement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115551 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement ELF::R_X86_64_GOTPCREL.Rafael Espindola2010-10-041-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115547 91177308-0d34-0410-b5e6-96231b3b80d8
* Move isFixupKindX86PCRel.Rafael Espindola2010-10-041-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115545 91177308-0d34-0410-b5e6-96231b3b80d8
* Produce a R_X86_64_PLT32 when needed.Rafael Espindola2010-10-041-1/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115541 91177308-0d34-0410-b5e6-96231b3b80d8
* Produce a R_X86_64_GOT32 when needed.Rafael Espindola2010-10-041-1/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115537 91177308-0d34-0410-b5e6-96231b3b80d8
* Add hook in MCSection to decide when to use "optimized nops", for eachJan Wen Voung2010-10-044-7/+13
| | | | | | | | | section kind. Previously, optimized nops were only used for MachO. Also added tests for ELF and COFF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115523 91177308-0d34-0410-b5e6-96231b3b80d8
* Include the section address in the computation of the relocation.Rafael Espindola2010-10-041-1/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115509 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly compute the relocation when it is not in the first fragment.Rafael Espindola2010-10-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115506 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a very basic PIC case.Rafael Espindola2010-10-031-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115454 91177308-0d34-0410-b5e6-96231b3b80d8
* This adds a Darwin x86_64 relocation encoding for a subtraction expressionKevin Enderby2010-10-022-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where both symbols are "local", that is non-external symbols, and there is no "base" for the symbols used in the expression, that is the section has no non-temporary symbols. This case looks like this: % cat local_reloc_A-B.s .long 0 LB: .long 1 .long LA - LB - 4 .long 2 LA: .long 3 which llvm-mc will not encode without this patch, generates a "unsupported local relocations in difference" error, but the Darwin assembler will encode with relocation entries like this: % otool -rv a.out l.out a.out: Relocation information (__TEXT,__text) 2 entries address pcrel length extern type scattered symbolnum/value 00000008 False long False SUB False 1 (__TEXT,__text) 00000008 False long False UNSIGND False 1 (__TEXT,__text) which is very similar to what is encoded when the symbols don't have the leading 'L' and they are not temporary symbols. Which llvm-mc and the Darwin assembler will encoded like this: Relocation information (__TEXT,__text) 2 entries address pcrel length extern type scattered symbolnum/value 00000008 False long True SUB False B 00000008 False long True UNSIGND False A This is the missing relocation encoding needed to allow the Mach-O x86 Dwarf file and line table to be emitted. So this patch also removes the TODO from the if() statement in MCMachOStreamer::Finish() that didn't call MCDwarfFileTable::Emit() for 64-bit targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115389 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor some logic into ShouldRelocOnSymbol. This simplifies the code andRafael Espindola2010-09-301-38/+31
| | | | | | | fixes some cases where we were producing relocations with at symbol that should use a section instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115194 91177308-0d34-0410-b5e6-96231b3b80d8
* This is the last major patch to implement support for the .loc directiveKevin Enderby2010-09-306-205/+570
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115157 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes EvaluateAsAbsolute() to return the "current value" of the expressionKevin Enderby2010-09-301-1/+16
| | | | | | | | | if we are given a Layout object, even in cases when the value is not fixed. This will be needed by the final patch for the dwarf .loc support to size a new MCDwarf fragment needed to build and emit dwarf line number tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115155 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence a GCC warning about not handling all flags in this switch, weChandler Carruth2010-09-301-2/+2
| | | | | | | specifically assert on unexpected flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115143 91177308-0d34-0410-b5e6-96231b3b80d8
* Move logic of determining ELF entsize from the .s printer to initializationJan Wen Voung2010-09-302-12/+15
| | | | | | | | | time. That way, the EntrySize field is initialized for other code paths, namely, the .ll -> .o code path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115141 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly produce R_X86_64_32 or R_X86_64_32S.Rafael Espindola2010-09-303-8/+12
| | | | | | | | | | | | | With this patch in movq $foo, foo(%rip) foo: .long foo We produce a R_X86_64_32S for the first relocation and R_X86_64_32 for the second one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115134 91177308-0d34-0410-b5e6-96231b3b80d8
* Tiny patch for proof-of-concept cleanup of ARMAsmPrinter::EmitStartOfAsmFile()Jason W Kim2010-09-302-0/+2
| | | | | | | | | Small test for sanity check of resulting ARM .s file. Tested against -r115129. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115133 91177308-0d34-0410-b5e6-96231b3b80d8
* Have ELFAsmParser.cpp use the already parsed "Size" (entry size) when Jan Wen Voung2010-09-301-1/+2
| | | | | | | constructing a section. Test for a few cases also included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115132 91177308-0d34-0410-b5e6-96231b3b80d8
* Make it possible for the MCObjectWriter to decide if a given fixup is fullyRafael Espindola2010-09-304-132/+208
| | | | | | | | | | | resolved or not. Different object files have different restrictions and different native assemblers have different idiosyncrasies we want to emulate for now. Move the existing MachO logic to the new place and implement an ELF one that gets fixups to globals right. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115131 91177308-0d34-0410-b5e6-96231b3b80d8
* Test commit - Deleted some whitespace at the end of a line.Jan Wen Voung2010-09-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115122 91177308-0d34-0410-b5e6-96231b3b80d8
* Move "local commons" to the end of .bss to match the gnu as behavior.Rafael Espindola2010-09-291-9/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115037 91177308-0d34-0410-b5e6-96231b3b80d8
* MC-COFF: Fix symbol storage class for globalsMichael J. Spencer2010-09-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115020 91177308-0d34-0410-b5e6-96231b3b80d8
* change the protocol TargetAsmPArser::MatchInstruction method to take anChris Lattner2010-09-291-9/+3
| | | | | | | | MCStreamer to emit into instead of an MCInst to fill in. This allows the matcher extra flexibility and is more convenient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115014 91177308-0d34-0410-b5e6-96231b3b80d8
* On elf, undefined symbols can start with .L.Rafael Espindola2010-09-281-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114958 91177308-0d34-0410-b5e6-96231b3b80d8
* Write relocations in the end of the file. This matches what gas does andRafael Espindola2010-09-271-2/+1
| | | | | | makes files easier to diff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114898 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure .text doesn't produce extra alignment.Rafael Espindola2010-09-271-9/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114895 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor symbol value computation into a function.Rafael Espindola2010-09-271-9/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114891 91177308-0d34-0410-b5e6-96231b3b80d8
* MC-COFF: Fix signed/unsigned comparison.Michael J. Spencer2010-09-271-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114888 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/AsmParser: Handle exponents in floating point literals.Daniel Dunbar2010-09-271-9/+30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114861 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused argument.Rafael Espindola2010-09-272-7/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114852 91177308-0d34-0410-b5e6-96231b3b80d8
* Push twines deeper into SourceMgr's error handling methods.Benjamin Kramer2010-09-271-9/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114847 91177308-0d34-0410-b5e6-96231b3b80d8
* MC-COFF: Drop empty sections, and label symbols. Convert relocationsMichael J. Spencer2010-09-271-82/+163
| | | | | | | | targeted at symbols into relocations relative to the containing section. Patch by Nathan Jeffords! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114823 91177308-0d34-0410-b5e6-96231b3b80d8