Daniel Dunbar
6b4391aa69
MC/Mach-O: Silently ignore .file directives instead of error'ing out on
...
them. They aren't important enough to abort the entire assembly, and failing
early makes testing more annoying.
llvm-svn: 108747
2010-07-19 20:44:20 +00:00
Michael J. Spencer
e2da0a478d
MC: Add WinCOFFStreamer implementation and merge common code from MachO
...
into MCObjectStreamer.
Origonal Windows COFF implementation by Nathan Jedffords.
llvm-svn: 108678
2010-07-19 06:13:10 +00:00
Kevin Enderby
082d0fd7ad
Added the darwin .weak_def_can_be_hidden directive.
...
llvm-svn: 107886
2010-07-08 17:22:42 +00:00
Daniel Dunbar
ede8e6d2f0
MC/Mach-O: Rewrite atom association to be a final pass we do in Finish(), instead of tracking as part of emission.
...
- This allows sharing more code with the MCObjectStreamer.
llvm-svn: 106143
2010-06-16 20:04:32 +00:00
Daniel Dunbar
aa627c39e4
MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
...
llvm-svn: 106142
2010-06-16 20:04:29 +00:00
Daniel Dunbar
b2347fe504
MC: Lift SwitchSection() and Finish() into MCObjectStreamer.
...
llvm-svn: 106141
2010-06-16 20:04:25 +00:00
Daniel Dunbar
8a3c9d9bc4
MC: Factor out an MCObjectStreamer class, which will be shared by the concrete
...
object file format writers.
llvm-svn: 106140
2010-06-16 20:04:22 +00:00
Daniel Dunbar
b889fc987e
MC: When running with -mc-relax-all, we can eagerly relax instructions and avoid creating unnecessary MCInstFragments.
...
llvm-svn: 104736
2010-05-26 20:37:03 +00:00
Daniel Dunbar
9d40ef162b
MC/Mach-O: Factor out EmitInstTo{Fragment,Data} for emitting MCInst's as MCInstFragments or appending onto an MCDataFragment.
...
llvm-svn: 104735
2010-05-26 20:37:00 +00:00
Daniel Dunbar
388ff9b1a2
MC: Eliminate an unnecessary copy.
...
llvm-svn: 104709
2010-05-26 17:50:16 +00:00
Daniel Dunbar
a19838e107
MC: Simplify MayNeedRelaxation to not provide the fixups, so we can query it
...
before encoding.
llvm-svn: 104707
2010-05-26 17:45:29 +00:00
Daniel Dunbar
b34440a6a8
MC: Eliminate MCAsmFixup, replace with MCFixup.
...
llvm-svn: 104699
2010-05-26 15:18:56 +00:00
Daniel Dunbar
353a91ff76
MC: Use accessors for access to MCAsmFixup.
...
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Eric Christopher
09d47031b1
Expand on comment.
...
llvm-svn: 104396
2010-05-21 23:03:53 +00:00
Eric Christopher
feedc90c57
Implement EmitTBSSSymbol for MachOStreamer.
...
Fixes build failure as well.
llvm-svn: 104059
2010-05-18 21:26:41 +00:00
Daniel Dunbar
d5563f420a
MC/Mach-O: Implement support for setting indirect symbol table offset in section header.
...
Also, create symbol data for LHS of assignment, to match 'as' symbol ordering better.
llvm-svn: 104033
2010-05-18 17:28:24 +00:00
Daniel Dunbar
39617bb08a
MC/Mach-O: Fail faster/harder when we see .file, which isn't yet supported.
...
llvm-svn: 104031
2010-05-18 17:28:17 +00:00
Daniel Dunbar
b7b796cc11
MC/Mach-O: Reverse order of SymbolData scanning when emitting instructions.
...
- This fixes a string table mismatch with 'as' when two new symbols are defined
in a single instruction.
llvm-svn: 103979
2010-05-17 21:19:59 +00:00
Daniel Dunbar
0211a96989
MC/Mach-O: Fix some differences in symbol flag handling.
...
- Don't clear weak reference flag, 'as' was only "trying" to do this, it wasn't
actually succeeding.
- Clear the "lazy bound" bit when we mark something external. This corresponds
roughly to the lazy clearing of the bit that 'as' implements in
symbol_table_lookup.
- The exact meaning of these flags appears pretty loose, since 'as' isn't very
consistent. For now we just try to match 'as', we will clean this up one day
hopefully.
llvm-svn: 103964
2010-05-17 20:12:31 +00:00
Eric Christopher
9fb6bb07ca
Add AsmParser support for darwin tbss directive.
...
Nothing uses this yet.
llvm-svn: 103757
2010-05-14 01:50:28 +00:00
Daniel Dunbar
b76df22a2e
MC: Move MCAlignFragment::EmitNops value out of the constructor.
...
llvm-svn: 103665
2010-05-12 22:56:23 +00:00
Daniel Dunbar
4405ffc688
MC: Eliminate MCZeroFillFragment, it is no longer needed.
...
llvm-svn: 103664
2010-05-12 22:51:38 +00:00
Daniel Dunbar
51402b79e4
MC: Drop support for alignment in ZeroFill fragment, we can just use
...
MCAlignFragments for this.
llvm-svn: 103661
2010-05-12 22:51:27 +00:00
Daniel Dunbar
aadb2cac49
MC/Mach-O: Explicitly track atoms, as represented by their defining symbol, for each fragment (not yet used).
...
llvm-svn: 103438
2010-05-10 22:45:09 +00:00
Chris Lattner
72afa956db
break coff symbol definition stuff out into proper MCStreamer callbacks,
...
patch by Nathan Jeffords!
llvm-svn: 103346
2010-05-08 19:54:22 +00:00
Kevin Enderby
51bed9c870
Fix i386 relocations to Weak Definitions. The relocation entries should be
...
external and the item to be relocated should not have the address of the
symbol added in.
llvm-svn: 103302
2010-05-07 21:44:23 +00:00
Daniel Dunbar
f3a53baf00
MC/Mach-O: Mark absolute variable's appropriately, and add Mach-O support for
...
writing them.
- <rdar://problem/7885351> integrated assembler broken for i386 objc code
llvm-svn: 103112
2010-05-05 19:01:05 +00:00
Daniel Dunbar
deb7ba9cc0
MC: Reject attempts to define a variable symbol.
...
llvm-svn: 103111
2010-05-05 19:01:00 +00:00
Daniel Dunbar
7a989da0af
MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue.
...
llvm-svn: 103095
2010-05-05 17:41:00 +00:00
Daniel Dunbar
d821f4ac60
llvm-mc: Add a -mc-relax-all option, which relaxes every fixup. We always need
...
exactly two passes in that case, and don't ever need to recompute any layout,
so this is a nice baseline for relaxation performance.
llvm-svn: 99563
2010-03-25 22:49:09 +00:00
Daniel Dunbar
de04b3f62c
MC: Switch to using MCInst fragments to do relaxation.
...
Also, both MCMachOStreamer and MCAssembler are now target independent!
llvm-svn: 99256
2010-03-23 05:09:03 +00:00
Daniel Dunbar
86face8333
MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
...
llvm-svn: 99249
2010-03-23 03:13:05 +00:00
Daniel Dunbar
a9ae3ae698
MC: Add TargetAsmBackend::WriteNopData and use to eliminate some target dependencies in MCMachOStreamer and MCAssembler.
...
llvm-svn: 99248
2010-03-23 02:36:58 +00:00
Daniel Dunbar
b31c49a70d
MC: Add MCInstFragment, not used yet.
...
llvm-svn: 99229
2010-03-22 23:16:48 +00:00
Daniel Dunbar
f1f1827bfa
MC/Mach-O: Factor out getOrCreateDataFragment().
...
llvm-svn: 99204
2010-03-22 20:35:46 +00:00
Daniel Dunbar
1bd7171c95
MC: Sink code emitter into MCAssembler.
...
llvm-svn: 98953
2010-03-19 10:43:18 +00:00
Daniel Dunbar
aa8f95eb56
MC: Fix a crash on invalid, attempting to evaluate undefined symbols.
...
llvm-svn: 98464
2010-03-14 03:10:40 +00:00
Daniel Dunbar
921e79f5eb
MC: Add MCAssembler::addFixup, which enforces that fixups are added in order.
...
llvm-svn: 98379
2010-03-12 21:00:38 +00:00
Daniel Dunbar
c5ddbad237
MC: Provide MCAssembler with a TargetAsmBackend.
...
llvm-svn: 98222
2010-03-11 01:34:27 +00:00
Daniel Dunbar
6eab721011
MC: Move the backend section and symbol data maps to MCAssembler.
...
llvm-svn: 98186
2010-03-10 20:58:29 +00:00
Daniel Dunbar
7e3283c055
Remove unneeded includes.
...
llvm-svn: 98167
2010-03-10 17:56:05 +00:00
Kevin Enderby
e83d74f626
This is the first patch to put the needed bits in place to eventually allow code
...
to be aligned with optimal nops. This patch does not change any functionality
and when the compiler is changed to use EmitCodeAlignment() it should also not
change the resulting output. Once the compiler change is made and everything
looks good the next patch with the table of optimal X86 nops will be added to
WriteNopData() changing the output. There are many FIXMEs in this patch which
will be removed when we have better target hooks (coming soon I hear).
llvm-svn: 96963
2010-02-23 18:26:34 +00:00
Daniel Dunbar
5fe3129a5d
MC/Mach-O: Remove non-sensical comment, and add a missing AddValueSymbols call.
...
llvm-svn: 96809
2010-02-22 22:08:57 +00:00
Daniel Dunbar
1e2fad3de8
MC/Mach-O: Start emitting fixups/relocations for instructions.
...
llvm-svn: 96095
2010-02-13 09:29:02 +00:00
Daniel Dunbar
3374835b46
MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
...
llvm-svn: 96094
2010-02-13 09:28:54 +00:00
Daniel Dunbar
1a1fbb50fc
MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
...
llvm-svn: 96091
2010-02-13 09:28:22 +00:00
Daniel Dunbar
b311a6b3ae
MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
...
llvm-svn: 95708
2010-02-09 22:59:55 +00:00
Chris Lattner
38d022efe9
add scaffolding for target-specific MCExprs.
...
llvm-svn: 95559
2010-02-08 19:41:07 +00:00
Daniel Dunbar
255a8c8b13
MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
...
llvm-svn: 95135
2010-02-02 21:44:01 +00:00
Chris Lattner
3cde760023
mcstreamerize gprel32 emission.
...
llvm-svn: 94452
2010-01-25 21:28:50 +00:00
Chris Lattner
601ef33c77
mcstreamerize .file and .file. This also fixes an issue where the
...
normal form of .file would fail if the filename had a weird character
in it.
llvm-svn: 94437
2010-01-25 18:58:59 +00:00
Chris Lattner
bc8f638531
add symbol attribute support for the ELF .type directive.
...
llvm-svn: 94435
2010-01-25 18:30:45 +00:00
Chris Lattner
91dac6d570
emit the .size directive for global variables on ELF through
...
mcstreamer.
llvm-svn: 94416
2010-01-25 07:52:13 +00:00
Chris Lattner
b1301f7bce
mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
...
llvm-svn: 94299
2010-01-23 07:47:02 +00:00
Chris Lattner
685508cf49
move the various directive enums out of the MCStreamer class
...
into a new MCDirectives.h file.
llvm-svn: 94294
2010-01-23 06:39:22 +00:00
Chris Lattner
1deb09c28d
mcstreamerize .no_dead_strip and .reference for static ctors/dtors.
...
llvm-svn: 94290
2010-01-23 05:51:36 +00:00
Chris Lattner
c35681b298
Generalize mcasmstreamer data emission APIs to take an address space
...
identifier. There is no way to work around it.
llvm-svn: 93896
2010-01-19 19:46:13 +00:00
Nate Begeman
660d979ad9
Add a note for the macho streamer and remove a used of the mangler from the soon to be defunct machowriter pass.
...
llvm-svn: 93670
2010-01-17 03:49:01 +00:00
Daniel Dunbar
ad36e8aceb
Pass StringRef by value.
...
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Daniel Dunbar
5d9134747b
MC: Set symbol values in MachO MCStreamer.
...
llvm-svn: 84236
2009-10-16 01:58:23 +00:00
Daniel Dunbar
8e6d889d4c
MC: Switch assembler API to using MCExpr instead of MCValue.
...
llvm-svn: 84234
2009-10-16 01:58:03 +00:00
Daniel Dunbar
c3bd60e393
MC: Remove unneeded context argument to MCExpr::Evaluate*.
...
llvm-svn: 84233
2009-10-16 01:57:52 +00:00
Daniel Dunbar
897ffadd2d
llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
...
llvm-svn: 80578
2009-08-31 08:09:28 +00:00
Daniel Dunbar
b7b2097aac
llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
...
llvm-svn: 80577
2009-08-31 08:09:09 +00:00
Daniel Dunbar
73da11ebda
llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
...
Also, use MCInst::print instead of custom code in MCAsmPrinter.
llvm-svn: 80575
2009-08-31 08:08:38 +00:00
Daniel Dunbar
945e257e99
llvm-mc: Make MCSymbolData symbol member const.
...
llvm-svn: 80573
2009-08-31 08:08:06 +00:00
Daniel Dunbar
02c7254f6d
llvm-mc: Add MCContext to MCAssembler.
...
llvm-svn: 80572
2009-08-31 08:07:55 +00:00
Daniel Dunbar
6a715dccdf
llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
...
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).
llvm-svn: 80484
2009-08-30 06:17:16 +00:00
Daniel Dunbar
2a2459a291
llvm-mc: .lsym is more unsupported than unimplemented, pending a use case appearing.
...
Also, all one of the file level flags are implemented.
llvm-svn: 80352
2009-08-28 07:08:47 +00:00
Daniel Dunbar
2701eee0ad
llvm-mc: Support .comm emission.
...
llvm-svn: 80351
2009-08-28 07:08:35 +00:00
Daniel Dunbar
42a39d038a
llvm-mc: Support .zerofill emission.
...
- I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences.
llvm-svn: 80347
2009-08-28 05:49:21 +00:00
Daniel Dunbar
d82ef0e923
llvm-mc: Factor getSectionData out of SwitchSection.
...
llvm-svn: 80344
2009-08-28 05:48:54 +00:00
Daniel Dunbar
96abad185d
llvm-mc: Emit .lcomm as .zerofill.
...
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar
cf72e1c03e
llvm-mc: Add const to EmitZeroFill section argument.
...
llvm-svn: 80341
2009-08-28 05:48:22 +00:00
Daniel Dunbar
c7c5f9fa86
llvm-mc/Mach-O: Add MCCodeEmitter support, for encoding instructions.
...
- No relocations yet, of course.
llvm-svn: 80235
2009-08-27 08:17:51 +00:00
Daniel Dunbar
e2697738a4
llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
...
llvm-svn: 80144
2009-08-26 21:22:22 +00:00
Daniel Dunbar
c1710a04ba
llvm-mc: Add symbol entries for undefined symbols used in .fill and .org.
...
llvm-svn: 80086
2009-08-26 13:57:37 +00:00
Daniel Dunbar
aef5317edd
llvm-mc/Mach-O: Set addresses for symbols.
...
llvm-svn: 80065
2009-08-26 02:48:04 +00:00
Daniel Dunbar
c2c0bf961f
llvm-mc: Improve indirect symbol support (add the indirect index table).
...
llvm-svn: 80059
2009-08-26 00:18:21 +00:00
Daniel Dunbar
582d61026d
llvm-mc/Mach-O: Preliminary support for indirect symbols.
...
- The indirect table itself isn't being filled in yet.
- This isn't factored properly and is rather FIXMEd, but at the moment I'm more
focused on figuring out what it needs to do.
llvm-svn: 79910
2009-08-24 11:56:58 +00:00
Daniel Dunbar
04a1158d13
llvm-mc/Mach-O: Support symbol attributes.
...
- This is mostly complete, the main thing missing is .indirect_symbol support
(which would be straight-forward, except that the way it is implemented in
'as' makes getting an exact .o match interesting).
llvm-svn: 79899
2009-08-24 08:40:12 +00:00
Chris Lattner
ca098517a3
prune some redundant #includes.
...
llvm-svn: 79746
2009-08-22 19:35:08 +00:00
Daniel Dunbar
d1859474a7
llvm-mc/Mach-O: Improve symbol table support:
...
- Honor .globl.
- Set symbol type and section correctly ('nm' now works), and order symbols
appropriately.
- Take care to the string table so that the .o matches 'as' exactly (for ease
of testing).
llvm-svn: 79740
2009-08-22 11:41:10 +00:00
Daniel Dunbar
ff3eafd39d
llvm-mc/Mach-O: Sketch symbol table support.
...
- The only .s syntax this honors right now is emitting labels, and some parts
of the symbol table generation are wrong or faked.
- This is enough to get nm to report such symbols... incorrectly, but still.
Also, fixed byte emission to extend the previous fragment if possible.
llvm-svn: 79739
2009-08-22 10:13:24 +00:00
Daniel Dunbar
6860ac7375
llvm-mc: Clean up some handling of symbol/section association to be more correct
...
(external was really undefined and there wasn't an explicit representation for
absolute symbols).
- This still needs some cleanup to how the absolute "pseudo" section is dealt
with, but I haven't figured out the nicest approach yet.
llvm-svn: 79733
2009-08-22 07:22:36 +00:00
Daniel Dunbar
b1068e4fe3
llvm-mc/Mach-O: Support .o emission for .org and .align.
...
llvm-svn: 79684
2009-08-21 23:07:38 +00:00
Daniel Dunbar
4ef7fb9530
llvm-mc/Mach-O: Support byte and fill value emission.
...
llvm-svn: 79652
2009-08-21 18:29:01 +00:00
Daniel Dunbar
3016db39dd
llvm-mc: Start MCAssembler and MCMachOStreamer.
...
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 09:11:24 +00:00