Rafael Espindola
073ee7d0a8
Fix comment.
...
llvm-svn: 162678
2012-08-27 16:04:24 +00:00
Jack Carter
8ad0c272af
The ELF relocation record format is different for N64
...
which many Mips 64 ABIs use than for O64 which many
if not all other target ABIs use.
Most architectures have the following 64 bit relocation record format:
typedef struct
{
Elf64_Addr r_offset; /* Address of reference */
Elf64_Xword r_info; /* Symbol index and type of relocation */
} Elf64_Rel;
typedef struct
{
Elf64_Addr r_offset;
Elf64_Xword r_info;
Elf64_Sxword r_addend;
} Elf64_Rela;
Whereas N64 has the following format:
typedef struct
{
Elf64_Addr r_offset;/* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym; /* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
} Elf64_Rel;
typedef struct
{
Elf64_Addr r_offset;/* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym; /* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
Elf64_Sxword r_addend;
} Elf64_Rela;
The structure is the same size, but the r_info data element
is now 5 separate elements. Besides the content aspects,
endian byte reordering will be different for the area with
each element being endianized separately.
I treat this as generic and continue to pass r_type as
an integer masking and unmasking the byte sized N64
values for N64 mode. I've implemented this and it causes no
affect on other current targets.
This passes make check.
Jack
llvm-svn: 159299
2012-06-27 22:28:30 +00:00
Jim Grosbach
dc1e36e9f5
Tidy up. Trailing whitespace.
...
llvm-svn: 156602
2012-05-11 01:41:30 +00:00
Craig Topper
6e80c28017
Prune some includes and forward declarations.
...
llvm-svn: 153429
2012-03-26 06:58:25 +00:00
Akira Hatanaka
64ad2cf1e4
Add a hook in MCELFObjectTargetWriter to allow targets to sort relocation
...
entries in the relocation table before they are written out to the file.
llvm-svn: 153345
2012-03-23 23:06:45 +00:00
Benjamin Kramer
084b9f4134
Remove a bunch of unused variable assignments.
...
Found by the clang static analyzer.
llvm-svn: 148541
2012-01-20 14:42:32 +00:00
Rafael Espindola
29abd977de
Kill the monstrosity that was ELFObjectWriter.h.
...
llvm-svn: 147136
2011-12-22 03:38:00 +00:00
Rafael Espindola
34a68afc05
Misc cleanups.
...
llvm-svn: 147135
2011-12-22 03:24:43 +00:00
Rafael Espindola
1dc45d8df4
Move the Mips only bits of the ELF writer to lib/Target/Mips.
...
llvm-svn: 147133
2011-12-22 03:03:17 +00:00
Rafael Espindola
cc369ac0a2
Move the MBlaze ELF writer bits to lib/Target/MBlaze.
...
llvm-svn: 147129
2011-12-22 02:28:24 +00:00
Rafael Espindola
38a400df3b
Move PPC bits to lib/Target/PowerPC.
...
llvm-svn: 147124
2011-12-22 01:57:09 +00:00
Akira Hatanaka
e2eed9649e
Local dynamic TLS model for direct object output. Create the correct TLS MIPS
...
ELF relocations.
Patch by Jack Carter.
llvm-svn: 147118
2011-12-22 01:05:17 +00:00
Rafael Espindola
a0124055b1
Move the ARM specific parts of the ELF writer to Target/ARM.
...
llvm-svn: 147115
2011-12-22 00:37:50 +00:00
Rafael Espindola
6faa1533fb
getEFlags is const.
...
llvm-svn: 147114
2011-12-22 00:21:50 +00:00
Rafael Espindola
f61ff34252
Switch from WriteEFlags to getEFlags in preparation for moving it
...
to Target/.
llvm-svn: 147087
2011-12-21 20:09:46 +00:00
Rafael Espindola
b264d33854
Move the X86 specific bits of the ELF writer to the Target/X86 directory.
...
Other targets will follow shortly.
llvm-svn: 147060
2011-12-21 17:30:17 +00:00
Rafael Espindola
1ad4095d6b
Reduce the exposure of Triple::OSType in the ELF object writer. This will
...
avoid including ADT/Triple.h in many places when the target specific bits are
moved.
llvm-svn: 147059
2011-12-21 17:00:36 +00:00
Rafael Espindola
9e252bf038
Small refactoring so that RelocNeedsGOT can stay in the target independent
...
side when the target specific bits are moved to the Target directory.
llvm-svn: 147053
2011-12-21 14:26:29 +00:00
Akira Hatanaka
e41963ce47
Relocation against a symbol, instead of against section. We had some extreme
...
test cases where there were a lot of relocations applied relative to a large
rodata section. Gas would create a symbol for each of these whereas we would
be relative to the beginning of the rodata section. This change mimics what
gas does.
Patch by Jack Carter.
llvm-svn: 146468
2011-12-13 02:27:40 +00:00
Rafael Espindola
7e0a793183
Handle reloc_signed_4byte in here. Not doing so was a regression from my
...
previous commit. It is strange that we see it in 32 bits. We already
have a fixme about it.
llvm-svn: 146273
2011-12-09 19:57:29 +00:00
Rafael Espindola
0a7f336475
Handle the case of the magical _GLOBAL_OFFSET_TABLE_ showing up in a
...
symbol difference. This matches gas behavior and fixes PR11513.
We still don't handle _GLOBAL_OFFSET_TABLE_ in data sections.
llvm-svn: 146238
2011-12-09 03:03:58 +00:00
Bruno Cardoso Lopes
61e6d987bf
Add a few moreLocal/Global R_MIPS_GOT related fixups and
...
make the addend fixup code a bit more generic
Patch by Jack Carter.
llvm-svn: 145998
2011-12-07 00:28:57 +00:00
Bruno Cardoso Lopes
87cfffe149
Explicit symbols for gnu mimicing relocations. Patch by Jack Carter
...
llvm-svn: 145911
2011-12-06 03:34:42 +00:00
Jim Grosbach
46be301c4c
Tidy up. Hard tabs.
...
llvm-svn: 145878
2011-12-06 00:13:09 +00:00
Jim Grosbach
18e2fe47fa
Switch MCAssembler to method names starting w/ lower-case.
...
per http://llvm.org/docs/CodingStandards.html#ll_naming
llvm-svn: 145873
2011-12-06 00:03:48 +00:00
Akira Hatanaka
f5ddf13f79
This patch addresses gp relative fixups/relocations for jump tables.
...
llvm-svn: 145112
2011-11-23 22:18:04 +00:00
Jim Grosbach
0dde349df1
Tidy up. 80 columns.
...
llvm-svn: 144649
2011-11-15 16:46:22 +00:00
Bruno Cardoso Lopes
c9473e9809
Add mips ELF relocation types. Patch by Jack Carter!
...
llvm-svn: 143738
2011-11-04 22:24:36 +00:00
Nick Lewycky
29e7b315ac
Also create a shndx even if there are no symbols. This lets us test
...
.symtab_shndx reading and writing together, and finally we have a testcase for
r141440.
llvm-svn: 141641
2011-10-11 03:54:50 +00:00
Nick Lewycky
133a16871f
Don't emit the symbol table entry for the .symtab_shndx section either.
...
llvm-svn: 141440
2011-10-07 23:29:53 +00:00
Nick Lewycky
c6ac5f7388
Remove extraneous curlies. No functionality change.
...
llvm-svn: 141439
2011-10-07 23:28:32 +00:00
Nick Lewycky
8b02d36a23
Don't emit a shstrtabindex in the reserved range. Spotted by inspection and
...
patch by Cary Coutant!
llvm-svn: 141413
2011-10-07 20:58:24 +00:00
Nick Lewycky
4eb1143038
Clarify/fix typo. No functionality change.
...
llvm-svn: 141412
2011-10-07 20:56:23 +00:00
Akira Hatanaka
e67a10d54d
Add definition of MipsELFObjectWriter.
...
Patch by Reed Kotler at Mips Technologies.
llvm-svn: 140891
2011-09-30 21:55:40 +00:00
Roman Divacky
dfbecd1eb7
Introduce adjustFixupOffset that adjusts the fixup offset of a relocation.
...
This is meant to be overriden by backends. Implement an override on PowerPC
which adjusts the offset by 2 for ha16/lo16 relocation kinds. This removes
a commented out hack and enables hello world to be compiled on PowerPC.
llvm-svn: 136905
2011-08-04 19:08:19 +00:00
Rafael Espindola
d7facaf371
Add an assert to check that the Addend fits the file format.
...
llvm-svn: 136868
2011-08-04 13:05:26 +00:00
Jason W Kim
e4df09f7ba
Fix http://llvm.org/bugs/show_bug.cgi?id=10568
...
Move the reloc size assert into AsmBackend - where it is more apropos.
llvm-svn: 136855
2011-08-04 00:38:45 +00:00
Roman Divacky
11a044634a
Comment out the PPC relocation offset adjustment. It must be done differently.
...
This unbreaks some tests.
llvm-svn: 136692
2011-08-02 16:15:32 +00:00
Roman Divacky
038c1a1a73
Sketch out PowerPC ELF writer. This is enough to get clang -integrated-as
...
to compile a working hello world on FreeBSD/PPC32.
llvm-svn: 136689
2011-08-02 15:51:38 +00:00
Evan Cheng
5928e69d20
Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.
...
llvm-svn: 136010
2011-07-25 23:24:55 +00:00
Evan Cheng
7e763d86ba
Refactor X86 target to separate MC code from Target code.
...
llvm-svn: 135930
2011-07-25 18:43:53 +00:00
Evan Cheng
f2596bc62a
Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
...
llvm-svn: 135833
2011-07-23 00:45:41 +00:00
Evan Cheng
ad5f485957
Sink ARM mc routines into MCTargetDesc.
...
llvm-svn: 135825
2011-07-23 00:00:19 +00:00
Jason W Kim
7fbe7914af
Remove an uneeded switch - Turns out reloc results are identical w/o the switch. (face+palm)
...
llvm-svn: 132790
2011-06-09 19:13:45 +00:00
Rafael Espindola
940a0ee5ca
Produce an undefined reference to _GLOBAL_OFFSET_TABLE_ if we have a
...
VK_GOTOFF reloc. This matches as' behavior, but it is not clear why the linker
might need this, so I added a FIXME.
I could test this by duplicating test/MC/ELF/got.s, but it doesn't look
worthwhile.
llvm-svn: 132655
2011-06-05 01:20:06 +00:00
Nick Lewycky
34fa1684e7
Add support for @GOTPTOFF in i386 mode.
...
llvm-svn: 132643
2011-06-04 17:38:07 +00:00
Rafael Espindola
1866808384
fixes target address tBL and tBLX and sets relocation type
...
of tBL/tBLX to R_ARM_THM_CALL (ARM ELF 4.7.1.6)
Patch by koan-sin tan.
llvm-svn: 131748
2011-05-20 20:01:01 +00:00
Jason W Kim
94c31fdd31
Add a FIXME reminder to remove ForceARMElfPIC switch.
...
llvm-svn: 131411
2011-05-16 16:35:21 +00:00
Rafael Espindola
e90c1cb221
sets bit 0 of the function address of thumb function in .symtab
...
("T is 1 if the target symbol S has type STT_FUNC and the
symbol addresses a Thumb instruction ;it is 0 otherwise."
from "ELF for the ARM Architecture" 4.7.1.2)
Patch by Koan-Sin Tan!
llvm-svn: 131406
2011-05-16 16:17:21 +00:00
Matt Beaumont-Gay
7c6c90b35d
Remove an unused variable and move a couple others inside DEBUG.
...
llvm-svn: 131208
2011-05-11 23:34:51 +00:00