1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

307 Commits

Author SHA1 Message Date
Rafael Espindola
709ffb7084 Use getFixupKindInfo to implement isFixupKindPCRel, ELF version.
llvm-svn: 122050
2010-12-17 07:28:17 +00:00
Daniel Dunbar
2caf23b5a9 MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific hook.
- Currently just has stub implementations for Mach-O, ELF, and COFF.

llvm-svn: 122037
2010-12-17 04:54:54 +00:00
Daniel Dunbar
f77af712b7 MC/Assembler: Strip out object writer arguments, now that it is always available
-- and remove FIXME asking for the same!

llvm-svn: 122032
2010-12-17 02:45:59 +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
Jason W Kim
b5cc5dad79 First cut of ARM/MC/ELF PIC relocations.
Test has fixme, to move to .s -> .o test when AsmParser works better.

llvm-svn: 121732
2010-12-13 23:16:07 +00:00
Jim Grosbach
a378c43eae Thumb unconditional branch binary encoding. rdar://8754994
llvm-svn: 121496
2010-12-10 18:21:33 +00:00
Jim Grosbach
61fe7b9ee5 Rename CB/CBZ specific fixup accordingly.
llvm-svn: 121404
2010-12-09 19:50:12 +00:00
Jason W Kim
2e6e50c1b0 ARM/MC/ELF TPsoft is now a proper pseudo inst.
Added test to check bl __aeabi_read_tp gets emitted properly for ELF/ASM
as well as ELF/OBJ (including fixup)

Also added support for ELF::R_ARM_TLS_IE32

llvm-svn: 121312
2010-12-08 23:14:44 +00:00
Bill Wendling
9756f7c7b0 Support the "target" encodings for the CB[N]Z instructions.
llvm-svn: 121308
2010-12-08 23:01:43 +00:00
Bill Wendling
dac1f24d98 Add support for loading from a constant pool.
llvm-svn: 121226
2010-12-08 01:57:09 +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
Jim Grosbach
2d361b9318 Add fixup for Thumb1 BL/BLX instructions.
llvm-svn: 121072
2010-12-06 23:57:07 +00:00
Jason W Kim
672ef014da Refactor ELFObjectWriter.
+ ARM/X86/MBlaze now share a common RecordRelocation
+ ARM/X86/MBlaze arch specific routines are limited to GetRelocType()

llvm-svn: 121043
2010-12-06 21:57:34 +00:00
Rafael Espindola
0ba01a5b5c Remove the getAddress getter, initialize Ordinal in the constructor and use
that on the ELF writer to detect a section we created.

llvm-svn: 120981
2010-12-06 03:48:09 +00:00
Rafael Espindola
1b2090ef24 Add a getSymbolOffset method and use it in the ELF writer.
llvm-svn: 120977
2010-12-06 02:57:26 +00:00
Rafael Espindola
41bdd97d48 The sections that the ELF object writer has to create are very simple and
contain only data. Handle them specially instead of using AddSectionToTheEnd.
This moves a hack from the generic assembler to the elf writer. It is also
a bit faster and should make other improvements easier.

llvm-svn: 120683
2010-12-02 03:09:06 +00:00
Jim Grosbach
0e71db6919 Add support for binary encoding of ARM 'adr' instructions referencing constant
pool entries (LEApcrel pseudo). Ongoing saga of rdar://8542291.

llvm-svn: 120635
2010-12-02 00:28:45 +00:00
Owen Anderson
8802c68592 Add correct encodings for STRD and LDRD, including fixup support. Additionally, update these to unified syntax.
llvm-svn: 120589
2010-12-01 19:18:46 +00:00
Jim Grosbach
538c57aeed Fix a mised reloc rename spot.
llvm-svn: 120585
2010-12-01 19:02:26 +00:00
Jason W Kim
4d960e071c ARM/MC/ELF relocation "hello world" for movw/movt.
Lifted adjustFixupValue() from Darwin for sharing w ELF.
Test added
TODO:
  refactor ELFObjectWriter::RecordRelocation more.
  Possibly share more code with Darwin?
  Lots more relocations...

