Commit Graph

98 Commits

Author SHA1 Message Date
Kevin Enderby
5afc19002e Fix a Darwin x86_64 special case of a jmp to a temporary symbol from an atom
without a base symbol that must not have a relocation entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139316 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 20:53:44 +00:00
Evan Cheng
5fbe5e783e Some autoconf tests use module level inline asm to test compiler's handling of
.cfi_startproc. e.g. libffi:

 $ cat confopt.c 
asm (".cfi_startproc\n\t.cfi_endproc");

int main () { return 0; }

Teach MC / dwarf emission to handle these cfi directives which essentially
create an empty frame.

rdar://10017184


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-24 22:31:37 +00:00
Benjamin Kramer
0d46ccfc5c MachOWriter: Don't crash on fixups with arithmetic, emit a relocation instead. This matches what as does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 01:51:29 +00:00
Jim Grosbach
75c2b2028b Move ARM-specific test to ARM directory.
Hopefully make the x86-target-only Windows bots happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133856 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 01:53:17 +00:00
Jim Grosbach
56fc642000 Testcase for r133818
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133823 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 20:59:01 +00:00
Rafael Espindola
e3a0e987f3 On MachO, unlike ELF, there should be no relocation to produce the CIE pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-10 20:59:42 +00:00
Daniel Dunbar
c8497b6a25 MCAsmLayout: Add support for computing the symbol offset of variables. Not
currently used, because variables don't get reported as being "defined".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:20:20 +00:00
Daniel Dunbar
90604ab725 MC: Change variable symbols to be recognized as defined, by assigning their sections based on FindAssociatedSection().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130523 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:20:17 +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
Daniel Dunbar
c6cf43d258 MC: Add support for disabling "temporary label" behavior. Useful for debugging
on Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 22:49:15 +00:00
Daniel Dunbar
8d06ffca9b MC/Mach-O: Fix regression introduced in r126127, this assignment shouldn't have
been removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127812 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 16:25:24 +00:00
Devang Patel
3fe3424a21 Move arch specific tests in arch specific directories.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24 19:06:27 +00:00
Daniel Dunbar
b2624eda5a MC/Mach-O/Thumb: Set the thumb bit in the symbol table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29 14:14:06 +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
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
Rafael Espindola
ecbbf40d5c Add reduced test from 8845.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122438 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 21:15:13 +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
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
17304b3489 MC/Expr: Implemnt more aggressive folding during symbol evaluation using
IsSymbolRefDifferenceFullyResolved(). For example, we will now fold away
something like:
--
_a:
...
L0:
...
L1:
...
.long (L1 - L0) / 2
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122043 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 05:50:33 +00:00
Rafael Espindola
2bf6afc277 Relax alignment fragments.
With this we don't need the EffectiveSize field anymore. Without that field
LayoutFragment only updates offsets and we don't need to invalidate the
current fragment when it is relaxed (only the ones following it).

This is also a very small improvement in the accuracy of the layout info as
we now use the after relaxation size immediately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 08:45:53 +00:00
Rafael Espindola
f9a4476173 Patch by David Meyer to avoid a O(N^2) behaviour when relaxing fragments.
Since we now don't update addresses so early, we might relax a bit more than
we need to. This is simillar to the issue in PR8467.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 07:39:29 +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
0bbe0b440e Second try at making direct object emission produce the same results
as llc + llvm-mc. This time ELF is not changed and I tested that llvm-gcc
bootstrap on darwin10 using darwin9's assembler and linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 17:27:56 +00:00
Rafael Espindola
5d4918dbd1 There are two reasons why we might want to use
foo = a - b
.long foo
instead of just
.long a - b

First, on darwin9 64 bits the assembler produces the wrong result. Second,
if "a" is the end of the section all darwin assemblers (9, 10 and mc) will not
consider a - b to be a constant but will if the dummy foo is created.

Split how we handle these cases. The first one is something MC should take care
of. The second one has to be handled by the caller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 03:21:47 +00:00
Rafael Espindola
767b1be390 Next step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
doing that if the target is darwin10 or newer.

This fixes
*) Direct object emission was producing objects without the workaround on
   darwin9.
*) Assembly printing was producing objects with the workaround on linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 00:31:13 +00:00
Daniel Dunbar
44fa0473ae macho-dump: Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120185 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 04:00:06 +00:00
Rafael Espindola
2ace1b68ac Use multiple 0x66 prefixes so that all nops up to 15 bytes are a single instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25 17:14:16 +00:00
Kevin Enderby
e8e98d7f2e Added support for the Mach-O .symbol_resolver directive. rdar://8673046
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 18:39:33 +00:00
Rafael Espindola
7339fb5dae Change the 11 byte nop to be a single instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 23:10:30 +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
Rafael Espindola
228290c0d1 Change section_data dumping to print hex numbers instead of using
python's %r.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 15:25:58 +00:00
Chris Lattner
a247685b30 fix the encoding of the "jump on *cx" family of instructions,
rdar://8061602


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 04:30:51 +00:00
Kevin Enderby
bd658918df MC/X86: Add aliases for Jcc variants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 21:33:19 +00:00
Eric Christopher
bd3ba537cd Add a quick test of relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 00:53:40 +00:00
Eric Christopher
02b46bc942 Add support for initialized global data for darwin tls. Update comments
and testcases accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 21:28:50 +00:00
Eric Christopher
591466baff A more combo tls testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104163 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 21:19:42 +00:00
Eric Christopher
aa6c72ec95 Few more simple tls testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 20:35:15 +00:00
Eric Christopher
b4e876e37e Quick test to make sure we're emitting the tbss section correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 21:40:20 +00:00
Kevin Enderby
d8ba292c9b Fixed the problem with a branch to "0b" that was not parsed by llvm-mc
correctly.  The Lexer was incorrectly eating the newline casusing it to branch
to address 0.  Updated the test case to use a "0:" label and a branch to "0b".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 17:51:35 +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
Kevin Enderby
ebe7fcd041 Added support in MC for Directional Local Labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 23:08:19 +00:00
Daniel Dunbar
648ac5153e MC/Mach-O/x86: Optimal nop sequences should only be used for the .text sections, not all sections in the text segment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 21:54:30 +00:00
Daniel Dunbar
db9014dd8b MC/Mach-O: Reverse order of SymbolData scanning when emitting instructions.
- This fixes a string table mismatch with 'as' when two new symbols are defined
   in a single instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 21:19:59 +00:00
Daniel Dunbar
b18d2dd115 MC/Mach-O: Fix some differences in symbol flag handling.
- Don't clear weak reference flag, 'as' was only "trying" to do this, it wasn't
   actually succeeding.
 - Clear the "lazy bound" bit when we mark something external. This corresponds
   roughly to the lazy clearing of the bit that 'as' implements in
   symbol_table_lookup.
 - The exact meaning of these flags appears pretty loose, since 'as' isn't very
   consistent. For now we just try to match 'as', we will clean this up one day
   hopefully.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 20:12:31 +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
2f93667f0b MC/Mach-O: Add another zerofill test to improve coverage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103691 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 01:10:28 +00:00