Evan Cheng
965b3c7323
Model :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
...
in the right direction. It eliminated some hacks and will unblock codegen
work. But it's far from being done. It doesn't reject illegal expressions,
e.g. (FOO - :lower16:BAR). It also doesn't work in Thumb2 mode at all.
llvm-svn: 123369
2011-01-13 07:58:56 +00:00
Jason W Kim
39e36e7ab4
Style clean up - break up the breaks.
...
llvm-svn: 123347
2011-01-13 00:07:51 +00:00
Jason W Kim
9c5b65d289
1. Support ELF pcrel relocations for movw/movt:
...
R_ARM_MOVT_PREL and R_ARM_MOVW_PREL_NC.
2. Fix minor bug in ARMAsmPrinter - treat bitfield flag as a bitfield, not an enum.
3. Add support for 3 new elf section types (no-ops)
llvm-svn: 123294
2011-01-12 00:19:25 +00:00
Anton Korobeynikov
2f93128109
Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there.
...
llvm-svn: 123170
2011-01-10 12:39:04 +00:00
Rafael Espindola
3686473578
Fix PR8878.
...
llvm-svn: 122658
2011-01-01 19:05:35 +00:00
Benjamin Kramer
570dd787a6
Make a bunch of symbols internal.
...
llvm-svn: 122642
2010-12-30 22:34:44 +00:00
Daniel Dunbar
ab14a6f174
MC/Mach-O/Thumb: Set the thumb bit in the symbol table.
...
llvm-svn: 122630
2010-12-29 14:14:06 +00:00
Rafael Espindola
46a5b05207
Correctly encode pcrel|indirect.
...
llvm-svn: 122624
2010-12-29 04:31:26 +00:00
Rafael Espindola
2ae93b2c9c
Remove second return.
...
llvm-svn: 122616
2010-12-29 02:42:33 +00:00
Rafael Espindola
563301dfdb
Fix bug when trying to output uint16_t or uint32_t.
...
llvm-svn: 122615
2010-12-29 02:30:49 +00:00
Rafael Espindola
290d71671e
Implement cfi_def_cfa. Also don't convert to dwarf reg numbers twice. Looks
...
like 6 is a fixed point of that and so the previous tests were OK :-)
llvm-svn: 122614
2010-12-29 01:42:56 +00:00
Rafael Espindola
426e68f793
Implement cfi_def_cfa_register.
...
llvm-svn: 122612
2010-12-29 00:26:06 +00:00
Rafael Espindola
86d347dd31
Initial .cfi_offset implementation.
...
llvm-svn: 122611
2010-12-29 00:09:59 +00:00
Rafael Espindola
6bbfb6c06c
Don't produce a "DW_CFA_advance_loc 0".
...
llvm-svn: 122609
2010-12-28 23:38:03 +00:00
Rafael Espindola
85d91982ca
Implement .cfi_remember_state and .cfi_restore_state.
...
llvm-svn: 122602
2010-12-28 18:36:23 +00:00
Benjamin Kramer
b6d52b8b64
Cast away "comparison between signed and unsigned integer" warnings.
...
llvm-svn: 122598
2010-12-28 13:52:52 +00:00
Duncan Sands
3784c5ea3c
Fix warning about size potentially being used uninitialized
...
when doing a release build.
llvm-svn: 122594
2010-12-28 10:02:42 +00:00
Rafael Espindola
736a35d9ab
Relax address updates in the eh_frame section.
...
llvm-svn: 122591
2010-12-28 05:39:27 +00:00
Rafael Espindola
a75b87b55a
Start adding basic support for emitting the call frame instructions.
...
llvm-svn: 122590
2010-12-28 04:15:37 +00:00
Rafael Espindola
1de2dd0e5e
Add support for .cfi_lsda.
...
llvm-svn: 122584
2010-12-27 15:56:22 +00:00
Daniel Dunbar
a895c69431
MC/Mach-O/Thumb: Select appropriate relocation types for Thumb.
...
llvm-svn: 122583
2010-12-27 14:49:49 +00:00
Rafael Espindola
8fc59a682f
Handle reloc_riprel_4byte_movq_load. Should make the bots happy.
...
llvm-svn: 122579
2010-12-27 02:03:24 +00:00
Rafael Espindola
2ac8355ecd
Add support for the same encodings of the personality function that gnu as
...
supports.
llvm-svn: 122577
2010-12-27 00:36:05 +00:00
Rafael Espindola
54462cd730
Fix .cfi_personality on 32 bit systems.
...
llvm-svn: 122570
2010-12-26 22:47:37 +00:00
Rafael Espindola
9ae2d05d45
Add support for @note. Patch by Jörg Sonnenberger.
...
llvm-svn: 122568
2010-12-26 21:30:59 +00:00
Rafael Espindola
9141b611ad
Add basic support for .cfi_personality.
...
llvm-svn: 122566
2010-12-26 20:20:31 +00:00
Chris Lattner
03a102bff3
Generalize a previous change, fixing PR8855 - an valid large immediate
...
rejected by the mc assembler.
llvm-svn: 122557
2010-12-25 21:36:35 +00:00
Rafael Espindola
0f8abeba1d
Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
...
have a single point where targets test if a relocation is needed.
llvm-svn: 122549
2010-12-24 21:22:02 +00:00
Daniel Dunbar
7f2bb4dcae
MC/Mach-O/ARM: Start handling some Thumb branches.
...
llvm-svn: 122547
2010-12-24 16:41:46 +00:00
Kevin Enderby
fa3c6f148c
In llvm-mc parse a Hash token as a full line comment. Allows handling of
...
preprocessed .s files and matches darwin gas. rdar://8798690
Also fix a comment on the next line of AsmParser.cpp after this new code.
llvm-svn: 122531
2010-12-24 00:12:02 +00:00
Rafael Espindola
4124ab1255
Add r122359 back now that the bug in MCDwarfLineAddrFragment fragment has been
...
fixed.
llvm-svn: 122448
2010-12-22 22:16:24 +00:00
Rafael Espindola
d91e11932c
Assert that the AddrDelta expression is really constant and wrap it in a set
...
if we have a lame assembler.
llvm-svn: 122446
2010-12-22 22:04:28 +00:00
Rafael Espindola
a6cd2d821a
Rename NeedsSetToChangeDiffSize to HasAggressiveSymbolFolding which is a much
...
better name and matches what is used in the MachO writer.
llvm-svn: 122443
2010-12-22 21:51:29 +00:00
Daniel Dunbar
ac8173cf71
MC/Mach-O/ARM: Don't try to use scattered relocs for BR24 fixups.
...
llvm-svn: 122441
2010-12-22 21:26:43 +00:00
Rafael Espindola
0e14b61c0b
Revert r122359 while I debug PR8845.
...
llvm-svn: 122427
2010-12-22 19:05:49 +00:00
Matt Beaumont-Gay
6b5d2519b3
Fix another conditional expression mismatched enum type warning.
...
llvm-svn: 122419
2010-12-22 18:25:55 +00:00
Daniel Dunbar
45140d2efc
MC/Mach-O/ARM: We always use the SECTDIFF reloc type on ARM, which is
...
esp. important given that the LOCAL_SECTDIFF enumeration got redefined.
llvm-svn: 122412
2010-12-22 16:52:19 +00:00
Daniel Dunbar
11617c8666
MC/Mach-O/ARM: Clone off an ARM version of RecordScatteredRelocation until I figure out how it is supposed to work.
...
llvm-svn: 122410
2010-12-22 16:45:29 +00:00
Daniel Dunbar
dde72ef0c1
MC/Mach-O: Return to reporting errors if we see unexpected fixup kinds.
...
llvm-svn: 122409
2010-12-22 16:32:41 +00:00
Daniel Dunbar
a191cfd97e
MC/Mach-O/ARM: Recognize generic _Data_N fixup kinds.
...
llvm-svn: 122408
2010-12-22 16:32:37 +00:00
Daniel Dunbar
9ccf843a61
MC/Mach-O/ARM: Add enough relocation logic to get BR24 relocations.
...
llvm-svn: 122407
2010-12-22 16:19:24 +00:00
Daniel Dunbar
56f13732e2
MC/Mach-O/ARM: Fix thinko.
...
llvm-svn: 122406
2010-12-22 16:19:20 +00:00
Rafael Espindola
50ce2f06de
Use references and simplify.
...
llvm-svn: 122405
2010-12-22 16:11:57 +00:00
Rafael Espindola
73c0ae77ca
Simplify the handling of .size expressions.
...
llvm-svn: 122404
2010-12-22 16:03:00 +00:00
Daniel Dunbar
083132e131
MC/Mach-O/ARM: Stub out RecordARMRelocation, which is mostly a copy of
...
RecordRelocation with lots of FIXMEs.
llvm-svn: 122402
2010-12-22 13:50:05 +00:00
Daniel Dunbar
a63db77f2e
Simplify.
...
llvm-svn: 122401
2010-12-22 13:49:56 +00:00
Daniel Dunbar
1e5be3653c
MC/Mach-O: Split out RecordARMRelocation for now, it is weird enough it isn't
...
clear how to keep in the generic path (yet).
- Will revisit when it actually works.
llvm-svn: 122400
2010-12-22 13:49:43 +00:00
Matt Beaumont-Gay
890cb2d506
GCC objects to the two sides of a conditional expression having different enum
...
types, but they're just getting converted to unsigned anyway, so cast first
(and ask questions later).
llvm-svn: 122377
2010-12-21 23:43:23 +00:00
Rafael Espindola
a468ae02cb
Simplify EvaluateAsAbsolute now that EvaluateAsRelocatableImpl does all
...
the folding it can.
llvm-svn: 122359
2010-12-21 20:51:42 +00:00
Rafael Espindola
6bdb49ded8
Don't relax org or align. They change size as the relaxation happens, but they
...
are not actually relaxed. For example, a section with only alignments will never
needs relaxation.
llvm-svn: 122356
2010-12-21 20:35:18 +00:00
Daniel Dunbar
ff78eda678
MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrong
...
type.
llvm-svn: 122334
2010-12-21 15:26:45 +00:00
Rafael Espindola
98d93c5294
Layout one section until no relaxations are done and then move to the next
...
section.
This helps because in practice sections form a dag with debug sections pointing
to text sections. Finishing up the text sections first makes the debug section
relaxation trivial.
llvm-svn: 122314
2010-12-21 04:22:09 +00:00
Roman Divacky
55184ddd35
Set the value of absolute symbols.
...
llvm-svn: 122268
2010-12-20 21:14:39 +00:00
Nick Lewycky
0de20af7ba
Add missing standard headers. Patch by Joerg Sonnenberger!
...
llvm-svn: 122193
2010-12-19 20:43:38 +00:00
Rafael Espindola
ee54636f0a
Fixed version of 122160 (the previous one would fold undefined symbols).
...
llvm-svn: 122167
2010-12-19 04:18:56 +00:00
Rafael Espindola
9a2d4e04c7
Revert 122160 while I debug it.
...
llvm-svn: 122165
2010-12-19 03:22:05 +00:00
Rafael Espindola
6fd80a5593
Move all folding to AttemptToFoldSymbolOffsetDifference.
...
llvm-svn: 122160
2010-12-19 02:15:04 +00:00
Roman Divacky
71d29167ea
Add support for lexing single quotes like 'c'.
...
This fixed 8615.
llvm-svn: 122150
2010-12-18 08:56:37 +00:00
Rafael Espindola
b403e098a1
Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
...
llvm-svn: 122148
2010-12-18 06:27:54 +00:00
Rafael Espindola
8396dd0893
Remove the MCObjectFormat class.
...
llvm-svn: 122147
2010-12-18 05:37:28 +00:00
Rafael Espindola
293a7c1840
Add a FIXME and explain a hack.
...
llvm-svn: 122144
2010-12-18 04:19:20 +00:00
Rafael Espindola
1ea7f18caa
Fix the note.
...
llvm-svn: 122139
2010-12-18 04:01:45 +00:00
Rafael Espindola
5004f4a9b5
Revert 122011, 122012, 122013, 122023 adding back an important optimization.
...
I added a note, but suggestions on how to add a test are really welcome.
llvm-svn: 122138
2010-12-18 03:57:21 +00:00
Rafael Espindola
fdaae0d16f
Move some data to the TargetWriter.
...
llvm-svn: 122134
2010-12-18 03:27:34 +00:00
Owen Anderson
79855298b9
Thumb's forced-PC-alignment requirement applies to the _total_ displacement, not just to the fragment relative
...
portion. While the fragment boundary is usually already aligned, it is possible for it not to be, which
would lead to a non-aligned final displacement.
llvm-svn: 122091
2010-12-17 21:49:48 +00:00
Rafael Espindola
d11460a65b
Store and free the TargetObjectWriter.
...
llvm-svn: 122070
2010-12-17 18:01:31 +00:00
Rafael Espindola
6b5e56c2b1
Stub out explicit MCELFObjectTargetWriter interface.
...
llvm-svn: 122067
2010-12-17 17:45:22 +00:00
Rafael Espindola
f0e24d426a
Move createELFObjectWriter to its own header.
...
llvm-svn: 122064
2010-12-17 16:59:53 +00:00
Rafael Espindola
df63335844
Use getFixupKindInfo to implement isFixupKindPCRel, ELF version.
...
llvm-svn: 122050
2010-12-17 07:28:17 +00:00
Daniel Dunbar
137d422e50
MC/Expr: Implemnt more aggressive folding during symbol evaluation using
...
IsSymbolRefDifferenceFullyResolved(). For example, we will now fold away
something like:
--
_a:
...
L0:
...
L1:
...
.long (L1 - L0) / 2
--
llvm-svn: 122043
2010-12-17 05:50:33 +00:00
Daniel Dunbar
2ee6c9b8c9
MC/Mach-O: On second thought, use a custom hook for enabling aggressive
...
IsSymbolRefDifferenceFullyResolved, it turns out this does change behavior on
enough cases for x86-32 that I would rather wait a bit on it.
- In practice, we will want to change this eventually because it only means we
generate less relocations (it also eliminates the need for the horrible
'.set' hack that Darwin requires in some places).
llvm-svn: 122042
2010-12-17 05:50:29 +00:00
Daniel Dunbar
b27bb86ba5
MC/Mach-O: Implement IsSymbolRefDifferenceFullyResolved.
...
- Unlike for fixups, we always do the "reliable" thing (not just for x86_64).
- Since Darwin 'as' would typically reject things that using this will allow,
we don't need to worry about compatibility.
llvm-svn: 122038
2010-12-17 04:54:58 +00:00
Daniel Dunbar
f2adf782ab
MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific hook.
...
- Currently just has stub implementations for Mach-O, ELF, and COFF.
llvm-svn: 122037
2010-12-17 04:54:54 +00:00
Daniel Dunbar
50269280f8
MC/Assembler: Strip out object writer arguments, now that it is always available
...
-- and remove FIXME asking for the same!
llvm-svn: 122032
2010-12-17 02:45:59 +00:00
Daniel Dunbar
42a037abb1
MC/Assembler: Make the MCObjectWriter available through the lifetime of the
...
assembler.
llvm-svn: 122031
2010-12-17 02:45:41 +00:00
Daniel Dunbar
d2867f13a0
MC/Target: Remove HasScatteredSymbols target hook variable, which has been
...
superceded and was effectively dead.
llvm-svn: 122024
2010-12-17 02:06:08 +00:00
Daniel Dunbar
e491ea4630
MC/Expr: Simplify.
...
llvm-svn: 122023
2010-12-17 02:05:45 +00:00
Daniel Dunbar
f89156da92
MC: Remove another dead MCAssembler argument, and update clients.
...
llvm-svn: 122013
2010-12-17 01:07:35 +00:00
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
Jason W Kim
84ffdd5cf1
Fix misplaced statics.
...
llvm-svn: 119981
2010-11-22 18:47:05 +00:00
Jason W Kim
a262546df7
Kill trailing whitespace
...
llvm-svn: 119979
2010-11-22 18:42:07 +00:00
Jason W Kim
7c7d0ef287
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
3c227b0b89
Add basic CFI methods to the streamer interface.
...
llvm-svn: 119972
2010-11-22 14:27:24 +00:00
Rafael Espindola
556f203d64
Remove some #includes.
...
llvm-svn: 119967
2010-11-22 11:53:17 +00:00
Wesley Peck
7699d6cfe9
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
26cb15a549
Handle PCRel relocations with absolute values. Fixes PR8656.
...
llvm-svn: 119917
2010-11-21 00:48:25 +00:00
Kevin Enderby
8be14414f6
Added support for the Mach-O .symbol_resolver directive. rdar://8673046
...
llvm-svn: 119816
2010-11-19 18:39:33 +00:00
Rafael Espindola
9900b4802e
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
0b4c9aa9a9
Add an assert.
...
llvm-svn: 119788
2010-11-19 04:55:36 +00:00
Rafael Espindola
92ca933f6e
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
b58867ccba
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
67c6ab8865
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
7a2cd8b540
make isVirtualSection a virtual method on MCSection. Chris' suggestion.
...
llvm-svn: 119547
2010-11-17 20:03:54 +00:00
Jim Grosbach
d82684c7fc
Fix typo.
...
llvm-svn: 119542
2010-11-17 19:30:11 +00:00
Rafael Espindola
b67912d5cd
Add support for .int.
...
llvm-svn: 119512
2010-11-17 16:24:40 +00:00
Rafael Espindola
5c996894bd
Add support for .2byte, .4byte and .8byte.
...
Fixes PR8631.
llvm-svn: 119511
2010-11-17 16:15:42 +00:00
Daniel Dunbar
95d37be1a9
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
c653a895c8
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
3bbea57a6e
Parse and ignore some .cfi_* directives.
...
llvm-svn: 119362
2010-11-16 18:34:07 +00:00
Rafael Espindola
7d19efd6ff
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
202d91e433
Fix compiler warnigns.
...
llvm-svn: 119175
2010-11-15 19:20:50 +00:00
Rafael Espindola
8c3039b67b
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
96f4c01cb3
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
46c79ef113
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
9e7d8c0313
correct the fixup comment printer to work on big endian platforms.
...
llvm-svn: 119122
2010-11-15 05:56:19 +00:00
Chris Lattner
edb9d84dcc
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
240028d11d
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
94f0c14cb0
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
a7d0bed336
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
b05ef7377a
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
7d0ba3464e
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
0e3decfcf7
Simplify getSymbolIndexInSymbolTable by setting the actual index of
...
the symbols.
llvm-svn: 119022
2010-11-14 03:12:24 +00:00
Rafael Espindola
eba9022652
Fix warning.
...
llvm-svn: 119021
2010-11-14 01:34:31 +00:00
Daniel Dunbar
fe0c28f4db
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
2d006b1ade
Fix warning and add support for printing gnu_unique_object.
...
llvm-svn: 118981
2010-11-13 04:55:06 +00:00
Rafael Espindola
4bcf94c75a
Parse and record the gnu_unique_object type.
...
llvm-svn: 118980
2010-11-13 04:51:02 +00:00
Rafael Espindola
f01b622902
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
1d37f35eea
Fix the encoding of negative line deltas.
...
llvm-svn: 118962
2010-11-13 01:06:27 +00:00
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
c4f4b2e878
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
de990b270d
gnu as support both % and @ before types, do the same.
...
llvm-svn: 118893
2010-11-12 15:47:08 +00:00
Jim Grosbach
ba321cb120
Trailing whitespace.
...
llvm-svn: 118831
2010-11-11 20:16:23 +00:00
Rafael Espindola
84d031870c
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
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
Jim Grosbach
f23b2d9d8d
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
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
Daniel Dunbar
8a3c3f2ad3
Fix typo.
...
llvm-svn: 118421
2010-11-08 17:53:02 +00:00
Rafael Espindola
9d17a3194e
Set default flags for .rodata.
...
llvm-svn: 118395
2010-11-08 02:47:59 +00:00
Rafael Espindola
20b11eaa01
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
5665a93bc5
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
cbdf7efe1c
Add '.code 32' assembler directive to MC streamers.
...
llvm-svn: 118309
2010-11-05 22:40:09 +00:00
Jim Grosbach
5a2c68d308
MC'ize the '.code 16' and '.thumb_func' ARM directives.
...
llvm-svn: 118301
2010-11-05 22:08:08 +00:00
Benjamin Kramer
80bb80f5fc
Put class into an anonymous namespace.
...
llvm-svn: 118294
2010-11-05 19:56:38 +00:00
Jim Grosbach
46c2acbcb4
Allow targets to specify the MachO CPUType/CPUSubtype information.
...
llvm-svn: 118288
2010-11-05 18:48:58 +00:00
Jim Grosbach
c75bb744e1
syntaxunified directive is a no-op for MachO writing.
...
llvm-svn: 118287
2010-11-05 18:47:32 +00:00
Rafael Espindola
38d0756b88
Add 118023 back, but with proper spelling for .uleb128/.sleb128.
...
llvm-svn: 118254
2010-11-04 18:17:08 +00:00
Rafael Espindola
f8343f87e7
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
5e874982f2
Add support for expressions in .sleb/.uleb directives.
...
llvm-svn: 118023
2010-11-02 17:22:24 +00:00
Rafael Espindola
13ddd6d410
Write the line info to .debug_line.
...
llvm-svn: 117930
2010-11-01 17:07:14 +00:00
Rafael Espindola
72b5488680
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
144fb8af58
Add support for .value.
...
llvm-svn: 117922
2010-11-01 15:29:07 +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
8aefb66376
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
63760ba38e
Add support for the .string directive.
...
llvm-svn: 117592
2010-10-28 20:02:27 +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
Roman Divacky
41e6cebb40
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
fdac6365ab
Implement .equ directive as a synonym to .set.
...
llvm-svn: 117553
2010-10-28 16:22:58 +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
095fa9e5cc
Set default type and flags for .init and .fini.
...
llvm-svn: 117471
2010-10-27 18:45:20 +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
c9fb35e73b
Add support for .ident.
...
llvm-svn: 117389
2010-10-26 19:35:47 +00:00
Daniel Dunbar
b3a48f3459
MC/AsmParser: Fix relative precedence of {+,-} and comparison ops.
...
llvm-svn: 117299
2010-10-25 20:18:56 +00:00
Daniel Dunbar
7484d2cbec
MC/AsmLexer: Fix bug in source location for Slash token.
...
llvm-svn: 117298
2010-10-25 20:18:53 +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
Benjamin Kramer
9192e7ab12
Make some symbols static, move classes into anonymous namespaces.
...
llvm-svn: 117111
2010-10-22 17:35:07 +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
Jim Grosbach
90600d3329
Trailing whitespace.
...
llvm-svn: 117073
2010-10-21 22:04:05 +00:00
Michael J. Spencer
31041a9967
Fix Warnings.
...
llvm-svn: 117062
2010-10-21 20:49:38 +00:00
Rafael Espindola
8ba86f801d
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
1898262a33
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
ee8d15157a
Small cleanups and fixes in preparation for fixing _GLOBAL_OFFSET_TABLE_.
...
llvm-svn: 116848
2010-10-19 19:31:37 +00:00
Bill Wendling
5391eb61fb
Fix spelling.
...
llvm-svn: 116804
2010-10-19 10:18:23 +00:00
Chandler Carruth
a960cb7181
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
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
Michael J. Spencer
17990d5690
MC-COFF: Add support for default-null weak externals.
...
llvm-svn: 116666
2010-10-16 08:25:57 +00:00
Daniel Dunbar
4d99878a37
MC/AsmParser: Report .stabs directive as unsupported.
...
llvm-svn: 116659
2010-10-16 04:56:42 +00:00
Rafael Espindola
84378f0f53
Refactor alias handling to AliasedSymbol.
...
llvm-svn: 116600
2010-10-15 18:25:33 +00:00