aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MachObjectWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fixes warnings emitted by Visual Studio 2010 compiler.Oscar Fuentes2011-03-011-2/+2
| | | | | | Patch by Erik Olofsson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126796 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps.Jason W Kim2011-02-041-1/+2
| | | | | | | | | | | | | | | | | | | (yes, this is different from R_ARM_CALL) - Adds a new method getARMBranchTargetOpValue() which handles the necessary distinction between the conditional and unconditional br/bl needed for ARM/ELF At least for ARM mode, the needed fixup for conditional versus unconditional br/bl is identical, but the ARM docs and existing ARM tools expect this reloc type... Added a few FIXME's for future naming fixups in ARMInstrInfo.td git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124895 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bogus assert condition noticed by Csaba Raduly.Evan Cheng2011-02-011-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124645 91177308-0d34-0410-b5e6-96231b3b80d8
* Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.Evan Cheng2011-01-141-9/+126
| | | | | | | | | - Fixed :upper16: fix up routine. It should be shifting down the top 16 bits first. - Added support for Thumb2 :lower16: and :upper16: fix up. - Added :upper16: and :lower16: relocation support to mach-o object writer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123424 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/Thumb: Select appropriate relocation types for Thumb.Daniel Dunbar2010-12-271-9/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122583 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We nowRafael Espindola2010-12-241-124/+33
| | | | | | have a single point where targets test if a relocation is needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122549 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Start handling some Thumb branches.Daniel Dunbar2010-12-241-0/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122547 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Don't try to use scattered relocs for BR24 fixups.Daniel Dunbar2010-12-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122441 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another conditional expression mismatched enum type warning.Matt Beaumont-Gay2010-12-221-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122419 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: We always use the SECTDIFF reloc type on ARM, which isDaniel Dunbar2010-12-221-6/+1
| | | | | | esp. important given that the LOCAL_SECTDIFF enumeration got redefined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122412 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Clone off an ARM version of RecordScatteredRelocation until I ↵Daniel Dunbar2010-12-221-4/+68
| | | | | | figure out how it is supposed to work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122410 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Return to reporting errors if we see unexpected fixup kinds.Daniel Dunbar2010-12-221-6/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122409 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Recognize generic _Data_N fixup kinds.Daniel Dunbar2010-12-221-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122408 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Add enough relocation logic to get BR24 relocations.Daniel Dunbar2010-12-221-3/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122407 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Fix thinko.Daniel Dunbar2010-12-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122406 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O/ARM: Stub out RecordARMRelocation, which is mostly a copy ofDaniel Dunbar2010-12-221-1/+78
| | | | | | RecordRelocation with lots of FIXMEs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122402 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify.Daniel Dunbar2010-12-221-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122401 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Split out RecordARMRelocation for now, it is weird enough it isn'tDaniel Dunbar2010-12-221-0/+15
| | | | | | | clear how to keep in the generic path (yet). - Will revisit when it actually works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122400 91177308-0d34-0410-b5e6-96231b3b80d8
* GCC objects to the two sides of a conditional expression having different enumMatt Beaumont-Gay2010-12-211-2/+2
| | | | | | | | types, but they're just getting converted to unsigned anyway, so cast first (and ask questions later). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122377 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrongDaniel Dunbar2010-12-211-7/+8
| | | | | | type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122334 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.Rafael Espindola2010-12-181-7/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the MCObjectFormat class.Rafael Espindola2010-12-181-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: On second thought, use a custom hook for enabling aggressiveDaniel Dunbar2010-12-171-0/+3
| | | | | | | | | | IsSymbolRefDifferenceFullyResolved, it turns out this does change behavior on enough cases for x86-32 that I would rather wait a bit on it. - In practice, we will want to change this eventually because it only means we generate less relocations (it also eliminates the need for the horrible '.set' hack that Darwin requires in some places). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122042 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Implement IsSymbolRefDifferenceFullyResolved.Daniel Dunbar2010-12-171-0/+25
| | | | | | | | - Unlike for fixups, we always do the "reliable" thing (not just for x86_64). - Since Darwin 'as' would typically reject things that using this will allow, we don't need to worry about compatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122038 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format ↵Daniel Dunbar2010-12-171-0/+6
| | | | | | | | specific hook. - Currently just has stub implementations for Mach-O, ELF, and COFF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122037 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Assembler: Strip out object writer arguments, now that it is always availableDaniel Dunbar2010-12-171-1/+1
| | | | | | -- and remove FIXME asking for the same! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122032 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Target: Remove HasScatteredSymbols target hook variable, which has beenDaniel Dunbar2010-12-171-5/+0
| | | | | | superceded and was effectively dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122024 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Lift some MachObjectWriter arguments into the target specificDaniel Dunbar2010-12-161-31/+29
| | | | | | interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121981 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Stub out explicit MCMachObjectTargetWriter interface.Daniel Dunbar2010-12-161-16/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121973 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Move createMachObjectWriter into MCMachObjectWriter.h.Daniel Dunbar2010-12-161-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121971 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Use fixup info instead of hard coded list.Daniel Dunbar2010-12-161-21/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121970 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix absolute recording of differences of symbols in two sections. Reduced ↵Rafael Espindola2010-12-071-0/+11
| | | | | | from ctor_dtor_count-2.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121152 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix relocations with weak definitions.Rafael Espindola2010-12-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121114 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix pcrel relocations that cross sections.Rafael Espindola2010-12-071-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121107 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash reduced from gcc produced assembly.Rafael Espindola2010-12-071-8/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121085 91177308-0d34-0410-b5e6-96231b3b80d8
* Sorry for such a large commit. The summary is that only MachO cares about theRafael Espindola2010-12-071-16/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | actuall addresses in a .o file, so it is better to let the MachO writer compute it. This is good for two reasons. First, areas that shouldn't care about addresses now don't have access to it. Second, the layout of each section is independent. I should use this in a subsequent commit to speed it up. Most of the patch is just removing the section address computation. The two interesting parts are the change on how we handle padding in the end of sections and how MachO can get the address of a-b when a and b are in different sections. Since now the expression evaluation normally doesn't know the section address, it will think that a-b needs relocation and let the MachO writer know. Once it has computed the section addresses, it calls back the expression evaluation with the section addresses to resolve these expressions. The remaining problem is the handling of padding. Currently it will create a special alignment fragment at the end. Since that fragment doesn't update the alignment of the section, it needs the real address to be computed. Since now the layout will not compute a-b with a and b in different sections, the only effect that the special alignment fragment has is update the address size of the section. This can also be done by the MachO writer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121076 91177308-0d34-0410-b5e6-96231b3b80d8
* use getSymbolOffset.Rafael Espindola2010-12-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121041 91177308-0d34-0410-b5e6-96231b3b80d8
* Another use of getSymbolOffset.Rafael Espindola2010-12-061-4/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121034 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for binary encoding of ARM 'adr' instructions referencing constantJim Grosbach2010-12-021-1/+6
| | | | | | pool entries (LEApcrel pseudo). Ongoing saga of rdar://8542291. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120635 91177308-0d34-0410-b5e6-96231b3b80d8
* Define generic 1, 2 and 4 byte pc relative relocations. They are commonRafael Espindola2010-11-281-6/+6
| | | | | | and at least the 4 byte one will be needed to implement the .cfi_* directives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120240 91177308-0d34-0410-b5e6-96231b3b80d8
* macho-dump: Add support for dumping relocation entries.Daniel Dunbar2010-11-271-14/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120216 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment.Daniel Dunbar2010-11-271-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120199 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce nesting.Daniel Dunbar2010-11-271-20/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120189 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Migrate more constants into MachOFormat.h.Daniel Dunbar2010-11-271-104/+37
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120188 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Mach-O: Introduce Object/MachOFormat for describing purely platform / machineDaniel Dunbar2010-11-271-38/+24
| | | | | | | independent information on the Mach object format, and move some stuff from MachObjectWriter.cpp there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120186 91177308-0d34-0410-b5e6-96231b3b80d8
* make isVirtualSection a virtual method on MCSection. Chris' suggestion.Rafael Espindola2010-11-171-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119547 91177308-0d34-0410-b5e6-96231b3b80d8
* MC: Simplify Mach-O and ELF object writer implementations.Daniel Dunbar2010-11-131-59/+13
| | | | | | - What was I thinking????? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118992 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Jim Grosbach2010-11-111-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118831 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow targets to specify the MachO CPUType/CPUSubtype information.Jim Grosbach2010-11-051-7/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118288 91177308-0d34-0410-b5e6-96231b3b80d8
* On ELF we need to know which symbols are used in relocations to decide ifRafael Espindola2010-10-051-1/+1
| | | | | | | 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