1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

49 Commits

Author SHA1 Message Date
Rafael Espindola
59c1246cee Remove duplicated code.
llvm-svn: 124054
2011-01-23 04:28:49 +00:00
Rafael Espindola
99f1527316 Add basic support for .cfi_personality.
llvm-svn: 122566
2010-12-26 20:20:31 +00:00
Jason W Kim
2f4a8d7553 1. ARM/MC/ELF: A few more ELF relocs for .o
2. Fixed EmitLocalCommonSymbol for ELF (Yes, they exist. :)
   Test added.

llvm-svn: 121951
2010-12-16 03:12:17 +00:00
Rafael Espindola
0e665e502d Fixed version of 121434 with no new memory leaks.
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola
011e168728 Revert my previous patch to make the valgrind bots happy.
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola
03ad1e8f1f Initial support for the cfi directives. This is just enough to get
f:
        .cfi_startproc
        nop
        .cfi_endproc

assembled (on ELF).

llvm-svn: 121434
2010-12-09 23:48:29 +00:00
Rafael Espindola
8dad37785c 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.

llvm-svn: 121076
2010-12-07 00:27:36 +00:00
Rafael Espindola
3e119b0bb4 Try to resolve symbol differences early, and if successful create a plain
data fragment. This reduces the time to assemble the test in 8711 from 60s to
54s.

llvm-svn: 120767
2010-12-03 00:55:40 +00:00
Rafael Espindola
2dabc56340 Move EmitValueToOffset to the ObjectStreamer.
llvm-svn: 120691
2010-12-02 05:59:38 +00:00
Rafael Espindola
3bc5d20c38 Add EmitInstToFragment to the generic object streamer.
llvm-svn: 120690
2010-12-02 05:44:06 +00:00
Rafael Espindola
4ba6ca3725 Move EmitValue to MCObjectStreamer.
llvm-svn: 120269
2010-11-28 23:08:47 +00:00
Rafael Espindola
53ee16b7b6 Fixed verson of r120245.
Factor some duplicated code into MCObjectStreamer::EmitLabel.

llvm-svn: 120248
2010-11-28 17:18:55 +00:00
Rafael Espindola
cb1e3ad6bc Revert previous patch while I debug the darwin bootstrap failure.
llvm-svn: 120246
2010-11-28 16:22:59 +00:00
Rafael Espindola
975a3f8fa7 Factor some duplicated code into MCObjectStreamer::EmitLabel.
llvm-svn: 120245
2010-11-28 15:54:36 +00:00
Rafael Espindola
422c24b736 Avoid code duplication in the many unsupported EmitGPRel32Value implementations.
llvm-svn: 120243
2010-11-28 15:09:24 +00:00
Rafael Espindola
f77005db2b 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
Rafael Espindola
81ecba9559 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
dc299d2615 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
Kevin Enderby
214e641d8d Added support for the Mach-O .symbol_resolver directive. rdar://8673046
llvm-svn: 119816
2010-11-19 18:39:33 +00:00
Rafael Espindola
b33e5e07e1 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
283e6bd938 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
1f6440b1e2 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
Rafael Espindola
59a93284d7 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
1884e6d475 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
444d9c0b02 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
1b4c835948 Fix warning.
llvm-svn: 119021
2010-11-14 01:34:31 +00:00
Rafael Espindola
1725702868 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
Jim Grosbach
a98b9ba916 Add '.code 32' assembler directive to MC streamers.
llvm-svn: 118309
2010-11-05 22:40:09 +00:00
Jim Grosbach
bbef2c5fcc MC'ize the '.code 16' and '.thumb_func' ARM directives.
llvm-svn: 118301
2010-11-05 22:08:08 +00:00
Benjamin Kramer
ac2bcb05cc Put class into an anonymous namespace.
llvm-svn: 118294
2010-11-05 19:56:38 +00:00
Rafael Espindola
2f114f8430 Write the line info to .debug_line.
llvm-svn: 117930
2010-11-01 17:07:14 +00:00
Rafael Espindola
5571ce5ed4 Move EmitInstruction to MCObjectStreamer so that ELF and MachO can share it.
llvm-svn: 117925
2010-11-01 16:27:31 +00:00
Rafael Espindola
7a38cb0144 Implement .weakref.
llvm-svn: 117911
2010-11-01 14:28:48 +00:00
Rafael Espindola
d085e53b36 Make sure weak symbols are listed after the local ones.
llvm-svn: 115795
2010-10-06 16:47:31 +00:00
Rafael Espindola
5f53528867 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.

