Commit Graph

862 Commits

Author SHA1 Message Date
Jason W Kim 767a1e9adc Fixed some style issues (no _, no spc after !)
llvm-svn: 119986
2010-11-22 22:05:16 +00:00
Jason W Kim 16b75262c4 Make the <ARCH>ELFObjectWriter statics private
llvm-svn: 119982
2010-11-22 18:57:00 +00:00
Jason W Kim 84ffdd5cf1 Fix misplaced statics.
llvm-svn: 119981
2010-11-22 18:47:05 +00:00
Jason W Kim a262546df7 Kill trailing whitespace
llvm-svn: 119979
2010-11-22 18:42:07 +00:00
Jason W Kim 7c7d0ef287 Refactor the ELFRelocationEntry (pull up) and move the arch-specific statics to inside the class where it belongs.
Next step is to rationally break apart the RecordRelocation()

Probably the step will be to have 1 member function for ech slot of the ELFRelocationEntry()

llvm-svn: 119978
2010-11-22 18:41:13 +00:00
Rafael Espindola 3c227b0b89 Add basic CFI methods to the streamer interface.
llvm-svn: 119972
2010-11-22 14:27:24 +00:00
Rafael Espindola 556f203d64 Remove some #includes.
llvm-svn: 119967
2010-11-22 11:53:17 +00:00
Wesley Peck 7699d6cfe9 Implement ELF object file writing support for the MBlaze backend. Its not perfect yet, but it works for many tests.
llvm-svn: 119952
2010-11-21 22:06:28 +00:00
Rafael Espindola 26cb15a549 Handle PCRel relocations with absolute values. Fixes PR8656.
llvm-svn: 119917
2010-11-21 00:48:25 +00:00
Kevin Enderby 8be14414f6 Added support for the Mach-O .symbol_resolver directive. rdar://8673046
llvm-svn: 119816
2010-11-19 18:39:33 +00:00
Rafael Espindola 9900b4802e Add a MCLineSectionOrder vector so that we produce the line tables in a
deterministic order.

llvm-svn: 119795
2010-11-19 07:41:23 +00:00
Rafael Espindola 0b4c9aa9a9 Add an assert.
llvm-svn: 119788
2010-11-19 04:55:36 +00:00
Rafael Espindola 92ca933f6e Fix llvm-gcc boostrap on OS X by avoiding printing sleb and uleb when
possible.

llvm-svn: 119785
2010-11-19 04:10:13 +00:00
Rafael Espindola b58867ccba Change some methods in MCDwarf.cpp to be able to handle an arbitrary
MCStreamer instead of just MCObjectStreamer. Address changes cannot
be as efficient as we have to use DW_LNE_set_addres, but at least
most of the logic is shared.

This will be used so that, with CodeGen still using EmitDwarfLocDirective,
llvm-gcc is able to produce debug_line sections without needing an
assembler that supports .loc.

llvm-svn: 119777
2010-11-19 02:26:16 +00:00
Rafael Espindola 67c6ab8865 Change CodeGen to use .loc directives. This produces a lot more readable output
and testing is easier.  A good example is the unknown-location.ll test that
now can just look for ".loc 1 0 0".  We also don't use a DW_LNE_set_address for
every address change anymore.

llvm-svn: 119613
2010-11-18 02:04:25 +00:00
Rafael Espindola 7a2cd8b540 make isVirtualSection a virtual method on MCSection. Chris' suggestion.
llvm-svn: 119547
2010-11-17 20:03:54 +00:00
Jim Grosbach d82684c7fc Fix typo.
llvm-svn: 119542
2010-11-17 19:30:11 +00:00
Rafael Espindola b67912d5cd Add support for .int.
llvm-svn: 119512
2010-11-17 16:24:40 +00:00
Rafael Espindola 5c996894bd Add support for .2byte, .4byte and .8byte.
Fixes PR8631.

llvm-svn: 119511
2010-11-17 16:15:42 +00:00
Daniel Dunbar 95d37be1a9 MC-JIT: Stub out "pure" streamer.
- No immediate use, but maybe someone feels like hacking on it.

llvm-svn: 119510
2010-11-17 16:06:47 +00:00
Rafael Espindola c653a895c8 Add .loc methods to the streamer.
Next: Add support for the !HasDotLocAndDotFile case to the MCAsmStreamer
and then switch codegen to use it.

llvm-svn: 119384
2010-11-16 21:20:32 +00:00
Rafael Espindola 3bbea57a6e Parse and ignore some .cfi_* directives.
llvm-svn: 119362
2010-11-16 18:34:07 +00:00
Rafael Espindola 7d19efd6ff A bit more of gnu as compatibility when handling relocations with aliases.
llvm-svn: 119328
2010-11-16 04:11:46 +00:00
Benjamin Kramer 202d91e433 Fix compiler warnigns.
llvm-svn: 119175
2010-11-15 19:20:50 +00:00
Rafael Espindola 8c3039b67b Change MCExpr::EvaluateAsRelocatableImpl of variables to return the original
variable if recursing fails to simplify it.

Factor AliasedSymbol to be a method of MCSymbol.

Update MCAssembler::EvaluateFixup to match the change in
EvaluateAsRelocatableImpl.

Remove the WeakRefExpr hack, as the object writer now sees the weakref with
no extra effort needed.

Nothing else is using MCTargetExpr, but keep it for now.

Now that the ELF writer sees relocations with aliases, handle

    .weak    foo2
foo2:
    .weak    bar2
    .set    bar2,foo2
    .quad    bar2

the same way gas does and produce a relocation with bar2.