llvm-svn: 120534
2010-12-01 02:40:06 +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
1a81f03f87 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
97690e2d7d 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
Jason W Kim
287d5fb10b Fixed some style issues (no _, no spc after !)
llvm-svn: 119986
2010-11-22 22:05:16 +00:00
Jason W Kim
0941164ddb Make the <ARCH>ELFObjectWriter statics private
llvm-svn: 119982
2010-11-22 18:57:00 +00:00
Jason W Kim
243d3f5d8c Fix misplaced statics.
llvm-svn: 119981
2010-11-22 18:47:05 +00:00
Jason W Kim
dea9f17ab2 Kill trailing whitespace
llvm-svn: 119979
2010-11-22 18:42:07 +00:00
Jason W Kim
e2fece2f4c 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
Wesley Peck
e25f241e37 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
ee6aea622f Handle PCRel relocations with absolute values. Fixes PR8656.
llvm-svn: 119917
2010-11-21 00:48:25 +00:00
Rafael Espindola
47e7ef8c8f 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
8ee77c5320 Fix compiler warnigns.
llvm-svn: 119175
2010-11-15 19:20:50 +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
Jason W Kim
8dc24d5066 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
5572cb1aed 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
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
55e673b1c2 Simplify getSymbolIndexInSymbolTable by setting the actual index of
the symbols.

llvm-svn: 119022
2010-11-14 03:12:24 +00:00
Daniel Dunbar
2ba9f79194 MC: Simplify Mach-O and ELF object writer implementations.
- What was I thinking?????

llvm-svn: 118992
2010-11-13 07:33:40 +00:00
Benjamin Kramer
b4c0c4211e 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
8555d32c9e Initial comdat implementation.
llvm-svn: 118805
2010-11-11 18:13:52 +00:00
Rafael Espindola
f7b3bb84e8 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
f1ee36c3a3 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
5766346831 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
Rafael Espindola
6ee5a9491d Factor some code into WriteSection.
llvm-svn: 118733
2010-11-10 23:36:59 +00:00
Rafael Espindola
281431a034 Update the section index map after we add the medatada sections.
llvm-svn: 118728
2010-11-10 22:34:07 +00:00
Rafael Espindola
576f8dd869 Use SectionIndexMap in WriteSymbolTable to make it a little less brittle.
llvm-svn: 118725
2010-11-10 22:16:43 +00:00
Rafael Espindola
d3696f41c7 Factor some code into ComputeIndexMap.
llvm-svn: 118722
2010-11-10 21:51:05 +00:00
Rafael Espindola
859cfe5bbd Change the String<size> methods to take a fragment instead of a buffer.
llvm-svn: 118709
2010-11-10 20:02:59 +00:00
Rafael Espindola
d05bf9ffe0 Use MCSectionELF in places we know we have an ELF section.
llvm-svn: 118699
2010-11-10 19:05:07 +00:00
Rafael Espindola
3c0f11a265 Fixed version of 118639 with an extra assert to catch similar problems
earlier. Implicit bool -> int conversions are evil!

llvm-svn: 118651
2010-11-09 23:42:07 +00:00
Rafael Espindola
a16ec0145e Revert previous patch. Missed a case.
llvm-svn: 118645
2010-11-09 22:54:38 +00:00
Rafael Espindola
5e39a6d951 Remove IsExplicit. It was always false.
llvm-svn: 118639
2010-11-09 22:37:44 +00:00
Rafael Espindola
7a38cb0144 Implement .weakref.
llvm-svn: 117911
2010-11-01 14:28:48 +00:00
Rafael Espindola
660b7f5c4a Add support for files with more than 65280 sections. No testcase since
it would be a bit too big :-)

llvm-svn: 117849
2010-10-31 00:16:26 +00:00
Rafael Espindola
0d9ac34ffa Be more strict on when we produce an undefined reference. In gas a file with
just

.type   foo,@object

will produce an undefined reference to foo. On the other hand, a file with
just

.weakref bar, foo

will not. It is somewhat hard to support both in MC since both statements
should create the symbols. It should be possible if we really need to by
adding to the flags, but hopefully that is not necessary.

With this patch we do not produce a undefined reference in any of those cases.
The assembly file needs an actual use for the undefined reference to be
present.

This is in preparation for a patch implementing .weakref.

