Commit Graph

43 Commits

Author SHA1 Message Date
Rafael Espindola f458f04eb1 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 6366d1b858 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 48e108753b 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 2816588eb9 Fix the FIXME.
llvm-svn: 114639
2010-09-23 14:14:56 +00:00
Rafael Espindola 0e527b7ed5 Fix typo and add a FIXME.
llvm-svn: 114570
2010-09-22 19:04:41 +00:00
Rafael Espindola 461a692c7f Revert unrelated change that was accidentally included in the previous commit.
llvm-svn: 114383
2010-09-21 00:40:19 +00:00
Rafael Espindola f0591c1642 Implement support for .local and its "interesting" interactions with .comm.
llvm-svn: 114382
2010-09-21 00:24:38 +00:00
Rafael Espindola 32ab4558fe Produce a R_X86_64_32 when the value is >=0.
llvm-svn: 114339
2010-09-20 19:20:47 +00:00
Rafael Espindola 57e599a82a 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 0ecde03e9f Avoid relocations in a common case.
llvm-svn: 114229
2010-09-17 22:34:41 +00:00
Rafael Espindola 44bf266111 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 6c3c349b2b 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 3b727f55aa Make ELF OS ABI dependent on the OS from target triple.
llvm-svn: 113508
2010-09-09 17:57:50 +00:00
Roman Divacky 2ef1a589c5 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 6c27de28b5 Unresolved weak symbols have value equal zero.
llvm-svn: 113358
2010-09-08 14:29:45 +00:00
Benjamin Kramer 3723ba1fe0 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 4226198a1d Allow creation of SHT_NULL sections, from Roman Divacky.
llvm-svn: 112605
2010-08-31 17:03:33 +00:00
Benjamin Kramer b1b493bcab 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 8199447851 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 f791b9fc56 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 95bb297c26 squish dead code.
llvm-svn: 112350
2010-08-28 03:21:03 +00:00
Benjamin Kramer 05e22982c8 MCELF: Always overwrite FixedValue.
llvm-svn: 112259
2010-08-27 10:38:39 +00:00
Benjamin Kramer 2c45f431fa MCELF: Fix a thinko of mine.
llvm-svn: 112203
2010-08-26 18:12:04 +00:00
Benjamin Kramer 929cc7618f 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 37b384cd66 MCELF: Use precomputed symbol indices, patch by Roman Divacky.
llvm-svn: 112079
2010-08-25 20:09:43 +00:00
Benjamin Kramer a536f077fe 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 d41b53c037 Fix thinko. Having no tests is great ...
llvm-svn: 111848
2010-08-23 21:32:00 +00:00
Benjamin Kramer c4809c930a Reduce code duplication.
llvm-svn: 111846
2010-08-23 21:23:52 +00:00
Benjamin Kramer 86511dce18 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 40f83489b4 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 620b68e883 Use the proper relocation section + cleanup, from Roman Divacky.
llvm-svn: 111819
2010-08-23 18:24:20 +00:00
Benjamin Kramer 448886d5df MCELF: Count the section orders properly. Patch by Roman Divacky.
llvm-svn: 111517
2010-08-19 13:44:49 +00:00
Benjamin Kramer da7604f53d Remove dead code. Fixes a GCC warning.
llvm-svn: 111271
2010-08-17 19:45:05 +00:00
Benjamin Kramer 1afba421a9 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 fd0541566b Use the correct entry size for relocation entries, from Roman Divacky.
llvm-svn: 111259
2010-08-17 17:56:13 +00:00
Benjamin Kramer 1fe76565d0 Differentiate between RELA and REL relocations, from Roman Divacky.
llvm-svn: 111252
2010-08-17 17:30:07 +00:00
Benjamin Kramer 896bd7e932 One baby step towards i386 ELF, from Roman Divacky.
llvm-svn: 111247
2010-08-17 17:02:29 +00:00
Benjamin Kramer b962ca0ce5 Try to silence a overeager GCC warning.
llvm-svn: 111214
2010-08-17 00:33:24 +00:00
Benjamin Kramer 5f237942f5 A round of minor cleanups for ELFObjectWriter.
llvm-svn: 111213
2010-08-17 00:00:46 +00:00
Benjamin Kramer be6cca2b7d 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 1fe0d53aec Fixes for generation of ELF relocations. Patch by Roman Divacky.
llvm-svn: 111183
2010-08-16 21:17:09 +00:00
Eli Friedman b20b5249d2 Fix a few warnings in and detabify MCELFStreamer and ELFObjectWriter.
llvm-svn: 111175
2010-08-16 19:15:06 +00:00
Matt Fleming 6c1ad4835e 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