Rafael Espindola
4ec917db9b
Revert previous two patches while I try to find out how to make both
...
linux and darwin assemblers happy :-(
llvm-svn: 121004
2010-12-06 15:35:15 +00:00
Rafael Espindola
3dc2b4cba7
Add an EmitAbsValue helper method and use it in cases where we want to be sure
...
that no relocations are used (on MochO).
Fixes llc producing different output from llc + llvm-mc.
llvm-svn: 121000
2010-12-06 14:53:14 +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
bf001eed4c
Simplify a bit.
...
llvm-svn: 120980
2010-12-06 03:36:43 +00:00
Rafael Espindola
d361a448af
Use getSymbolOffset on the COFF writer.
...
llvm-svn: 120979
2010-12-06 03:24:04 +00:00
Rafael Espindola
f56c11276e
Don't use PadSectionToAlignment on windows.
...
llvm-svn: 120978
2010-12-06 03:03:44 +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
310b851621
Once the layout is done we don't need to keep updating which fragments are
...
valid. Addresses will not change.
llvm-svn: 120921
2010-12-04 22:47:22 +00:00
Rafael Espindola
1bf8d261f1
Remember the contents of leb and dwarfline fragments when relaxing. This avoids
...
having to evaluate the expression again when writing.
llvm-svn: 120920
2010-12-04 21:58:52 +00:00
Rafael Espindola
9215947c83
There are two reasons why we might want to use
...
foo = a - b
.long foo
instead of just
.long a - b
First, on darwin9 64 bits the assembler produces the wrong result. Second,
if "a" is the end of the section all darwin assemblers (9, 10 and mc) will not
consider a - b to be a constant but will if the dummy foo is created.
Split how we handle these cases. The first one is something MC should take care
of. The second one has to be handled by the caller.
llvm-svn: 120889
2010-12-04 03:21:47 +00:00
Rafael Espindola
50b6170457
Next step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
...
doing that if the target is darwin10 or newer.
This fixes
*) Direct object emission was producing objects without the workaround on
darwin9.
*) Assembly printing was producing objects with the workaround on linux.
llvm-svn: 120866
2010-12-04 00:31:13 +00:00
Rafael Espindola
4145acdc3b
First step in fixing MC. Make it clear that we are avoiding a bug in the
...
darwin9 linker, what is needed to avoid it and where to get more information.
Also make the workaround simpler. Just the regular end_sequence we normally
create is more than 4 bytes.
Tested by building cctools and ld64 from darwin9 on a darwin10 system and using
those. I checked that I was able to reproduce the bootstrap failure when
the the workaround was disabled.
llvm-svn: 120854
2010-12-03 23:36:59 +00:00
Rafael Espindola
ec560cdae3
Make EmitIntValue more efficient and more like what we do for leb128. The
...
difference is much smaller (about 0.3s) but significant.
llvm-svn: 120787
2010-12-03 02:54:21 +00:00
Rafael Espindola
dc103b1755
Do with uleb the same trick we now do with dwarf line/address advances. This
...
avoids creating leb128 fragments and speeds up the test in PR8711 to 33s.
llvm-svn: 120774
2010-12-03 01:19:49 +00:00
Rafael Espindola
3e119b0bb4
Try to resolve symbol differences early, and if successful create a plain
...
data fragment. This reduces the time to assemble the test in 8711 from 60s to
54s.
llvm-svn: 120767
2010-12-03 00:55:40 +00:00
Devang Patel
77a1457f1a
It may not be an option to skip .debug_line if there are file reference in already emitted debug info. So, for now, emit dummy line table entry to make older linker and assemblers happy. This is not a new behavior, original AsmPrinter emitted similar line table entries.
...
llvm-svn: 120760
2010-12-03 00:10:48 +00:00
Devang Patel
822facd787
Use set directive for StartMinusEndExpr.
...
This is a fix for llvm-gcc-i386-darwin9 buildbot failure.
llvm-svn: 120742
2010-12-02 21:32:30 +00:00
Rafael Espindola
922894345e
Add a fast path to EvaluateSymbolicAdd. This avoids computing symbol addresses
...
which then avoids running EnsureValid.
This cuts the assembly time of the testcase in PR8711 from 2:50 minutes to 1
minute.
llvm-svn: 120697
2010-12-02 07:53:12 +00:00
Rafael Espindola
2dabc56340
Move EmitValueToOffset to the ObjectStreamer.
...
llvm-svn: 120691
2010-12-02 05:59:38 +00:00
Rafael Espindola
3bc5d20c38
Add EmitInstToFragment to the generic object streamer.
...
llvm-svn: 120690
2010-12-02 05:44:06 +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
Devang Patel
525de51e78
If tehre are not any line entry then do not try to emit .debug_line section.
...
llvm-svn: 120637
2010-12-02 01:17:51 +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
Rafael Espindola
c9af6aea7a
Remove unused argument.
...
llvm-svn: 120621
2010-12-01 22:48:11 +00:00
Rafael Espindola
16b64c646a
Rename temporary symbols if they conflict with artificial symbols created
...
by the assembler. This was blocking parsing any large .s produced by clang for
example.
Fixes PR8596.
llvm-svn: 120603
2010-12-01 20:46:11 +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
Michael J. Spencer
d5ec932c3a
Merge System into Support.
...
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Rafael Espindola
d5f118a011
Make EmitIntValue non virtual.
...
llvm-svn: 120271
2010-11-28 23:22:44 +00:00
Rafael Espindola
fdbf55e614
Forgot the MCPureStreamer::EmitValue in the previous commit.
...
llvm-svn: 120270
2010-11-28 23:13:47 +00:00
Rafael Espindola
4ba6ca3725
Move EmitValue to MCObjectStreamer.
...
llvm-svn: 120269
2010-11-28 23:08:47 +00:00
Rafael Espindola
53ee16b7b6
Fixed verson of r120245.
...
Factor some duplicated code into MCObjectStreamer::EmitLabel.
llvm-svn: 120248
2010-11-28 17:18:55 +00:00
Rafael Espindola
cb1e3ad6bc
Revert previous patch while I debug the darwin bootstrap failure.
...
llvm-svn: 120246
2010-11-28 16:22:59 +00:00
Rafael Espindola
975a3f8fa7
Factor some duplicated code into MCObjectStreamer::EmitLabel.
...
llvm-svn: 120245
2010-11-28 15:54:36 +00:00
Rafael Espindola
422c24b736
Avoid code duplication in the many unsupported EmitGPRel32Value implementations.
...
llvm-svn: 120243
2010-11-28 15:09:24 +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
Daniel Dunbar
2dd3ae7c9c
macho-dump: Add support for dumping relocation entries.
...
llvm-svn: 120216
2010-11-27 13:39:48 +00:00
Daniel Dunbar
a9f9d6d2db
Fix a comment.
...
llvm-svn: 120199
2010-11-27 07:39:37 +00:00
Daniel Dunbar
9b9f0a4d16
Reduce nesting.
...
llvm-svn: 120189
2010-11-27 05:18:48 +00:00
Daniel Dunbar
c686ff034f
MC/Mach-O: Migrate more constants into MachOFormat.h.
...
llvm-svn: 120188
2010-11-27 04:59:14 +00:00
Daniel Dunbar
f050a00c17
MC/Mach-O: Introduce Object/MachOFormat for describing purely platform / machine
...
independent information on the Mach object format, and move some stuff from
MachObjectWriter.cpp there.
llvm-svn: 120186
2010-11-27 04:19:38 +00:00
Rafael Espindola
0641196380
Remove the unused TheTarget member.
...
llvm-svn: 120168
2010-11-26 04:24:21 +00:00
Michael J. Spencer
b2cfb3b443
Fix Whitespace.
...
llvm-svn: 120166
2010-11-26 04:16:08 +00:00
Rafael Espindola
a8488b04e1
Factor some code to parseSectionFlags and fix the default type of a section.
...
llvm-svn: 120145
2010-11-25 15:32: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
Rafael Espindola
81ecba9559
Fix and add tests for all cases in x86 and x86_64 where gnu as implicitly
...
sets the type of a symbol to STT_TLS.
llvm-svn: 120100
2010-11-24 18:51:21 +00:00
Rafael Espindola
dc299d2615
If a symbol is used as tls, mark it as tls even if not declare as so. Probably
...
fixes PR8659.
llvm-svn: 120076
2010-11-24 02:19:40 +00:00
Rafael Espindola
af4cd15f2a
Invalidate the layout on any relaxation, not just Instructions. Bug found by David Meyer.
...
While here, remove unused argument and rename UpdateForSlide to Invalidate.
llvm-svn: 120009
2010-11-23 08:08:33 +00:00
Rafael Espindola
a660c25883
Reuse data fragments while lowering. Patch by David Meyer.
...
llvm-svn: 119999
2010-11-23 05:49:35 +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
Rafael Espindola
e20c3d7c26
Add basic CFI methods to the streamer interface.
...
llvm-svn: 119972
2010-11-22 14:27:24 +00:00
Rafael Espindola
5f582e980e
Remove some #includes.
...
llvm-svn: 119967
2010-11-22 11:53:17 +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
Kevin Enderby
214e641d8d
Added support for the Mach-O .symbol_resolver directive. rdar://8673046
...
llvm-svn: 119816
2010-11-19 18:39:33 +00:00
Rafael Espindola
7c6bd9e0f9
Add a MCLineSectionOrder vector so that we produce the line tables in a
...
deterministic order.
llvm-svn: 119795
2010-11-19 07:41:23 +00:00
Rafael Espindola
a06725942f
Add an assert.
...
llvm-svn: 119788
2010-11-19 04:55:36 +00:00
Rafael Espindola
921ef0c471
Fix llvm-gcc boostrap on OS X by avoiding printing sleb and uleb when
...
possible.
llvm-svn: 119785
2010-11-19 04:10:13 +00:00
Rafael Espindola
b33e5e07e1
Change some methods in MCDwarf.cpp to be able to handle an arbitrary
...
MCStreamer instead of just MCObjectStreamer. Address changes cannot
be as efficient as we have to use DW_LNE_set_addres, but at least
most of the logic is shared.
This will be used so that, with CodeGen still using EmitDwarfLocDirective,
llvm-gcc is able to produce debug_line sections without needing an
assembler that supports .loc.
llvm-svn: 119777
2010-11-19 02:26:16 +00:00
Rafael Espindola
93a07b464e
Change CodeGen to use .loc directives. This produces a lot more readable output
...
and testing is easier. A good example is the unknown-location.ll test that
now can just look for ".loc 1 0 0". We also don't use a DW_LNE_set_address for
every address change anymore.
llvm-svn: 119613
2010-11-18 02:04:25 +00:00
Rafael Espindola
7fc5cd0a58
make isVirtualSection a virtual method on MCSection. Chris' suggestion.
...
llvm-svn: 119547
2010-11-17 20:03:54 +00:00
Jim Grosbach
122ce7f051
Fix typo.
...
llvm-svn: 119542
2010-11-17 19:30:11 +00:00
Rafael Espindola
b6fcca35a2
Add support for .int.
...
llvm-svn: 119512
2010-11-17 16:24:40 +00:00
Rafael Espindola
9186952072
Add support for .2byte, .4byte and .8byte.
...
Fixes PR8631.
llvm-svn: 119511
2010-11-17 16:15:42 +00:00
Daniel Dunbar
1890e9a6b7
MC-JIT: Stub out "pure" streamer.
...
- No immediate use, but maybe someone feels like hacking on it.
llvm-svn: 119510
2010-11-17 16:06:47 +00:00
Rafael Espindola
283e6bd938
Add .loc methods to the streamer.
...
Next: Add support for the !HasDotLocAndDotFile case to the MCAsmStreamer
and then switch codegen to use it.
llvm-svn: 119384
2010-11-16 21:20:32 +00:00
Rafael Espindola
dc0be5a0cc
Parse and ignore some .cfi_* directives.
...
llvm-svn: 119362
2010-11-16 18:34:07 +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
f6c0121c93
Fix PR8565.
...
This moves most of the isUsed logic to the MCSymbol itself. With this we
get a bit more relaxed about allowing definitions after uses: uses that
don't evaluate their argument immediately (jmp foo) are accepted.
ddunbar, this was the smallest compromise I could think of that lets us
accept gcc (and clang!) assembly.
llvm-svn: 119144
2010-11-15 14:40:36 +00:00
Chris Lattner
3b5f2a871a
correct the fixup comment printer to work on big endian platforms.
...
llvm-svn: 119122
2010-11-15 05:56:19 +00:00
Chris Lattner
9a0a840839
add targetoperand flags for jump tables, constant pool and block address
...
nodes to indicate when ha16/lo16 modifiers should be used. This lets
us pass PowerPC/indirectbr.ll.
The one annoying thing about this patch is that the MCSymbolExpr isn't
expressive enough to represent ha16(label1-label2) which we need on
PowerPC. I have a terrible hack in the meantime, but this will have
to be revisited at some point.
Last major conversion item left is global variable references.
llvm-svn: 119105
2010-11-15 02:46:57 +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
Chris Lattner
fc626aa37d
reimplement ppc asmprinter "toc" handling to use a VariantKind
...
on the operand, required for .o file writing and fixing
the PowerPC/mult-alt-generic-powerpc64.ll failure with the new
instprinter.
llvm-svn: 119087
2010-11-14 22:22:59 +00:00
Rafael Espindola
59a93284d7
Fix another case of a .comm directive without a corresponding .type
...
directive.
llvm-svn: 119073
2010-11-14 21:11:16 +00:00
Rafael Espindola
1884e6d475
Fix the type of a symbol created with .comm and no corresponding .type.
...
llvm-svn: 119060
2010-11-14 19:40:55 +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
Rafael Espindola
1b4c835948
Fix warning.
...
llvm-svn: 119021
2010-11-14 01:34:31 +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
Rafael Espindola
d2ff64abae
Fix warning and add support for printing gnu_unique_object.
...
llvm-svn: 118981
2010-11-13 04:55:06 +00:00
Rafael Espindola
9cd0fd30e0
Parse and record the gnu_unique_object type.
...
llvm-svn: 118980
2010-11-13 04:51:02 +00:00
Rafael Espindola
00c5605efc
Parse and remember discriminators in .loc line. I try to output them with
...
another patch.
This lets us parse a bit more of the gcc 4.5 output.
llvm-svn: 118975
2010-11-13 03:18:27 +00:00
Rafael Espindola
e296fd654b
Fix the encoding of negative line deltas.
...
llvm-svn: 118962
2010-11-13 01:06:27 +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
77cad43f26
Remove what looks like dead code in the production of debug lines.
...
We only produce debug line information if we have seen a line directive, so
this code is dead. Also, if we want to be bug by bug compatible with
gas and sometimes produce "empty" .debug_line sections, this will
match the content produced by gas.
llvm-svn: 118914
2010-11-12 18:41:26 +00:00
Rafael Espindola
dc54b2b285
gnu as support both % and @ before types, do the same.
...
llvm-svn: 118893
2010-11-12 15:47:08 +00:00
Jim Grosbach
b48a272807
Trailing whitespace.
...
llvm-svn: 118831
2010-11-11 20:16:23 +00:00
Rafael Espindola
1725702868
Mark labels declared in tls sections as STT_TLS. This matches the behavior of
...
gas.
llvm-svn: 118818
2010-11-11 19:04:55 +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
Jim Grosbach
4e3653e4e1
Update ARMConstantPoolValue to not use a modifier string. Use an explicit
...
VariantKind marker to indicate the additional information necessary. Update
MC to handle the new Kinds. rdar://8647623
llvm-svn: 118671
2010-11-10 03:26: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
Daniel Dunbar
a8fb354cdf
Fix typo.
...
llvm-svn: 118421
2010-11-08 17:53:02 +00:00
Rafael Espindola
1602d991d5
Set default flags for .rodata.
...
llvm-svn: 118395
2010-11-08 02:47:59 +00:00
Rafael Espindola
296935eca3
Speed up AddSectionToTheEnd. It was walking all fragments in all sections.
...
This is really slow with we have 1000s of sections each with a corresponding
relocation section. Also, it is only used by the ELF writer to add
basic data, so there is no need to force a new layout pass.
Should fix PR8563.
llvm-svn: 118377
2010-11-07 15:03:27 +00:00
Rafael Espindola
877bb5ba4b
Relax dwarf line fragments. This fixes a crash in the included testcase.
...
llvm-svn: 118365
2010-11-07 02:07:12 +00:00
Jim Grosbach
a98b9ba916
Add '.code 32' assembler directive to MC streamers.
...
llvm-svn: 118309
2010-11-05 22:40:09 +00:00
Jim Grosbach
bbef2c5fcc
MC'ize the '.code 16' and '.thumb_func' ARM directives.
...
llvm-svn: 118301
2010-11-05 22:08:08 +00:00
Benjamin Kramer
ac2bcb05cc
Put class into an anonymous namespace.
...
llvm-svn: 118294
2010-11-05 19:56:38 +00:00
Jim Grosbach
a85416eb77
Allow targets to specify the MachO CPUType/CPUSubtype information.
...
llvm-svn: 118288
2010-11-05 18:48:58 +00:00
Jim Grosbach
e952ae2659
syntaxunified directive is a no-op for MachO writing.
...
llvm-svn: 118287
2010-11-05 18:47:32 +00:00
Rafael Espindola
3f4a79b243
Add 118023 back, but with proper spelling for .uleb128/.sleb128.
...
llvm-svn: 118254
2010-11-04 18:17:08 +00:00
Rafael Espindola
daf6328eb0
Do relaxations with FT_Org fragments. Fixes the FIXME:
...
// FIXME: We should compute this sooner, we don't want to recurse here, and
// we would like to be more functional.
In MCAssembler::ComputeFragmentSize.
llvm-svn: 118080
2010-11-02 21:38:23 +00:00
Rafael Espindola
1db6a21aff
Add support for expressions in .sleb/.uleb directives.
...
llvm-svn: 118023
2010-11-02 17:22:24 +00:00
Rafael Espindola
2f114f8430
Write the line info to .debug_line.
...
llvm-svn: 117930
2010-11-01 17:07:14 +00:00
Rafael Espindola
5571ce5ed4
Move EmitInstruction to MCObjectStreamer so that ELF and MachO can share it.
...
llvm-svn: 117925
2010-11-01 16:27:31 +00:00
Rafael Espindola
a7f92c500c
Add support for .value.
...
llvm-svn: 117922
2010-11-01 15:29:07 +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
913ce7ebc8
Improvements to .section parsing:
...
* If we have a M or a G, reject sections without the type
* Only parse the flag specific arguments if we have M or G
* Parse the corresponding arguments for M and G
We ignore the G arguments and flag for now.
llvm-svn: 117608
2010-10-28 21:33:33 +00:00
Rafael Espindola
b562975139
Add support for the .string directive.
...
llvm-svn: 117592
2010-10-28 20:02:27 +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
Roman Divacky
2aedee6ff2
Use the IDVal directly as there's no need to convert to std::string.
...
Pointed out by Chris!
llvm-svn: 117557
2010-10-28 16:57:58 +00:00
Roman Divacky
8555f153e9
Implement .equ directive as a synonym to .set.
...
llvm-svn: 117553
2010-10-28 16:22:58 +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
4db628cd34
Set default type and flags for .init and .fini.
...
llvm-svn: 117471
2010-10-27 18:45:20 +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
50d3c29c30
Add support for .ident.
...
llvm-svn: 117389
2010-10-26 19:35:47 +00:00
Daniel Dunbar
5cbb066ea3
MC/AsmParser: Fix relative precedence of {+,-} and comparison ops.
...
llvm-svn: 117299
2010-10-25 20:18:56 +00:00
Daniel Dunbar
97fa30f53b
MC/AsmLexer: Fix bug in source location for Slash token.
...
llvm-svn: 117298
2010-10-25 20:18:53 +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
Benjamin Kramer
9e988fe81e
Make some symbols static, move classes into anonymous namespaces.
...
llvm-svn: 117111
2010-10-22 17:35:07 +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
Jim Grosbach
e6d61a87e4
Trailing whitespace.
...
llvm-svn: 117073
2010-10-21 22:04:05 +00:00
Michael J. Spencer
a43c204ef7
Fix Warnings.
...
llvm-svn: 117062
2010-10-21 20:49:38 +00:00
Rafael Espindola
69c973fbfd
Do not recurse into symbol refs that have a variant kind. This prevents us
...
from losing the variant when producing a relocation on an alias.
llvm-svn: 117037
2010-10-21 18:00:20 +00:00
Chandler Carruth
55850cad48
Remove remaining uses of ATTRIBUTE_UNUSED on variables, and delete three
...
#includes in the process.
llvm-svn: 116919
2010-10-20 08:27:02 +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
Bill Wendling
f937f0ed59
Fix spelling.
...
llvm-svn: 116804
2010-10-19 10:18:23 +00:00
Chandler Carruth
755dd8000d
Move the definition of this to the source file to anchor the vtable.
...
llvm-svn: 116779
2010-10-19 00:37:30 +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
Michael J. Spencer
f9a7c39ecc
MC-COFF: Add support for default-null weak externals.
...
llvm-svn: 116666
2010-10-16 08:25:57 +00:00
Daniel Dunbar
fedc37ce15
MC/AsmParser: Report .stabs directive as unsupported.
...
llvm-svn: 116659
2010-10-16 04:56:42 +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
Michael J. Spencer
56d81e7eae
MC-COFF: Fix .bss section size. Fixes PR8335. Patch by NAKAMUTA Takumi!
...
llvm-svn: 116155
2010-10-09 16:04:45 +00:00
Michael J. Spencer
4dc462314c
MC-COFF: Implement InitSections. Fixes PR8335.
...
llvm-svn: 116151
2010-10-09 15:44:27 +00:00
Michael J. Spencer
9e8793d7d6
MC-COFF: Add COFFAsmParser. Completes PR8343.
...
llvm-svn: 116150
2010-10-09 11:01:07 +00:00
Michael J. Spencer
1c60bd155b
Fix Whitespace.
...
llvm-svn: 116149
2010-10-09 11:00:50 +00:00
Michael J. Spencer
3066a09189
MC-COFF: Assert on non-coff sections.
...
llvm-svn: 116148
2010-10-09 11:00:37 +00:00
Michael J. Spencer
a2f33dfddc
MC: Move ParseDirectiveELFType into ELFAsmParser. COFF uses .type for something else.
...
llvm-svn: 116142
2010-10-09 03:47:55 +00:00
Michael J. Spencer
43ccdd557d
MC-COFF: Handle relaxation in COFF better. Fixes PR8321.
...
llvm-svn: 116013
2010-10-07 23:55:40 +00:00
NAKAMURA Takumi
4568ebde72
Minor cosmetic change: fix DOSish \r\n.
...
llvm-svn: 115910
2010-10-07 07:21:04 +00:00
Michael J. Spencer
85094f7689
MC-COFF: Fix symbol aliases. Fixes PR8251.
...
llvm-svn: 115909
2010-10-07 06:29:33 +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
Michael J. Spencer
b1c4f7b52a
MC: Add missing forward in MCLoggingStreamer.
...
llvm-svn: 115830
2010-10-06 20:36:47 +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
Michael J. Spencer
079e1e2ce8
Fix Punctuation.
...
llvm-svn: 115657
2010-10-05 19:48:12 +00:00
Michael J. Spencer
19b6962abb
MC-COFF: Fix (PR8278) temporary symbol relocations.
...
llvm-svn: 115656
2010-10-05 19:48:03 +00:00
Rafael Espindola
0b536fb0fb
Add support for a fill value in the .zero directive.
...
llvm-svn: 115655
2010-10-05 19:42:57 +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