llvm-svn: 117735
2010-10-29 23:09:31 +00:00
Rafael Espindola
f230319275 Defined weak symbols should have non-zero value.
llvm-svn: 117585
2010-10-28 19:39:57 +00:00
Rafael Espindola
862d688cbd Fix relocations with renamed symbols.
llvm-svn: 117575
2010-10-28 19:08:03 +00:00
Rafael Espindola
e62cf892ae Aliases defined with .symver should copy the binding of the symbols they alias.
Move the existing patching for undefined symbols so that all the patching
is done in the same function.

llvm-svn: 117570
2010-10-28 18:33:03 +00:00
Rafael Espindola
ff7e4e4e43 Implement R_X86_64_DTPOFF32.
llvm-svn: 117548
2010-10-28 15:11:03 +00:00
Rafael Espindola
1d1ff5485c Implement TLSLD.
llvm-svn: 117547
2010-10-28 15:02:40 +00:00
Rafael Espindola
8372247e83 Implement DTPOFF.
llvm-svn: 117546
2010-10-28 14:48:59 +00:00
Rafael Espindola
c44c5b374a Implement TLSLDM.
llvm-svn: 117544
2010-10-28 14:37:09 +00:00
Rafael Espindola
d8ef67f8b9 Implement VK_GOTNTPOFF and switch RelocNeedsGOT to use VariantKind.
llvm-svn: 117543
2010-10-28 14:22:44 +00:00
Rafael Espindola
68ec803155 Add support for R_386_TLS_GD, R_386_TLS_LE_32, R_386_TLS_IE and R_386_TLS_LE.
llvm-svn: 117494
2010-10-27 21:23:52 +00:00
Rafael Espindola
2ea1239070 Implement R_X86_64_GOTTPOFF, R_X86_64_TLSGD and R_X86_64_TPOFF32.
llvm-svn: 117481
2010-10-27 20:28:07 +00:00
Benjamin Kramer
a79201f572 Replace pointer arithmetic with StringRef::substr.
llvm-svn: 117477
2010-10-27 19:53:52 +00:00
Rafael Espindola
ca302c994a Produce an error for an invalid use of .symver.
llvm-svn: 117462
2010-10-27 17:56:18 +00:00
Rafael Espindola
58a0ea80a4 Symbols defined as the difference of other two end up in the ABS section.
llvm-svn: 117451
2010-10-27 16:04:30 +00:00
Rafael Espindola
23d05a8675 Add support for the .symver directive. This is really ugly, but most of it is
contained in the ELF object writer.

llvm-svn: 117448
2010-10-27 15:18:17 +00:00
Rafael Espindola
f5b4013598 Move more logic to isInSymtab and simplify.
llvm-svn: 117447
2010-10-27 14:44:52 +00:00
Rafael Espindola
5748458e7d Add support for emitting ARM file attributes.
llvm-svn: 117275
2010-10-25 17:50:35 +00:00
Rafael Espindola
c6e7790c4b Add X86::reloc_global_offset_table and use it to have a single place where
we check for _GLOBAL_OFFSET_TABLE_.

llvm-svn: 117241
2010-10-24 17:35:42 +00:00
Wesley Peck
488027efa3 Making the e_machine configurable by the target backend in ELFObjectWriter.
llvm-svn: 117099
2010-10-22 15:52:49 +00:00
Rafael Espindola
5f43aeb079 Small cleanups and fixes in preparation for fixing _GLOBAL_OFFSET_TABLE_.
llvm-svn: 116848
2010-10-19 19:31:37 +00:00
Rafael Espindola
9a98116bb7 Implement R_386_GOT32.
llvm-svn: 116744
2010-10-18 20:47:21 +00:00
Rafael Espindola
c75defe576 Relocate with .bss instead of using the symbol. Matches gas behavior.
llvm-svn: 116741
2010-10-18 20:25:33 +00:00
Rafael Espindola
6504490709 Reenable assert.
llvm-svn: 116738
2010-10-18 19:33:01 +00:00
Rafael Espindola
7cc236c87f Produce ELF::R_386_GOTPC relocations.
llvm-svn: 116728
2010-10-18 18:36:12 +00:00
Rafael Espindola
d74116b1e8 Make the bots happy.
llvm-svn: 116719
2010-10-18 18:03:28 +00:00
Rafael Espindola
bf9107e924 Produce a R_386_PLT32 when needed. Moved the default cases of switches to the
start for consistency.

