Commit Graph

884 Commits

Author SHA1 Message Date
Rafael Espindola e5e1f9ad0f Make EmitIntValue non virtual.
llvm-svn: 120271
2010-11-28 23:22:44 +00:00
Rafael Espindola 0710e3771f Forgot the MCPureStreamer::EmitValue in the previous commit.
llvm-svn: 120270
2010-11-28 23:13:47 +00:00
Rafael Espindola a084fd6e9d Move EmitValue to MCObjectStreamer.
llvm-svn: 120269
2010-11-28 23:08:47 +00:00
Rafael Espindola e5b7415b21 Fixed verson of r120245.
Factor some duplicated code into MCObjectStreamer::EmitLabel.

llvm-svn: 120248
2010-11-28 17:18:55 +00:00
Rafael Espindola 1679580cc9 Revert previous patch while I debug the darwin bootstrap failure.
llvm-svn: 120246
2010-11-28 16:22:59 +00:00
Rafael Espindola d4b3feb3f7 Factor some duplicated code into MCObjectStreamer::EmitLabel.
llvm-svn: 120245
2010-11-28 15:54:36 +00:00
Rafael Espindola b746531c2c Avoid code duplication in the many unsupported EmitGPRel32Value implementations.
llvm-svn: 120243
2010-11-28 15:09:24 +00:00
Rafael Espindola 8a3a7923eb 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.

llvm-svn: 120240
2010-11-28 14:17:56 +00:00
Daniel Dunbar 0ac77d526d macho-dump: Add support for dumping relocation entries.
llvm-svn: 120216
2010-11-27 13:39:48 +00:00
Daniel Dunbar 768a5e8004 Fix a comment.
llvm-svn: 120199
2010-11-27 07:39:37 +00:00
Daniel Dunbar 4b128a5d4f Reduce nesting.
llvm-svn: 120189
2010-11-27 05:18:48 +00:00
Daniel Dunbar eab6e401fe MC/Mach-O: Migrate more constants into MachOFormat.h.
llvm-svn: 120188
2010-11-27 04:59:14 +00:00
Daniel Dunbar 2263ca4834 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.

llvm-svn: 120186
2010-11-27 04:19:38 +00:00
Rafael Espindola bf4a4e4ad9 Remove the unused TheTarget member.
llvm-svn: 120168
2010-11-26 04:24:21 +00:00
Michael J. Spencer f13f442b1a Fix Whitespace.
llvm-svn: 120166
2010-11-26 04:16:08 +00:00
Rafael Espindola f8e127eaf6 Factor some code to parseSectionFlags and fix the default type of a section.
llvm-svn: 120145
2010-11-25 15:32:56 +00:00
Rafael Espindola 9f75d5df0b Behave a bit more like gnu as and use the symbol (instead of the section)
for any relocation to a symbol defined in a tls section.

llvm-svn: 120121
2010-11-24 21:57:39 +00:00
Rafael Espindola 708ac4d6ad Relocate with the symbol if the relocation is of kind NTPOFF.
Patch by David Meyer, I added the test.

llvm-svn: 120104
2010-11-24 19:23:50 +00:00
Rafael Espindola e98d483b71 Fix and add tests for all cases in x86 and x86_64 where gnu as implicitly
sets the type of a symbol to STT_TLS.

llvm-svn: 120100
2010-11-24 18:51:21 +00:00
Rafael Espindola 4e70ac7b68 If a symbol is used as tls, mark it as tls even if not declare as so. Probably
fixes PR8659.

llvm-svn: 120076
2010-11-24 02:19:40 +00:00
Rafael Espindola 5c1d4e3b1e Invalidate the layout on any relaxation, not just Instructions. Bug found by David Meyer.
While here, remove unused argument and rename UpdateForSlide to Invalidate.

llvm-svn: 120009
2010-11-23 08:08:33 +00:00
Rafael Espindola 6e13aa1d3b Reuse data fragments while lowering. Patch by David Meyer.
llvm-svn: 119999
2010-11-23 05:49:35 +00:00
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