llvm-svn: 115619
2010-10-05 15:11:03 +00:00
Jason W Kim
7822e6aab5 Tiny patch for proof-of-concept cleanup of ARMAsmPrinter::EmitStartOfAsmFile()
Small test for sanity check of resulting ARM .s file.
Tested against -r115129.

llvm-svn: 115133
2010-09-30 02:45:56 +00:00
Rafael Espindola
96509a5550 Move "local commons" to the end of .bss to match the gnu as behavior.
llvm-svn: 115037
2010-09-29 14:52:01 +00:00
Rafael Espindola
e4c0edf697 Move ELF to HasReliableSymbolDifference=true. Also take the opportunity to put
symbols defined in merge sections in independent atoms.

llvm-svn: 114786
2010-09-25 05:42:19 +00:00
Rafael Espindola
3cfff6e0c5 Avoid some Mach-O specific alignment being done on ELF.
llvm-svn: 114594
2010-09-22 22:27:05 +00:00
Rafael Espindola
a2d73f0a38 Correctly align bss.
llvm-svn: 114556
2010-09-22 17:43:04 +00:00
Rafael Espindola
02af3cdd58 Implement support for .local and its "interesting" interactions with .comm.
llvm-svn: 114382
2010-09-21 00:24:38 +00:00
Rafael Espindola
8a987c002e Add a InitSections method to the streamer interface.
The ELF implementation now creates text, data and bss to match the gnu as
behavior.

The text streamer still has the old MachO specific behavior since
the testsuite checks that it will error when a directive is given
before a setting the current section for example.

A nice benefit is that -n is not required anymore when producing
ELF files.

llvm-svn: 114027
2010-09-15 21:48:40 +00:00
Rafael Espindola
5b005d087c Factoring and potential bug fix. The elf "flags" cannot be used as masks.
For example, setting STT_OBJECT (1) and STT_FUNC (2), should not produce
a STT_SECTION (3).

llvm-svn: 113759
2010-09-13 17:39:45 +00:00
Roman Divacky
c0f16ab31a ELF_STB_Local is 0 so setting and checking it must be done specially
llvm-svn: 113375
2010-09-08 18:08:40 +00:00
Benjamin Kramer
4d2c506037 Allow MCSA_WeakRef in ELF. Patch by Roman Divacky.
llvm-svn: 112834
2010-09-02 17:18:32 +00:00
Benjamin Kramer
3aabb3eb53 Mark all common symbols external. This is not exactly correct but it lets apps
link for now and can be adjusted later. Patch by Roman Divacky.

llvm-svn: 112471
2010-08-30 11:56:55 +00:00
Benjamin Kramer
f5c811611e MCELF: Port EmitInstruction changes from MachO streamer. Patch by Roman Divacky.
llvm-svn: 112260
2010-08-27 10:40:51 +00:00
Eli Friedman
d2c0d2d0bb Fix a few warnings in and detabify MCELFStreamer and ELFObjectWriter.
llvm-svn: 111175
2010-08-16 19:15:06 +00:00
Matt Fleming
8183e01389 Add ELF ObjectWriter and Streamer support.
I forgot to add these files in commit 111172.

llvm-svn: 111174
2010-08-16 18:57:57 +00:00