llvm-svn: 116715
2010-10-18 16:58:03 +00:00
Rafael Espindola
4a7459403a Handle GOTOFF correctly on i386.
llvm-svn: 116711
2010-10-18 16:38:04 +00:00
Benjamin Kramer
e8c2e82a84 Fix a typo and silence unused variable warnings in -Asserts build.
llvm-svn: 116685
2010-10-17 07:38:40 +00:00
Rafael Espindola
be5c52d2dc Add a MCObjectFormat class so that code common to all targets that use a
single object format can be shared.

This also adds support for

mov zed+(bar-foo), %eax

on ELF and COFF targets.

llvm-svn: 116675
2010-10-16 18:23:53 +00:00
Rafael Espindola
125360f835 Refactor alias handling to AliasedSymbol.
llvm-svn: 116600
2010-10-15 18:25:33 +00:00
Rafael Espindola
9b114d966a Refactor code a bit and avoid creating unnecessary entries in the string
map.

llvm-svn: 116579
2010-10-15 15:39:06 +00:00
Rafael Espindola
2cdc3d6235 Remove some code duplication.
llvm-svn: 116484
2010-10-14 16:34:44 +00:00
Rafael Espindola
d0417ac2e1 Another case of 256 sections not being enough :-)
llvm-svn: 115858
2010-10-06 22:28:19 +00:00
Rafael Espindola
ed469a30f0 Get binding and visibility info from the the alias, but Type from the symbol
being aliased.

llvm-svn: 115836
2010-10-06 21:02:29 +00:00
Rafael Espindola
6283a4a478 If a symbol is global, reloc against it even if it is in a mergeable section.
llvm-svn: 115817
2010-10-06 19:27:21 +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
0c327e6e77 Correctly handle GOTPCREL relocations.
llvm-svn: 115793
2010-10-06 16:23:36 +00:00
Rafael Espindola
8c7f9745de Use a relocation against the symbol if it is a PLT and the symbol is in another
section. Common because of linkonce sections.

llvm-svn: 115718
2010-10-05 23:57:26 +00:00
Rafael Espindola
e2bc98a2b2 Implement more alias cases.
llvm-svn: 115699
2010-10-05 22:26:43 +00:00
Rafael Espindola
d82f0f7aac 256 sections should be enough for anyone...
llvm-svn: 115687
2010-10-05 21:20:07 +00:00
Rafael Espindola
5762077d52 Don't crash in a strange .size directive.
llvm-svn: 115684
2010-10-05 21:02:45 +00:00
Rafael Espindola
f850cfbc16 Implement a simple alias case and refactor the code a bit so that the
isInSymtab and isLocal logic in the two loops don't get easily out of sync.

llvm-svn: 115643
2010-10-05 18:01:23 +00:00
Rafael Espindola
e829a55e8e Produce a undefined reference to _GLOBAL_OFFSET_TABLE_ when needed.
llvm-svn: 115623
2010-10-05 15:48:37 +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
Rafael Espindola
dcac047c7f Implement ELF::R_X86_64_GOTPCREL.
llvm-svn: 115547
2010-10-04 19:51:39 +00:00
Rafael Espindola
6b80b08cec Move isFixupKindX86PCRel.
llvm-svn: 115545
2010-10-04 19:46:28 +00:00
Rafael Espindola
f7e642c0da Produce a R_X86_64_PLT32 when needed.
llvm-svn: 115541
2010-10-04 19:04:13 +00:00
Rafael Espindola
08361a0329 Produce a R_X86_64_GOT32 when needed.
llvm-svn: 115537
2010-10-04 18:44:25 +00:00
Rafael Espindola
491c3f9ef7 Include the section address in the computation of the relocation.
llvm-svn: 115509
2010-10-04 15:59:01 +00:00
Rafael Espindola
ce6ea76503 Correctly compute the relocation when it is not in the first fragment.
llvm-svn: 115506
2010-10-04 15:28:43 +00:00
Rafael Espindola
e209fd8ab7 Implement a very basic PIC case.
llvm-svn: 115454
2010-10-03 00:46:57 +00:00
Rafael Espindola
5aae0d6863 Factor some logic into ShouldRelocOnSymbol. This simplifies the code and
fixes some cases where we were producing relocations with at symbol that
should use a section instead.

