Daniel Dunbar
f15aeb8d01
MC: Remove dead MCAssembler argument -- Rafael, can you check the FIXME I added
...
here?
llvm-svn: 122012
2010-12-17 01:07:31 +00:00
Daniel Dunbar
9af1335b5d
MC: Simplify (remove unnecessary MCAssembler argument, obsoleted by containment
...
in MCAsmLayout).
llvm-svn: 122011
2010-12-17 01:07:28 +00:00
Daniel Dunbar
33d571e2ae
Write => in a more normal form.
...
llvm-svn: 122009
2010-12-17 01:07:22 +00:00
Daniel Dunbar
76793bac89
MC/Expr: Simplify (and add a FIXME).
...
llvm-svn: 122008
2010-12-17 01:07:20 +00:00
Rafael Espindola
32c74ea3ab
"Fix" FDE alignment to match what gas does.
...
llvm-svn: 122006
2010-12-17 00:28:02 +00:00
Daniel Dunbar
395a09922b
MC/Expr: Add a doxyment.
...
llvm-svn: 121988
2010-12-16 18:36:25 +00:00
Daniel Dunbar
03fcccbb47
MC/Mach-O: Lift some MachObjectWriter arguments into the target specific
...
interface.
llvm-svn: 121981
2010-12-16 17:21:02 +00:00
Daniel Dunbar
8888a9604d
MC/Mach-O: Stub out explicit MCMachObjectTargetWriter interface.
...
llvm-svn: 121973
2010-12-16 16:09:19 +00:00
Daniel Dunbar
73b8713d7c
MC/Mach-O: Move createMachObjectWriter into MCMachObjectWriter.h.
...
llvm-svn: 121971
2010-12-16 16:08:33 +00:00
Daniel Dunbar
9d1ed19982
MC/Mach-O: Use fixup info instead of hard coded list.
...
llvm-svn: 121970
2010-12-16 15:42:31 +00:00
Daniel Dunbar
0c9d9fdd81
MC: Move target specific fixup info descriptors to TargetAsmBackend instead of
...
the MCCodeEmitter, which seems like a better organization.
- Also, cleaned up some magic constants while in the area.
llvm-svn: 121953
2010-12-16 03:20:06 +00:00
Jason W Kim
4c1386add9
1. ARM/MC/ELF: A few more ELF relocs for .o
...
2. Fixed EmitLocalCommonSymbol for ELF (Yes, they exist. :)
Test added.
llvm-svn: 121951
2010-12-16 03:12:17 +00:00
Daniel Dunbar
ecd0c8a557
MC: Make TargetAsmBackend available to the AsmStreamer.
...
- Treaty talks on the non-proliferation of MC objects broke down.
llvm-svn: 121949
2010-12-16 03:05:59 +00:00
Matt Beaumont-Gay
f991d4f587
Better fix for opt build
...
llvm-svn: 121910
2010-12-15 23:14:45 +00:00
Matt Beaumont-Gay
15f96baa01
Fix opt -Werror build
...
llvm-svn: 121904
2010-12-15 22:21:20 +00:00
Owen Anderson
c8fa5fcc42
Fix typo in r121875.
...
llvm-svn: 121880
2010-12-15 19:24:24 +00:00
Owen Anderson
622ad5170b
Implement cleanups suggested by Daniel.
...
llvm-svn: 121875
2010-12-15 18:48:27 +00:00
Rafael Espindola
844f6b6cfb
Relax alignment fragments.
...
With this we don't need the EffectiveSize field anymore. Without that field
LayoutFragment only updates offsets and we don't need to invalidate the
current fragment when it is relaxed (only the ones following it).
This is also a very small improvement in the accuracy of the layout info as
we now use the after relaxation size immediately.
llvm-svn: 121857
2010-12-15 08:45:53 +00:00
Rafael Espindola
8911d03504
Patch by David Meyer to avoid a O(N^2) behaviour when relaxing fragments.
...
Since we now don't update addresses so early, we might relax a bit more than
we need to. This is simillar to the issue in PR8467.
llvm-svn: 121856
2010-12-15 07:39:29 +00:00
Rafael Espindola
f80f18a11a
Generalize an assert.
...
llvm-svn: 121851
2010-12-15 07:12:24 +00:00
Jim Grosbach
41955ff958
ARM Fixups relative to thumb functions need to have the low bit of the value
...
set for interworking to work properly. rdar://8755956
llvm-svn: 121778
2010-12-14 18:46:57 +00:00
Jason W Kim
0e909c5f9c
First cut of ARM/MC/ELF PIC relocations.
...
Test has fixme, to move to .s -> .o test when AsmParser works better.
llvm-svn: 121732
2010-12-13 23:16:07 +00:00
Jim Grosbach
e119da1146
Thumb unconditional branch binary encoding. rdar://8754994
...
llvm-svn: 121496
2010-12-10 18:21:33 +00:00
Rafael Espindola
0a017a6db2
Fixed version of 121434 with no new memory leaks.
...
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola
a945a34c73
Revert my previous patch to make the valgrind bots happy.
...
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola
56eb741237
Initial support for the cfi directives. This is just enough to get
...
f:
.cfi_startproc
nop
.cfi_endproc
assembled (on ELF).
llvm-svn: 121434
2010-12-09 23:48:29 +00:00
Rafael Espindola
d66e65df03
Use const references.
...
llvm-svn: 121426
2010-12-09 23:08:35 +00:00
Owen Anderson
3ef19d9d48
Fix an issue in some Thumb fixups, where the effective PC address needs to be 4-byte aligned when calculating
...
the offset. Add a new fixup flag to represent this, and use it for the one fixups that I have a testcase for needing
this. It's quite likely that the other Thumb fixups will need this too, and to have their fixup encoding logic
adjusted accordingly.
llvm-svn: 121408
2010-12-09 20:27:52 +00:00
Jim Grosbach
68b27eb9d1
Rename CB/CBZ specific fixup accordingly.
...
llvm-svn: 121404
2010-12-09 19:50:12 +00:00
Devang Patel
3ebe3defe3
Add assert to catch an attempt to emit .byte 256
...
llvm-svn: 121402
2010-12-09 19:26:21 +00:00
Jason W Kim
c79c5f6e8c
ARM/MC/ELF TPsoft is now a proper pseudo inst.
...
Added test to check bl __aeabi_read_tp gets emitted properly for ELF/ASM
as well as ELF/OBJ (including fixup)
Also added support for ELF::R_ARM_TLS_IE32
llvm-svn: 121312
2010-12-08 23:14:44 +00:00
Bill Wendling
a7d6aa902a
Support the "target" encodings for the CB[N]Z instructions.
...
llvm-svn: 121308
2010-12-08 23:01:43 +00:00
Bill Wendling
8a6449c46e
Add support for loading from a constant pool.
...
llvm-svn: 121226
2010-12-08 01:57:09 +00:00
Jim Grosbach
87055ed6f4
Let target asm backends see assembler flags as they go by. Use that to handle
...
thumb vs. arm mode differences in WriteNopData().
llvm-svn: 121219
2010-12-08 01:16:55 +00:00
Rafael Espindola
6624f47272
Layout each section independently. With the testcase in PR8711:
...
before:
4 assembler - Number of assembler layout and relaxation steps
78563 assembler - Number of emitted assembler fragments
8693904 assembler - Number of emitted object file bytes
271223 assembler - Number of evaluated fixups
330771677 assembler - Number of fragment layouts
5958 assembler - Number of relaxed instructions
2508361 mcexpr - Number of MCExpr evaluations
real 0m26.123s
user 0m25.694s
sys 0m0.388s
after:
4 assembler - Number of assembler layout and relaxation steps
78563 assembler - Number of emitted assembler fragments
8693904 assembler - Number of emitted object file bytes
271223 assembler - Number of evaluated fixups
231507 assembler - Number of fragment layouts
5958 assembler - Number of relaxed instructions
2508361 mcexpr - Number of MCExpr evaluations
real 0m2.500s
user 0m2.113s
sys 0m0.273s
And yes, the outputs are identical :-)
llvm-svn: 121207
2010-12-07 23:32:26 +00:00
Rafael Espindola
e78d3b38de
Fix absolute recording of differences of symbols in two sections. Reduced from ctor_dtor_count-2.cpp.
...
llvm-svn: 121152
2010-12-07 17:12:32 +00:00
Rafael Espindola
bdbe5a712d
Fix relocations with weak definitions.
...
llvm-svn: 121114
2010-12-07 05:57:28 +00:00
Rafael Espindola
2eabaae459
Fix pcrel relocations that cross sections.
...
llvm-svn: 121107
2010-12-07 03:50:14 +00:00
Rafael Espindola
a2421ec705
Fix a crash reduced from gcc produced assembly.
...
llvm-svn: 121085
2010-12-07 01:09:54 +00:00
Rafael Espindola
93e3cf0ebd
Sorry for such a large commit. The summary is that only MachO cares about the
...
actuall addresses in a .o file, so it is better to let the MachO writer compute
it.
This is good for two reasons. First, areas that shouldn't care about
addresses now don't have access to it. Second, the layout of each section
is independent. I should use this in a subsequent commit to speed it up.
Most of the patch is just removing the section address computation. The two
interesting parts are the change on how we handle padding in the end
of sections and how MachO can get the address of a-b when a and b are in
different sections.
Since now the expression evaluation normally doesn't know the section address,
it will think that a-b needs relocation and let the MachO writer know. Once
it has computed the section addresses, it calls back the expression evaluation
with the section addresses to resolve these expressions.
The remaining problem is the handling of padding. Currently it will create
a special alignment fragment at the end. Since that fragment doesn't update
the alignment of the section, it needs the real address to be computed.
Since now the layout will not compute a-b with a and b in different sections,
the only effect that the special alignment fragment has is update the
address size of the section. This can also be done by the MachO writer.
llvm-svn: 121076
2010-12-07 00:27:36 +00:00
Jim Grosbach
9e1994698d
Add fixup for Thumb1 BL/BLX instructions.
...
llvm-svn: 121072
2010-12-06 23:57:07 +00:00
Rafael Espindola
1055f72b97
Use references to simplify the code a bit.
...
llvm-svn: 121050
2010-12-06 22:30:54 +00:00
Jason W Kim
495c2bb9a6
Refactor ELFObjectWriter.
...
+ ARM/X86/MBlaze now share a common RecordRelocation
+ ARM/X86/MBlaze arch specific routines are limited to GetRelocType()
llvm-svn: 121043
2010-12-06 21:57:34 +00:00
Rafael Espindola
e134b08daa
use getSymbolOffset.
...
llvm-svn: 121041
2010-12-06 21:51:55 +00:00
Rafael Espindola
408344017e
Another use of getSymbolOffset.
...
llvm-svn: 121034
2010-12-06 19:55:05 +00:00
Rafael Espindola
0f30fec0bd
Remove the instruction fragment to data fragment lowering since it was causing
...
freed data to be read. I will open a bug to track it being reenabled.
llvm-svn: 121028
2010-12-06 19:08:48 +00:00
Rafael Espindola
44bbe36de6
Second try at making direct object emission produce the same results
...
as llc + llvm-mc. This time ELF is not changed and I tested that llvm-gcc
bootstrap on darwin10 using darwin9's assembler and linker.
llvm-svn: 121006
2010-12-06 17:27:56 +00:00
Rafael Espindola
dee3062373
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
34a06a0802
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
baf2f3b3eb
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
46e40188f7
Simplify a bit.
...
llvm-svn: 120980
2010-12-06 03:36:43 +00:00
Rafael Espindola
45790b82af
Use getSymbolOffset on the COFF writer.
...
llvm-svn: 120979
2010-12-06 03:24:04 +00:00
Rafael Espindola
ac60adb38d
Don't use PadSectionToAlignment on windows.
...
llvm-svn: 120978
2010-12-06 03:03:44 +00:00
Rafael Espindola
e7284c3671
Add a getSymbolOffset method and use it in the ELF writer.
...
llvm-svn: 120977
2010-12-06 02:57:26 +00:00
Rafael Espindola
8867390cf2
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
99e026dbca
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
1c8ac8f027
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
1048e75fb9
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
f8af778e1f
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
4c70eeaf33
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
675fbb2ad1
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
57ab708bdd
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
5eed2e63f8
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
8cabd938ed
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
bf792065a9
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
9065bfc692
Move EmitValueToOffset to the ObjectStreamer.
...
llvm-svn: 120691
2010-12-02 05:59:38 +00:00
Rafael Espindola
3fa6fc1450
Add EmitInstToFragment to the generic object streamer.
...
llvm-svn: 120690
2010-12-02 05:44:06 +00:00
Rafael Espindola
60ebca9aaf
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
87b9114f49
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
ce2bd8d05f
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
50fe5c5138
Remove unused argument.
...
llvm-svn: 120621
2010-12-01 22:48:11 +00:00
Rafael Espindola
5fe5f45352
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
943fb60b1f
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
5695098c4c
Fix a mised reloc rename spot.
...
llvm-svn: 120585
2010-12-01 19:02:26 +00:00
Jason W Kim
29805961d8
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
447762da85
Merge System into Support.
...
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Rafael Espindola
e5e1f9ad0f
Make EmitIntValue non virtual.
...
llvm-svn: 120271
2010-11-28 23:22:44 +00:00
Rafael Espindola
0710e3771f
Forgot the MCPureStreamer::EmitValue in the previous commit.
...
llvm-svn: 120270
2010-11-28 23:13:47 +00:00
Rafael Espindola
a084fd6e9d
Move EmitValue to MCObjectStreamer.
...
llvm-svn: 120269
2010-11-28 23:08:47 +00:00
Rafael Espindola
e5b7415b21
Fixed verson of r120245.
...
Factor some duplicated code into MCObjectStreamer::EmitLabel.
llvm-svn: 120248
2010-11-28 17:18:55 +00:00
Rafael Espindola
1679580cc9
Revert previous patch while I debug the darwin bootstrap failure.
...
llvm-svn: 120246
2010-11-28 16:22:59 +00:00
Rafael Espindola
d4b3feb3f7
Factor some duplicated code into MCObjectStreamer::EmitLabel.
...
llvm-svn: 120245
2010-11-28 15:54:36 +00:00
Rafael Espindola
b746531c2c
Avoid code duplication in the many unsupported EmitGPRel32Value implementations.
...
llvm-svn: 120243
2010-11-28 15:09:24 +00:00
Rafael Espindola
8a3a7923eb
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
0ac77d526d
macho-dump: Add support for dumping relocation entries.
...
llvm-svn: 120216
2010-11-27 13:39:48 +00:00
Daniel Dunbar
768a5e8004
Fix a comment.
...
llvm-svn: 120199
2010-11-27 07:39:37 +00:00
Daniel Dunbar
4b128a5d4f
Reduce nesting.
...
llvm-svn: 120189
2010-11-27 05:18:48 +00:00
Daniel Dunbar
eab6e401fe
MC/Mach-O: Migrate more constants into MachOFormat.h.
...
llvm-svn: 120188
2010-11-27 04:59:14 +00:00
Daniel Dunbar
2263ca4834
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
bf4a4e4ad9
Remove the unused TheTarget member.
...
llvm-svn: 120168
2010-11-26 04:24:21 +00:00
Michael J. Spencer
f13f442b1a
Fix Whitespace.
...
llvm-svn: 120166
2010-11-26 04:16:08 +00:00
Rafael Espindola
f8e127eaf6
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
9f75d5df0b
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
708ac4d6ad
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
e98d483b71
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
4e70ac7b68
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
5c1d4e3b1e
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
6e13aa1d3b
Reuse data fragments while lowering. Patch by David Meyer.
...
llvm-svn: 119999
2010-11-23 05:49:35 +00:00
Jason W Kim
767a1e9adc
Fixed some style issues (no _, no spc after !)
...
llvm-svn: 119986
2010-11-22 22:05:16 +00:00
Jason W Kim
16b75262c4
Make the <ARCH>ELFObjectWriter statics private
...
llvm-svn: 119982
2010-11-22 18:57:00 +00:00