Commit Graph

119 Commits

Author SHA1 Message Date
Benjamin Kramer dcc7732f88 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 a3e9a2298d Initial comdat implementation.
llvm-svn: 118805
2010-11-11 18:13:52 +00:00
Rafael Espindola fb6540c112 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 fa7b55754c 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 19fa38000a 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 5a8d781caa Factor some code into WriteSection.
llvm-svn: 118733
2010-11-10 23:36:59 +00:00
Rafael Espindola eb97f59753 Update the section index map after we add the medatada sections.
llvm-svn: 118728
2010-11-10 22:34:07 +00:00
Rafael Espindola 1801410fa8 Use SectionIndexMap in WriteSymbolTable to make it a little less brittle.
llvm-svn: 118725
2010-11-10 22:16:43 +00:00
Rafael Espindola d634003ebd Factor some code into ComputeIndexMap.
llvm-svn: 118722
2010-11-10 21:51:05 +00:00
Rafael Espindola 51d68339a2 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 36ef57d2eb Use MCSectionELF in places we know we have an ELF section.
llvm-svn: 118699
2010-11-10 19:05:07 +00:00
Rafael Espindola 9bb44a5ce8 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 33048f069f Revert previous patch. Missed a case.
llvm-svn: 118645
2010-11-09 22:54:38 +00:00
Rafael Espindola 4bdd2724e3 Remove IsExplicit. It was always false.
llvm-svn: 118639
2010-11-09 22:37:44 +00:00
Rafael Espindola 1614597873 Implement .weakref.
llvm-svn: 117911
2010-11-01 14:28:48 +00:00
Rafael Espindola 3fe87a1eed 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 45834a0065 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 3c5a54e4b9 Defined weak symbols should have non-zero value.
llvm-svn: 117585
2010-10-28 19:39:57 +00:00
Rafael Espindola 29f70afbae Fix relocations with renamed symbols.
llvm-svn: 117575
2010-10-28 19:08:03 +00:00
Rafael Espindola 6cd76e63f8 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 936ba3af28 Implement R_X86_64_DTPOFF32.
llvm-svn: 117548
2010-10-28 15:11:03 +00:00
Rafael Espindola 2dbec3f762 Implement TLSLD.
llvm-svn: 117547
2010-10-28 15:02:40 +00:00
Rafael Espindola e8f08be11c Implement DTPOFF.
llvm-svn: 117546
2010-10-28 14:48:59 +00:00
Rafael Espindola 6f23eb380d Implement TLSLDM.
llvm-svn: 117544
2010-10-28 14:37:09 +00:00
Rafael Espindola b3b49bbc39 Implement VK_GOTNTPOFF and switch RelocNeedsGOT to use VariantKind.
llvm-svn: 117543
2010-10-28 14:22:44 +00:00
Rafael Espindola f8537165bd 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 24c8b04d5f 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 14807270be Replace pointer arithmetic with StringRef::substr.
llvm-svn: 117477
2010-10-27 19:53:52 +00:00
Rafael Espindola 26496e6835 Produce an error for an invalid use of .symver.
llvm-svn: 117462
2010-10-27 17:56:18 +00:00
Rafael Espindola cc1b168ef6 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 eb0c2c170d 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 a5efd6a27c Move more logic to isInSymtab and simplify.
llvm-svn: 117447
2010-10-27 14:44:52 +00:00
Rafael Espindola 0ed1543d4e Add support for emitting ARM file attributes.
llvm-svn: 117275
2010-10-25 17:50:35 +00:00
Rafael Espindola 800fd3533c 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 1851090515 Making the e_machine configurable by the target backend in ELFObjectWriter.
llvm-svn: 117099
2010-10-22 15:52:49 +00:00
Rafael Espindola ee8d15157a Small cleanups and fixes in preparation for fixing _GLOBAL_OFFSET_TABLE_.
llvm-svn: 116848
2010-10-19 19:31:37 +00:00
Rafael Espindola fba9f74932 Implement R_386_GOT32.
llvm-svn: 116744
2010-10-18 20:47:21 +00:00
Rafael Espindola 0a5314fdb3 Relocate with .bss instead of using the symbol. Matches gas behavior.
llvm-svn: 116741
2010-10-18 20:25:33 +00:00
Rafael Espindola 3604d4441a Reenable assert.
llvm-svn: 116738
2010-10-18 19:33:01 +00:00
Rafael Espindola e3dc9e2ea1 Produce ELF::R_386_GOTPC relocations.
llvm-svn: 116728
2010-10-18 18:36:12 +00:00
Rafael Espindola 257374bb0f Make the bots happy.
llvm-svn: 116719
2010-10-18 18:03:28 +00:00
Rafael Espindola 3521f8467d 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 4464e0858f Handle GOTOFF correctly on i386.
llvm-svn: 116711
2010-10-18 16:38:04 +00:00
Benjamin Kramer 77414757f6 Fix a typo and silence unused variable warnings in -Asserts build.
llvm-svn: 116685
2010-10-17 07:38:40 +00:00
Rafael Espindola 4262a22225 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 84378f0f53 Refactor alias handling to AliasedSymbol.
llvm-svn: 116600
2010-10-15 18:25:33 +00:00
Rafael Espindola fbcf0db7ee 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 bee6e9f8e0 Remove some code duplication.
llvm-svn: 116484
2010-10-14 16:34:44 +00:00
Rafael Espindola 883936ce0b Another case of 256 sections not being enough :-)
llvm-svn: 115858
2010-10-06 22:28:19 +00:00
Rafael Espindola 5f2d6a5cd9 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