llvm-svn: 119152
2010-11-15 16:33:49 +00:00
Jason W Kim 96f4c01cb3 Dovetail with Dan Dunbar's rework of ELFObjectWriter.
Added 2 new subclasses - X86ELFObjectWriter and ARMELFObectWriter.
ARM and X86 require different code for RecordRelocation(), possibly others.

llvm-svn: 119149
2010-11-15 16:18:39 +00:00
Rafael Espindola 46c79ef113 Fix PR8565.
This moves most of the isUsed logic to the MCSymbol itself. With this we
get a bit more relaxed about allowing definitions after uses: uses that
don't evaluate their argument immediately (jmp foo) are accepted.

ddunbar, this was the smallest compromise I could think of that lets us
accept gcc (and clang!) assembly.

llvm-svn: 119144
2010-11-15 14:40:36 +00:00
Chris Lattner 9e7d8c0313 correct the fixup comment printer to work on big endian platforms.
llvm-svn: 119122
2010-11-15 05:56:19 +00:00
Chris Lattner edb9d84dcc add targetoperand flags for jump tables, constant pool and block address
nodes to indicate when ha16/lo16 modifiers should be used.  This lets
us pass PowerPC/indirectbr.ll.

The one annoying thing about this patch is that the MCSymbolExpr isn't
expressive enough to represent ha16(label1-label2) which we need on
PowerPC.  I have a terrible hack in the meantime, but this will have
to be revisited at some point.

Last major conversion item left is global variable references.

llvm-svn: 119105
2010-11-15 02:46:57 +00:00
Rafael Espindola 240028d11d Move the logic to decide with which symbol we produce a relocation (if any) to
a central location. This also makes us a bit more compatible with gas.

llvm-svn: 119094
2010-11-14 23:53:26 +00:00
Chris Lattner 94f0c14cb0 reimplement ppc asmprinter "toc" handling to use a VariantKind
on the operand, required for .o file writing and fixing 
the PowerPC/mult-alt-generic-powerpc64.ll failure with the new
instprinter.

llvm-svn: 119087
2010-11-14 22:22:59 +00:00
Rafael Espindola a7d0bed336 Fix another case of a .comm directive without a corresponding .type
directive.

llvm-svn: 119073
2010-11-14 21:11:16 +00:00
Rafael Espindola b05ef7377a Fix the type of a symbol created with .comm and no corresponding .type.
llvm-svn: 119060
2010-11-14 19:40:55 +00:00
Rafael Espindola 7d0ba3464e Handle a peculiar comdat case: Creating a section with an undefined
signature symbol causes a local symbol to be created unless there is
some other use of the symbol.

llvm-svn: 119026
2010-11-14 04:17:37 +00:00
Rafael Espindola 0e3decfcf7 Simplify getSymbolIndexInSymbolTable by setting the actual index of
the symbols.

llvm-svn: 119022
2010-11-14 03:12:24 +00:00
Rafael Espindola eba9022652 Fix warning.
llvm-svn: 119021
2010-11-14 01:34:31 +00:00
Daniel Dunbar fe0c28f4db MC: Simplify Mach-O and ELF object writer implementations.
- What was I thinking?????

llvm-svn: 118992
2010-11-13 07:33:40 +00:00
Rafael Espindola 2d006b1ade Fix warning and add support for printing gnu_unique_object.
llvm-svn: 118981
2010-11-13 04:55:06 +00:00
Rafael Espindola 4bcf94c75a Parse and record the gnu_unique_object type.
llvm-svn: 118980
2010-11-13 04:51:02 +00:00
Rafael Espindola f01b622902 Parse and remember discriminators in .loc line. I try to output them with
another patch.
This lets us parse a bit more of the gcc 4.5 output.

llvm-svn: 118975
2010-11-13 03:18:27 +00:00
Rafael Espindola 1d37f35eea Fix the encoding of negative line deltas.
llvm-svn: 118962
2010-11-13 01:06:27 +00:00
Benjamin Kramer dcc7732f88 MCELF: Copy the symbol name only if we're going to modify it.
llvm-svn: 118920
2010-11-12 19:26:04 +00:00
Rafael Espindola c4f4b2e878 Remove what looks like dead code in the production of debug lines.
We only produce debug line information if we have seen a line directive, so
this code is dead. Also, if we want to be bug by bug compatible with
gas and sometimes produce "empty" .debug_line sections, this will
match the content produced by gas.

llvm-svn: 118914
2010-11-12 18:41:26 +00:00
Rafael Espindola de990b270d gnu as support both % and @ before types, do the same.
llvm-svn: 118893
2010-11-12 15:47:08 +00:00
Jim Grosbach ba321cb120 Trailing whitespace.
llvm-svn: 118831
2010-11-11 20:16:23 +00:00
Rafael Espindola 84d031870c Mark labels declared in tls sections as STT_TLS. This matches the behavior of
gas.

llvm-svn: 118818
2010-11-11 19:04:55 +00:00
Rafael Espindola a3e9a2298d Initial comdat implementation.
llvm-svn: 118805
2010-11-11 18:13:52 +00:00
Rafael Espindola fb6540c112 Make AliasedSymbol able to handle MCTargetExpr. They can get here if
a weakref is used with a VariantKind.

llvm-svn: 118798
2010-11-11 17:24:43 +00:00
Rafael Espindola fa7b55754c Fix the symbol index of weak references. Also make RecordRelocation a bit
easier to read by having const references to the symbol, aliased symbol and
renamed symbol.

llvm-svn: 118793
2010-11-11 16:48:11 +00:00
Rafael Espindola 19fa38000a Remove some explicit arguments to getELFSection. This is
a leftover from the removal of isExplicit.

llvm-svn: 118774
2010-11-11 03:40:25 +00:00