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