Commit Graph

209 Commits

Author SHA1 Message Date
Jim Grosbach
ba8297ec08 Refactor MachO relocation generaration into the Target directories.
Move the target-specific RecordRelocation logic out of the generic MC
MachObjectWriter and into the target-specific object writers. This allows
nuking quite a bit of target knowledge from the supposedly target-independent
bits in lib/MC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 23:44:37 +00:00
Jim Grosbach
32e7abd080 tidy up whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133815 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 19:43:27 +00:00
Jim Grosbach
535e58b910 Fixup info for Thumb2 unconditional branch.
rdar://9667872

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133808 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 18:48:32 +00:00
Jim Grosbach
0edb05b9e4 Tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133770 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 22:29:00 +00:00
Bill Wendling
3f2ea825bd 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133668 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 00:09:43 +00:00
Bill Wendling
bbdffa9ab0 Move class methods out-of-line. This reduces the indentation, and is more in
line with LLVM's general coding style.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133645 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 21:07:27 +00:00
Daniel Dunbar
173aa9ce32 MC/Mach-O: Update getSymbolAddress() to support evaluation of variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:13:42 +00:00
Daniel Dunbar
5ff919b324 MC/Mach-O: Allow emission of relocations for variables in some more cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:10:47 +00:00
Daniel Dunbar
08b9935b51 MC/Mach-O: Find section ordinal's by looking at the symbol, instead of assuming they are present in a fragment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:07:43 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Owen Anderson
7614783f2d Fix a bug introduced by my patch yesterday: BL is a 4-byte instructions like BLX, rather than a 2-byte instruction like B.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128169 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 21:19:56 +00:00
Owen Anderson
f862b35b0b RIT_ARM_ThumbBranch32Bit relocations are not used and should never be generated.
This fixes kimwitu++, bullet, and tramp3dv4 with the ARM integrated assembler.
Fixes <rdar://problem/9165738>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128117 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 22:52:54 +00:00
Duncan Sands
36b8e43a3e Silence compiler warning about case values not being in the enumerated type
MCFixupKind.  This is the same technique that is used elsewhere in MC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127676 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 08:54:51 +00:00
Oscar Fuentes
9bf9aa5106 Fixes warnings emitted by Visual Studio 2010 compiler.
Patch by Erik Olofsson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 23:11:57 +00:00
Jason W Kim
685c350ae7 Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps.
(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
2011-02-04 19:47:15 +00:00
Evan Cheng
e087afa128 Fix bogus assert condition noticed by Csaba Raduly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124645 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 01:50:49 +00:00
Evan Cheng
f3eb3bba16 Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.
- 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
2011-01-14 02:38:49 +00:00
Daniel Dunbar
e862453806 MC/Mach-O/Thumb: Select appropriate relocation types for Thumb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 14:49:49 +00:00
Rafael Espindola
fea753b397 Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
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
2010-12-24 21:22:02 +00:00
Daniel Dunbar
4010dd72b8 MC/Mach-O/ARM: Start handling some Thumb branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 16:41:46 +00:00
Daniel Dunbar
72123334ad MC/Mach-O/ARM: Don't try to use scattered relocs for BR24 fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 21:26:43 +00:00
Matt Beaumont-Gay
33a03c73ef Fix another conditional expression mismatched enum type warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 18:25:55 +00:00
Daniel Dunbar
df561e0234 MC/Mach-O/ARM: We always use the SECTDIFF reloc type on ARM, which is
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
2010-12-22 16:52:19 +00:00
Daniel Dunbar
25bcc9cdc8 MC/Mach-O/ARM: Clone off an ARM version of RecordScatteredRelocation until I 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
2010-12-22 16:45:29 +00:00
Daniel Dunbar
5cc6390495 MC/Mach-O: Return to reporting errors if we see unexpected fixup kinds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:32:41 +00:00
Daniel Dunbar
3664564395 MC/Mach-O/ARM: Recognize generic _Data_N fixup kinds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:32:37 +00:00
Daniel Dunbar
294e67861c MC/Mach-O/ARM: Add enough relocation logic to get BR24 relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122407 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:19:24 +00:00
Daniel Dunbar
fdfbc6a652 MC/Mach-O/ARM: Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:19:20 +00:00
Daniel Dunbar
4d74305a1f MC/Mach-O/ARM: Stub out RecordARMRelocation, which is mostly a copy of
RecordRelocation with lots of FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122402 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 13:50:05 +00:00
Daniel Dunbar
42b5286627 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122401 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 13:49:56 +00:00
Daniel Dunbar
532c456d48 MC/Mach-O: Split out RecordARMRelocation for now, it is weird enough it isn't
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
2010-12-22 13:49:43 +00:00
Matt Beaumont-Gay
e733cf8c27 GCC objects to the two sides of a conditional expression having different enum
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
2010-12-21 23:43:23 +00:00
Daniel Dunbar
e1feeb9da4 MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrong
type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122334 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 15:26:45 +00:00
Rafael Espindola
3132780a2e Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 06:27:54 +00:00
Rafael Espindola
1ec5bd31fe Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 05:37:28 +00:00
Daniel Dunbar
b87422778c MC/Mach-O: On second thought, use a custom hook for enabling aggressive
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
2010-12-17 05:50:29 +00:00
Daniel Dunbar
32c1c5ae5f MC/Mach-O: Implement IsSymbolRefDifferenceFullyResolved.
- 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
2010-12-17 04:54:58 +00:00
Daniel Dunbar
1f3662abba MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format 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
2010-12-17 04:54:54 +00:00
Daniel Dunbar
5d2477cecf MC/Assembler: Strip out object writer arguments, now that it is always available
-- and remove FIXME asking for the same!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:45:59 +00:00
Daniel Dunbar
7b62afac0a MC/Target: Remove HasScatteredSymbols target hook variable, which has been
superceded and was effectively dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:06:08 +00:00
Daniel Dunbar
5d05d9769e MC/Mach-O: Lift some MachObjectWriter arguments into the target specific
interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 17:21:02 +00:00
Daniel Dunbar
ae5abd595f MC/Mach-O: Stub out explicit MCMachObjectTargetWriter interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 16:09:19 +00:00
Daniel Dunbar
aa4b7dd13b MC/Mach-O: Move createMachObjectWriter into MCMachObjectWriter.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 16:08:33 +00:00
Daniel Dunbar
7e06af85d1 MC/Mach-O: Use fixup info instead of hard coded list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121970 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 15:42:31 +00:00
Rafael Espindola
545b77ef50 Fix absolute recording of differences of symbols in two sections. Reduced from ctor_dtor_count-2.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121152 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 17:12:32 +00:00
Rafael Espindola
3b3148f864 Fix relocations with weak definitions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 05:57:28 +00:00
Rafael Espindola
bf60dad984 Fix pcrel relocations that cross sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 03:50:14 +00:00
Rafael Espindola
f10d2be573 Fix a crash reduced from gcc produced assembly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 01:09:54 +00:00
Rafael Espindola
85f2ecc697 Sorry for such a large commit. The summary is that only MachO cares about the
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
2010-12-07 00:27:36 +00:00
Rafael Espindola
1dda29bdff use getSymbolOffset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121041 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 21:51:55 +00:00
Rafael Espindola
f96d17b886 Another use of getSymbolOffset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 19:55:05 +00:00
Jim Grosbach
dff84b0325 Add support for binary encoding of ARM 'adr' instructions referencing constant
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
2010-12-02 00:28:45 +00:00
Rafael Espindola
e04ed7e45f Define generic 1, 2 and 4 byte pc relative relocations. They are common
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
2010-11-28 14:17:56 +00:00
Daniel Dunbar
90e3e3a429 macho-dump: Add support for dumping relocation entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120216 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 13:39:48 +00:00
Daniel Dunbar
590956f24f Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 07:39:37 +00:00
Daniel Dunbar
7976b88d9f Reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 05:18:48 +00:00
Daniel Dunbar
f52788f4e6 MC/Mach-O: Migrate more constants into MachOFormat.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120188 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 04:59:14 +00:00
Daniel Dunbar
821ecd7c90 MC/Mach-O: Introduce Object/MachOFormat for describing purely platform / machine
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
2010-11-27 04:19:38 +00:00
Rafael Espindola
f2dc4aa562 make isVirtualSection a virtual method on MCSection. Chris' suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:03:54 +00:00
Daniel Dunbar
115a3dd066 MC: Simplify Mach-O and ELF object writer implementations.
- What was I thinking?????

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 07:33:40 +00:00
Jim Grosbach
3c3849297b Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 20:16:23 +00:00
Jim Grosbach
c9d1439051 Allow targets to specify the MachO CPUType/CPUSubtype information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05 18:48:58 +00:00
Rafael Espindola
8f413fa9c0 On ELF we need to know which symbols are used in relocations to decide if
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
2010-10-05 15:11:03 +00:00
Kevin Enderby
8c9aa922a9 This adds a Darwin x86_64 relocation encoding for a subtraction expression
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
2010-10-02 00:13:41 +00:00
Rafael Espindola
a8c02c3bdd Correctly produce R_X86_64_32 or R_X86_64_32S.
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
2010-09-30 03:11:42 +00:00
Rafael Espindola
7070387f08 Make it possible for the MCObjectWriter to decide if a given fixup is fully
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
2010-09-30 02:22:20 +00:00
Rafael Espindola
b814110612 Remove unused argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 18:13:03 +00:00
Daniel Dunbar
23bea41ec6 MC/Mach-O/i386: Fix a crash in relocation handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 15:21:50 +00:00
Chris Lattner
abf8f9cbb8 silence a vc2010 warning: " result of 32-bit shift implicitly converted to
64 bits (was 64-bit shift intended?)", pointed out by 'nobled' on llvmdev


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 16:35:20 +00:00
Michael J. Spencer
b0f3b3e7de Revert "MC/MachO: Fix possible null pointer dereference."
This reverts commit 110575.

Target.isAbsolute() is true if SD would be null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 16:00:49 +00:00
Michael J. Spencer
c1f354dcb8 MC/MachO: Fix possible null pointer dereference.
Discovered by Microsoft Visual Studio 2010 Code Analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110575 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 15:28:05 +00:00
Chris Lattner
da3051a17f finish up support for callw: PR7195
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107826 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 22:35:13 +00:00
Duncan Sands
5b96b26eb7 The variable "Value" is carefully set to Layout.getSymbolAddress,
but then not actually used - maybe a bug?  Remove the variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 13:26:33 +00:00
Eric Christopher
1008d35000 Get the addend correct for i386 pic.
Thanks Daniel!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106608 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 23:51:47 +00:00
Eric Christopher
04b8d3cc49 Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 00:49:46 +00:00
Eric Christopher
bc06737c35 In progress on 32-bit addends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106154 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 21:32:38 +00:00
Daniel Dunbar
843aa1f15b MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 20:04:29 +00:00
Eric Christopher
e48dbf8d83 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 00:26:36 +00:00
Eric Christopher
c9ada472c8 Some more work on mach-o TLV relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 22:59:05 +00:00
Eric Christopher
aeed4d81a8 Rearrange conditionals so we don't get caught with the correct type as wrong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104793 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 00:52:31 +00:00
Daniel Dunbar
c90e30aa6f MC: Eliminate MCAsmFixup, replace with MCFixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 15:18:56 +00:00
Daniel Dunbar
482ad802f1 MC: Use accessors for access to MCAsmFixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104697 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 15:18:31 +00:00
Eric Christopher
96ac5156ca Start adding mach-o tls reloc support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 00:02:12 +00:00
Benjamin Kramer
c37791e875 Reduce string trashing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 14:14:22 +00:00
Daniel Dunbar
2ae4bfd769 MC/Mach-O: Implement support for setting indirect symbol table offset in section header.
Also, create symbol data for LHS of assignment, to match 'as' symbol ordering better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 17:28:24 +00:00
Daniel Dunbar
56279f42b6 MC/Mach-O: Remove some FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 17:28:20 +00:00
Daniel Dunbar
f0f6cdb6b4 MC/Mach-O/x86_64: Darwin's special "signed_N" relocation types should only be
used to replace a normal relocation, not a reference to a GOT entry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 18:53:40 +00:00
Daniel Dunbar
db4c7e606f MC/Mach-O/x86_64: Fix PCrel adjustment for x86_64, which was using the fixup
offset instead of the fixup address as intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:53:11 +00:00
Daniel Dunbar
640e948f09 MC/Mach-O: As Kevin pointed out, 'Address' is really an offset -- rename to clarify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103526 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:53:07 +00:00
Daniel Dunbar
ef4591ef79 MC/Mach-O: Fix a crash on invalid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:53:05 +00:00
Daniel Dunbar
a8251fac10 MC/Mach-O: Fix another mismatch with .weak_definition, we shouldn't use a
scattered relocation entry with a .weak_definition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-10 23:15:20 +00:00
Daniel Dunbar
e9460ec057 MC/Mach-O: Factor out doesSymbolRequireExternRelocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-10 23:15:13 +00:00
Kevin Enderby
a6eeb6e226 Fix i386 relocations to Weak Definitions. The relocation entries should be
external and the item to be relocated should not have the address of the
symbol added in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103302 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 21:44:23 +00:00
Daniel Dunbar
2d7fd61e94 MC/Mach-O: Mark absolute variable's appropriately, and add Mach-O support for
writing them.
 - <rdar://problem/7885351> integrated assembler broken for i386 objc code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103112 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 19:01:05 +00:00
Daniel Dunbar
ae7fb0b03e MC/Mach-O/x86_64: Relocations in debug sections should use local relocations
when possible.
 - <rdar://problem/7934873>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 17:22:39 +00:00
Benjamin Kramer
454c4ce479 Various MSVC warning fixes about truncated 64 bit shifts and const pointers passed to free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100767 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 15:25:57 +00:00
Chris Lattner
75361b69f3 rename llvm::llvm_report_error -> llvm::report_fatal_error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:58:41 +00:00
Daniel Dunbar
1de558b71f MC/Mach-O/x86_64: Support @GOTPCREL on symbols, even for non-PCrel relocations!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-29 23:56:40 +00:00
Daniel Dunbar
8fb040308c MC/Mach-O: Switch to MCSectionData::getOrdinal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 08:08:54 +00:00
Daniel Dunbar
b026d64bf2 Fix -Asserts warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99499 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 07:10:05 +00:00
Daniel Dunbar
5d428511ca MC: Route access to SectionData offset and file size through MCAsmLayout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 02:00:07 +00:00
Daniel Dunbar
432cd5fd9b MC: Route access to Fragment offset and effective size through MCAsmLayout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 02:00:02 +00:00
Daniel Dunbar
207e06ea04 MC: Direct all {fragment,section,symbol} address access through the MCAsmLayout object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 03:43:40 +00:00
Daniel Dunbar
35b0657dea Add a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99228 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-22 23:16:43 +00:00
Daniel Dunbar
b751418a39 MC: Change MCObjectWriter::RecordRelocation to take an MCFragment (instead of a MCDataFragment). Object files should only need the generic MCFragment features.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-22 20:35:50 +00:00
Daniel Dunbar
873decbb37 Better fix for r98994, MachObjectWriterImpl wasn't intended to be virtual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 01:58:40 +00:00
Rafael Espindola
a407fa830a Fix -Wnon-virtual-dtor warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:26:46 +00:00
Daniel Dunbar
602b40f0d0 MC/Mach-O/x86_64: Add relocation support.
- This is "extraordinarily" Darwin 'as' compatible. See the litany of FIXMEs littered about for more information.
 - There are a few cases which seem to clearly be 'as' bugs which I have left unsupported, and there is one cases where we diverge but should fix if it blocks diffing .o files (Darwin 'as' ends up widening a jump unnecessarily).
 - 403.gcc build, runs, and diffs equivalently to the 'as' built version now (using llvm-mc). However, it builds so slowly that I wouldn't recommend trying it quite yet. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 18:07:55 +00:00
Daniel Dunbar
2df4ceba15 MC/Mach-O: Move to MachObjectWriter.{h,cpp}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 10:43:15 +00:00