llvm-svn: 115194
2010-09-30 20:18:35 +00:00
Rafael Espindola
480ee577ad 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.

llvm-svn: 115134
2010-09-30 03:11:42 +00:00
Rafael Espindola
3e2630deca 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.

llvm-svn: 115131
2010-09-30 02:22:20 +00:00
Rafael Espindola
c604f87ba4 On elf, undefined symbols can start with .L.
llvm-svn: 114958
2010-09-28 16:19:11 +00:00
Rafael Espindola
c4d0ee0b96 Write relocations in the end of the file. This matches what gas does and
makes files easier to diff.

llvm-svn: 114898
2010-09-27 22:04:54 +00:00
Rafael Espindola
f987d204d5 Factor symbol value computation into a function.
llvm-svn: 114891
2010-09-27 21:23:02 +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
b70ab59ca8 Reapply 114678 and 114667. Reverting them did not fix the bot:
http://google1.osuosl.org:8011/builders/llvm-gcc-i386-linux-selfhost/builds/69

llvm-svn: 114761
2010-09-24 21:19:03 +00:00
Rafael Espindola
909ffec6eb Revert 114678 and 114667 to see if
http://google1.osuosl.org:8011/builders/llvm-gcc-i386-linux-selfhost

gets happy.

llvm-svn: 114742
2010-09-24 18:48:08 +00:00
Rafael Espindola
4b0d25a0db Correctly handle weak undefined symbols. Before we would get a invalid binding
(2 == STB_WEAK | STB_GLOBAL).

llvm-svn: 114690
2010-09-23 19:55:14 +00:00
Rafael Espindola
44da043992 Correctly compute the offset of the symbol. Forgot these bits from the
last commit.

llvm-svn: 114678
2010-09-23 18:01:31 +00:00
Rafael Espindola
ce04ba0f70 Represent relocations against local symbols as relocations against the section
they are in. Both ways should be equivalent, but gas produces relocations
against the section.

Roman wrote the patch, I added the test.

llvm-svn: 114667
2010-09-23 17:25:18 +00:00
Rafael Espindola
4f8e36e163 Fix the FIXME.
llvm-svn: 114639
2010-09-23 14:14:56 +00:00
Rafael Espindola
ef6cf9dce9 Fix typo and add a FIXME.
llvm-svn: 114570
2010-09-22 19:04:41 +00:00
Rafael Espindola
93f3fb8aca Revert unrelated change that was accidentally included in the previous commit.
llvm-svn: 114383
2010-09-21 00:40:19 +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
78fc1f7f66 Produce a R_X86_64_32 when the value is >=0.
llvm-svn: 114339
2010-09-20 19:20:47 +00:00
Rafael Espindola
9c3a9bf8aa Make sure the STT_FILE symbol is the first one in the symbol table.
llvm-svn: 114285
2010-09-18 15:03:21 +00:00
Rafael Espindola
acd5bacfb9 Avoid relocations in a common case.
llvm-svn: 114229
2010-09-17 22:34:41 +00:00
Rafael Espindola
d542892fc0 Print the address of sections as 0 and create the metadata sections in the
same order as gnu as.

llvm-svn: 114109
2010-09-16 19:46:31 +00:00
Benjamin Kramer
7ca791ef4f MCELF: Write relocation fragments in the right endian.
- This code is gross, but does the job for now.

llvm-svn: 113509
2010-09-09 18:01:29 +00:00
Roman Divacky
536c4ab8bd Make ELF OS ABI dependent on the OS from target triple.
llvm-svn: 113508
2010-09-09 17:57:50 +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
Roman Divacky
d56d1cd938 Unresolved weak symbols have value equal zero.
llvm-svn: 113358
2010-09-08 14:29:45 +00:00
Benjamin Kramer
2447226e73 MCELF: Align symtab, relocation sections and section headers properly. Patch by Krister Wombell.
llvm-svn: 113155
2010-09-06 16:11:52 +00:00
Benjamin Kramer
3f8b8c1f5b Allow creation of SHT_NULL sections, from Roman Divacky.
llvm-svn: 112605
2010-08-31 17:03:33 +00:00
Benjamin Kramer
6c5076f317 MCELF: The value of all common symbols is the offset from the start of the section. Patch by Roman Divacky.
llvm-svn: 112492
2010-08-30 17:20:17 +00:00
Benjamin Kramer
b540b09a7c The value is offset from the start of the section for non-common symbols, submitted by Jordan Gordeev.
llvm-svn: 112473
2010-08-30 12:00:16 +00:00
Benjamin Kramer
ca65cc9222 Index external symbols by symbol table instead of parent section, by Roman Divacky.
llvm-svn: 112472
2010-08-30 11:59:29 +00:00
Chris Lattner
b2dbdbc795 squish dead code.
llvm-svn: 112350
2010-08-28 03:21:03 +00:00
Benjamin Kramer
4e04c2e69f MCELF: Always overwrite FixedValue.
llvm-svn: 112259
2010-08-27 10:38:39 +00:00
Benjamin Kramer
537450a5e8 MCELF: Fix a thinko of mine.
llvm-svn: 112203
2010-08-26 18:12:04 +00:00
Benjamin Kramer
a1f93ec939 MCELF: Compensate for the addend on i386. Patch by Roman Divacky, with some cleanups.
llvm-svn: 112197
2010-08-26 17:23:02 +00:00
Benjamin Kramer
ebee78319c MCELF: Use precomputed symbol indices, patch by Roman Divacky.
llvm-svn: 112079
2010-08-25 20:09:43 +00:00
Benjamin Kramer
958ba693b5 Relocate against parent if the symbol is not in section or it's a common symbol, from Roman Divacky.
llvm-svn: 111925
2010-08-24 17:34:39 +00:00
Benjamin Kramer
b08a868783 Fix thinko. Having no tests is great ...
llvm-svn: 111848
2010-08-23 21:32:00 +00:00
Benjamin Kramer
005c0b532e Reduce code duplication.
llvm-svn: 111846
2010-08-23 21:23:52 +00:00
Benjamin Kramer
8961d86d95 ELFObjectWriter: Run ComputeSymbolTable before recording relocations. This way we can use the information it has computed and don't have to recompute the same stuff over and over again.
llvm-svn: 111844
2010-08-23 21:19:37 +00:00
Benjamin Kramer
be1f37f512 Add the symbol offset to the relocation value when we relocate against section. By Roman Divacky.
llvm-svn: 111824
2010-08-23 19:05:46 +00:00
Benjamin Kramer
c67b87ec44 Use the proper relocation section + cleanup, from Roman Divacky.
llvm-svn: 111819
2010-08-23 18:24:20 +00:00
Benjamin Kramer
574b1a27b1 MCELF: Count the section orders properly. Patch by Roman Divacky.
llvm-svn: 111517
2010-08-19 13:44:49 +00:00
Benjamin Kramer
5756afebba Remove dead code. Fixes a GCC warning.
llvm-svn: 111271
2010-08-17 19:45:05 +00:00
Benjamin Kramer
1e37b165c8 Sketch i386 relocations handling, from Roman Divacky.
Hello world builds & runs now on i386/ELF with -integrated-as.

llvm-svn: 111264
2010-08-17 18:20:28 +00:00
Benjamin Kramer
3bc7de0605 Use the correct entry size for relocation entries, from Roman Divacky.
llvm-svn: 111259
2010-08-17 17:56:13 +00:00
Benjamin Kramer
cc741eccfa Differentiate between RELA and REL relocations, from Roman Divacky.
llvm-svn: 111252
2010-08-17 17:30:07 +00:00
Benjamin Kramer
2bf444b7d4 One baby step towards i386 ELF, from Roman Divacky.
llvm-svn: 111247
2010-08-17 17:02:29 +00:00
Benjamin Kramer
3acf387e2d Try to silence a overeager GCC warning.
llvm-svn: 111214
2010-08-17 00:33:24 +00:00
Benjamin Kramer
41deb334b5 A round of minor cleanups for ELFObjectWriter.
llvm-svn: 111213
2010-08-17 00:00:46 +00:00
Benjamin Kramer
70e0faed21 Silence warnings and simplify code. Eliminate a 32/64 bit portability issue.
llvm-svn: 111201
2010-08-16 23:00:12 +00:00
Eli Friedman
39484fda25 Fixes for generation of ELF relocations. Patch by Roman Divacky.
llvm-svn: 111183
2010-08-16 21:17:09 +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