1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

1317 Commits

Author SHA1 Message Date
Daniel Dunbar
f419ec6362 MC/Mach-O: Allow emission of relocations for variables in some more cases.
llvm-svn: 130520
2011-04-29 18:10:47 +00:00
Daniel Dunbar
6178302330 MC/Mach-O: Find section ordinal's by looking at the symbol, instead of assuming they are present in a fragment.
llvm-svn: 130519
2011-04-29 18:07:43 +00:00
Devang Patel
acce3eb6b2 Hoist MCLineEntry construction AsmPrinter so that anyone who derives from AsmPrinter can have line number entries.
PR 9810

llvm-svn: 130518
2011-04-29 18:00:54 +00:00
Daniel Dunbar
c52dfd4349 MCExpr: Add FindAssociatedSection, which attempts to mirror the 'as' semantics
that associate sections with expressions.

llvm-svn: 130517
2011-04-29 18:00:03 +00:00
Daniel Dunbar
2727693326 MC/AsmParser: Generalize a check.
llvm-svn: 130515
2011-04-29 17:53:11 +00:00
Rafael Espindola
6c6e1622a8 Last bit by bit compatibility patch to MCDwarf.cpp: If a FDE with no LSDA is
assigned to a CIE that requires one, just output a 0.

llvm-svn: 130472
2011-04-29 03:06:29 +00:00
Rafael Espindola
a664fdf4cd Add an alternative implementation of CIE and FDE emission that outputs them
in the same order as the one in CodeGen.

llvm-svn: 130471
2011-04-29 02:42:28 +00:00
Rafael Espindola
be5cb08cf8 Add the getExprForFDESymbol method that responsible for computing the
expressions used in the FDE to refer to symbols.

llvm-svn: 130437
2011-04-28 21:04:39 +00:00
Rafael Espindola
f75a67d261 Add a getExprForPersonalitySymbol method to MCAsmInfo. Use it when
converting the symbol passed to .cfi_personality into bytes is the file.

llvm-svn: 130400
2011-04-28 16:09:09 +00:00
Rafael Espindola
4f9a76ab0b Mark the EH symbol global or weak if the corresponding function is.
llvm-svn: 130397
2011-04-28 12:50:37 +00:00
Rafael Espindola
7bc992c8d3 Add a small temporary hack for producing identical eh_frame sections on OS X.
This removes one of the main advantages of moving eh_frame to MC, but
makes the transition a lot easier to debug (run md5).

llvm-svn: 130379
2011-04-28 04:04:14 +00:00
Rafael Espindola
d63b896d05 Produce the EH_frame# symbols if needed.
llvm-svn: 130378
2011-04-28 03:26:11 +00:00
Rafael Espindola
d2ef63ca76 Forward isFunctionEHFrameSymbolPrivate. If it is false, produce the foo.eh
symbols.

llvm-svn: 130375
2011-04-28 02:46:42 +00:00
Rafael Espindola
133c684456 Factor a bit of code to MCStreamer::EmitLabel. Keep track of the last
non private symbol. This will be use for handling

foo:
  .cfi_startproc
  ...

On OS X where we have to create a foo.eh symbol.

llvm-svn: 130305
2011-04-27 15:21:19 +00:00
Rafael Espindola
7728a01105 Force some values to be absolute and align based on the FDE pointers size. A small
step towards using .cfi_* on OS X.

llvm-svn: 130273
2011-04-27 01:43:49 +00:00
Rafael Espindola
c115df57cc No relocation produces a SLEB or ULEB, make sure they are handled in MC.
llvm-svn: 130181
2011-04-26 02:17:58 +00:00
Sebastian Redl
0d36a0b806 Give MC/MCDisassembler/Disassembler.h a header guard.
llvm-svn: 130096
2011-04-24 15:46:56 +00:00
Jay Foad
c146569beb Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Chandler Carruth
d09040ad66 Delete the other unused variable in this function. Sorry I missed this
the first time through.

llvm-svn: 129969
2011-04-22 01:29:18 +00:00
Chandler Carruth
a0a38b7d6e Remove an unused variable from a function. This is a likely cut-paste-o.
Silences GCC warning.

I wonder why Clang doesn't warn on this...

llvm-svn: 129968
2011-04-22 01:21:06 +00:00
Rafael Espindola
717fc5112a Compute the size of the FDE encoding instead of hard coding it. Update
X8664_ELFTargetObjectFile::getFDEEncoding to match reality.

llvm-svn: 129959
2011-04-22 00:08:43 +00:00
Rafael Espindola
856ed14418 Remove unused argument.
llvm-svn: 129955
2011-04-21 23:39:26 +00:00
Rafael Espindola
1afc1304c7 Don't pass address spaces to EmitULEB128IntValue.
llvm-svn: 129953
2011-04-21 23:26:40 +00:00
Rafael Espindola
e206800036 Fix relative relocations. This is sufficient for running the rust testsuite with
MC :-)

llvm-svn: 129923
2011-04-21 18:36:50 +00:00
Rafael Espindola
032ab8c114 Behave like gnu as when a relocation crosses sections.
llvm-svn: 129850
2011-04-20 14:01:45 +00:00
Sean Callanan
c550ce0d48 Made the MC disassembler check before accessing
MCInst operands for ARM.  This allows it to be
more tolerant of malformed MCInsts or incorrect
instruction metadata.

llvm-svn: 129840
2011-04-20 00:43:34 +00:00
Eli Friedman
9009047cff malloc elimination: it's a bad idea to use raw_svector_ostream on a
small heap-allocated SmallString because it unconditionally forces a malloc.

(Revised version of r129688, with the necessary flush() call.)

llvm-svn: 129716
2011-04-18 20:54:46 +00:00
Devang Patel
7220c1a021 Reduce clutter in asm output. Do not emit source location as comment for each instruction.
llvm-svn: 129715
2011-04-18 20:26:49 +00:00
Eli Friedman
9654b5718d Revert r129688; it's breaking buildbots.
llvm-svn: 129689
2011-04-18 05:54:54 +00:00
Eli Friedman
fe593ec2d0 More malloc elimination: it's a bad idea to use raw_svector_ostream on a
small heap-allocated SmallString because it unconditionally forces a malloc.

llvm-svn: 129688
2011-04-18 05:38:58 +00:00
Eli Friedman
819c450b25 Make the StringMaps attached to MCContext use the MCContext's allocator;
reduces the number of calls to malloc().

llvm-svn: 129687
2011-04-18 05:02:31 +00:00
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Rafael Espindola
63f8a9ad72 Be consistent about being virtual and returning void in the cfi methods.
Implement the ones that were missing in the asm streamer.

llvm-svn: 129413
2011-04-12 23:59:07 +00:00
Rafael Espindola
9f6146c464 Remove LastOffset from the asm parser.
llvm-svn: 129378
2011-04-12 18:53:30 +00:00
Rafael Espindola
5c5bb3e9a6 Fix the case of a .cfi_rel_offset before any .cfi_def_cfa_offset.
llvm-svn: 129362
2011-04-12 16:12:03 +00:00
Rafael Espindola
7c4de15c7b Implement .cfi_same_value.
llvm-svn: 129361
2011-04-12 15:31:05 +00:00
Eric Christopher
b01713088d Match case for invalid constant error messages and add a new
test for invalid hexadecimals.

llvm-svn: 129326
2011-04-12 00:18:03 +00:00
Eric Christopher
b653bac7ce To avoid printing out multiple error messages for cases like:
.long 80+08

go ahead and assume that if we've got an Error token that we handled it
already. Otherwise if it's a token we can't handle then go ahead and
return the default error.

llvm-svn: 129322
2011-04-12 00:03:13 +00:00
Eric Christopher
a7c5e42cbe Lex, and then fail on invalid constants.
Testcase forthcoming.

rdar://8490596

llvm-svn: 129309
2011-04-11 22:24:56 +00:00
Rafael Espindola
a1fb8a36f9 Implement cfi_rel_offset
llvm-svn: 129306
2011-04-11 21:49:50 +00:00
Rafael Espindola
986ec356fc implement .cfi_adjust_cfa_offset.
llvm-svn: 129296
2011-04-11 20:29:16 +00:00
Kevin Enderby
6e09a5d065 Adding support for printing operands symbolically to llvm's public 'C'
disassembler API.  Hooked this up to the ARM target so such tools as Darwin's
otool(1) can now print things like branch targets for example this:
  blx _puts
instead of this:
  blx #-36
And even print the expression encoded in the Mach-O relocation entried for
things like this:
  movt r0, :upper16:((_foo-_bar)+1234)

llvm-svn: 129284
2011-04-11 18:08:50 +00:00
Benjamin Kramer
3af55c1e2e Fix potential buffer overflow on win32.
llvm-svn: 129214
2011-04-09 14:06:12 +00:00
Benjamin Kramer
6f39531981 Don't store Twine temporaries, it's not safe.
And don't append the name over and over again in the loop.

llvm-svn: 129210
2011-04-09 11:26:27 +00:00
Sean Callanan
0c1aa958e2 Redirected errors from the AsmParser to the proper
error stream, in cases where the AsmParser is
being invoked by EDDisassembler.  Before, they
were being sent to errs() because no error handler
was installed in the SourceMgr.

llvm-svn: 129177
2011-04-09 00:37:25 +00:00
Rafael Espindola
19119075c4 Micro optimization and improved similarity with gas' output:
When two section names share a suffix, reuse the entry in shstrtab.

llvm-svn: 129115
2011-04-07 23:21:52 +00:00
Rafael Espindola
a27969f537 Add support for .skip.
Patch by Roman Divacky.
Fixes PR9361.

llvm-svn: 129106
2011-04-07 20:26:23 +00:00
Sean Callanan
b1e6d05325 Fixed a bug where missing EDInstInfo would cause
tokenization to crash and burn.

llvm-svn: 129051
2011-04-07 01:56:01 +00:00
Shantonu Sen
a1467abb18 An MCDisassembler has the option to not implement
getEDInfo(), in which case this code would dereference
NULL. EDInst can already handle NULL info, so avoid
the dereference and pass NULL through.

Reviewed by Sean Callanan

llvm-svn: 128904
2011-04-05 18:40:45 +00:00
Kevin Enderby
1ece39d99c Added support symbolic floating point constants in the MC assembler for Infinity
and Nans with the same strings as GAS supports.  rdar://8673024

llvm-svn: 128488
2011-03-29 21:11:52 +00:00
Francois Pichet
b4a845ecbe Fix the MSVC build.
llvm-svn: 128441
2011-03-29 00:30:01 +00:00
Daniel Dunbar
5d8c7d0d36 MC: Add support for disabling "temporary label" behavior. Useful for debugging
on Darwin.

llvm-svn: 128430
2011-03-28 22:49:15 +00:00
Ted Kremenek
737cbac625 Unbreak CMake build.
llvm-svn: 128426
2011-03-28 20:43:53 +00:00
Kevin Enderby
8c488cb152 Again adding a C API to the disassembler for use by such tools as Darwin's
otool(1), this time with the needed fix for case sensitive file systems :) .
This is a work in progress as the interface for producing symbolic operands is
not done.  But a hacked prototype using information from the object file's
relocation entiries and replacing immediate operands with MCExpr's has been
shown to work with no changes to the instrucion printer.  These APIs will be
moved into a dynamic library at some point.

llvm-svn: 128415
2011-03-28 18:25:07 +00:00
NAKAMURA Takumi
dcd45bec2e Fix whitespace.
llvm-svn: 128370
2011-03-27 01:44:40 +00:00
Kevin Enderby
b05e6939a0 Remove the files for r128308 as it is causing a buildbot failure.
llvm-svn: 128309
2011-03-26 00:23:05 +00:00
Kevin Enderby
872ebb4fff Adding a C API to the disassembler for use by such tools as Darwin's otool(1).
This is a work in progress as the interface for producing symbolic operands is
not done.  But a hacked prototype using information from the object file's
relocation entiries and replacing immediate operands with MCExpr's has been
shown to work with no changes to the instrucion printer.  These APIs will be
moved into a dynamic library at some point.

llvm-svn: 128308
2011-03-26 00:06:33 +00:00
Daniel Dunbar
1cbd2c6c88 MC: Improve some diagnostics on uses of '.' pseudo-symbol.
llvm-svn: 128289
2011-03-25 17:47:17 +00:00
Daniel Dunbar
70235789e1 Tidyness.
llvm-svn: 128288
2011-03-25 17:47:14 +00:00
Bruno Cardoso Lopes
a5de5df6d8 Add asm parsing support w/ testcases for strex/ldrex family of instructions
llvm-svn: 128236
2011-03-24 21:04:58 +00:00
Jim Grosbach
213800d44b Clean up assembly statement separator support.
The MC asm lexer wasn't honoring a non-default (anything but ';') statement
separator. Fix that, and generalize a bit to support multi-character
statement separators.

llvm-svn: 128227
2011-03-24 18:46:34 +00:00
Owen Anderson
b201c7dede Fix a bug introduced by my patch yesterday: BL is a 4-byte instructions like BLX, rather than a 2-byte instruction like B.
llvm-svn: 128169
2011-03-23 21:19:56 +00:00
Owen Anderson
7785f055b9 RIT_ARM_ThumbBranch32Bit relocations are not used and should never be generated.
This fixes kimwitu++, bullet, and tramp3dv4 with the ARM integrated assembler.
Fixes <rdar://problem/9165738>.

llvm-svn: 128117
2011-03-22 22:52:54 +00:00
Owen Anderson
1264624890 Add support for Thumb interworking addresses for symbol offsets that get constant folded very early.
This fixes SPASS with -integrated-as.  <rdar://problem/9165399>

llvm-svn: 128037
2011-03-21 23:13:43 +00:00
Bill Wendling
a2eec46242 We need to pass the TargetMachine object to the InstPrinter if we are printing
the alias of an InstAlias instead of the thing being aliased. Because we need to
know the features that are valid for an InstAlias.

This is part of a work-in-progress.

llvm-svn: 127986
2011-03-21 04:13:46 +00:00
Rafael Espindola
b5c6ae67ac Write the section table and the section data in the same order that
gun as does. This makes it a lot easier to compare the output of both
as the addresses are now a lot closer.

llvm-svn: 127972
2011-03-20 18:44:20 +00:00
Stuart Hastings
0c1298989f Reapply 127939 since Daniel fixed the breakage. <rdar://problem/9012638>
llvm-svn: 127944
2011-03-19 02:42:31 +00:00
Stuart Hastings
0b337d0fe8 Revert 127939. <rdar://problem/9012638>
llvm-svn: 127943
2011-03-19 02:33:56 +00:00
Stuart Hastings
4a2b1ca9c1 Revise r126127 to address Daniel's comments. <rdar://problem/9012638>
llvm-svn: 127939
2011-03-19 01:32:01 +00:00
Daniel Dunbar
0e9d7aeb1f MC/Mach-O: Fix regression introduced in r126127, this assignment shouldn't have
been removed.

llvm-svn: 127812
2011-03-17 16:25:24 +00:00
Joerg Sonnenberger
e37bdf4386 Fix handling of @IDNTPOFF relocations, they need to get STT_TLS.
While here, add VK_ARM_TPOFF and VK_ARM_GOTTPOFF, too.

llvm-svn: 127780
2011-03-17 00:35:10 +00:00
Duncan Sands
e91289191a Silence compiler warning about case values not being in the enumerated type
MCFixupKind.  This is the same technique that is used elsewhere in MC.

llvm-svn: 127676
2011-03-15 08:54:51 +00:00
Sean Callanan
4f6e58ff09 Fixed the comparison operator for the enhanced
disassembler's disassembler map.

llvm-svn: 127527
2011-03-12 03:27:54 +00:00
Jan Sjödin
6791bc64a2 Add constructors to MCElfStreamer and MCObjectStreamer to take an extra MCAssembler * argument.
llvm-svn: 127343
2011-03-09 17:33:05 +00:00
Jim Grosbach
bdf8053571 Darwin 'as' silently ignores the '.ident' directive.
llvm-svn: 127258
2011-03-08 19:17:19 +00:00
Anton Korobeynikov
917ca94111 Preliminary support for ARM frame save directives emission via MI flags.
This is just very first approximation how the stuff should be done
(e.g. ARM-only for now). More to follow.

llvm-svn: 127101
2011-03-05 18:43:32 +00:00
Anton Korobeynikov
62e48532b9 Some first rudimentary support for ARM EHABI: print exception table in "text mode".
llvm-svn: 127099
2011-03-05 18:43:15 +00:00
Joerg Sonnenberger
5f2f5fa638 Be nice to Xcore and the XMOS assembler and avoid quoting section names
that contain only letters, digits and the characters "_" and ".".

llvm-svn: 127028
2011-03-04 20:03:14 +00:00
Joerg Sonnenberger
bb93506f95 Bug#9033: For the ELF assembler output, always quote the section name.
llvm-svn: 126963
2011-03-03 22:31:08 +00:00
Jan Sjödin
3c1fa9a68b Split MCEELFStreamer and ELFObjectWriter into .h and .cpp files, so that other components can use them.
llvm-svn: 126942
2011-03-03 14:52:12 +00:00
Eli Friedman
f7eb4cce13 PR9352: Always emit a relocation for weak symbols. Not emitting relocations
for calls to weak symbols with a definition has the appearance of working
with LLVM-generated code because weak symbol definitions are put in their
own sections.

llvm-svn: 126933
2011-03-03 07:24:36 +00:00
Oscar Fuentes
15a668f50b Fixes warnings emitted by Visual Studio 2010 compiler.
Patch by Erik Olofsson!

llvm-svn: 126796
2011-03-01 23:11:57 +00:00
Jan Sjödin
6bc6d6ab39 Make all static functions become static class methods. Move shared (duplicated) functions to new MCELF class.
llvm-svn: 126686
2011-02-28 21:45:04 +00:00
Cameron Zwarich
974208a607 Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.
llvm-svn: 126488
2011-02-25 16:30:32 +00:00
Joerg Sonnenberger
9c30c492df Restore r125595 (reverted in r126336) with modifications:
Introduce a variable in the AsmParserExtension whether [] is valid in an
expression. If it is true, parse them like (). Enable this for ELF only.

llvm-svn: 126443
2011-02-24 21:59:22 +00:00
Devang Patel
f2b2417c2c Enable DebugInfo support for COFF object files.
Patch by Nathan Jeffords!

llvm-svn: 126425
2011-02-24 21:04:00 +00:00
Benjamin Kramer
feccb33180 Plug some leaks in edis.
- Don't leak parsed operands during tokenization.
- Don't leak printed insts in llvm-mc.

llvm-svn: 126381
2011-02-24 11:03:19 +00:00
Jim Grosbach
e7be1f2990 Revert r125595, which is an X86-only undocumented assembly syntax extension
enabled for all targets. Non-X86 targets should not have this behavior
enabled by default.

Joerg, if you would like to resubmit with the behavior conditionalized to be
X86-ELF only, that's fine.

llvm-svn: 126336
2011-02-23 21:26:51 +00:00
Rafael Espindola
993a4ef35c Put in the symbol table symbols only used in a .globl statement.
Fixes PR9292.

llvm-svn: 126330
2011-02-23 20:22:07 +00:00
Sean Callanan
e1308394f1 Fixed a bug in the enhanced disassembler that caused
it to ignore valid uses of FS and GS as additional
base registers in address computations.  Added a test
case for this.

llvm-svn: 126302
2011-02-23 03:31:28 +00:00
Stuart Hastings
c0c38e8673 Omit private_extern declarations of extern symbols; followup to
r124468.  Patch by Rafael Avila de Espindola!

llvm-svn: 126297
2011-02-23 02:27:05 +00:00
Joerg Sonnenberger
cbdd830a75 Bug#9172: Don't use static in file scope, use an attribute on the
parser.

llvm-svn: 126225
2011-02-22 16:53:11 +00:00
Joerg Sonnenberger
dfe33572b5 Handle FK_PCRel_1 and add a test case for this and FK_PCRel_4.
llvm-svn: 126157
2011-02-21 23:25:41 +00:00
Stuart Hastings
8181f2d5a3 End the line if we return early. Radar 9012638.
llvm-svn: 126141
2011-02-21 21:07:07 +00:00
Stuart Hastings
d7ca2e5b61 Fix to correctly support attribute((section("__DATA, __common"))).
Radar 9012638.

llvm-svn: 126127
2011-02-21 17:27:17 +00:00
Joerg Sonnenberger
2204260330 Use a vector of pairs to implement the section stack, not two
independent vectors.

llvm-svn: 126099
2011-02-21 01:07:42 +00:00
Rafael Espindola
5fd4a261e7 Add some limited support for labels in org directives. Hopefully enough to fix
PR9245.

llvm-svn: 126091
2011-02-20 20:20:07 +00:00
Oscar Fuentes
6e5d344a2e Move library stuff out of the toplevel CMakeLists.txt file.
llvm-svn: 125968
2011-02-18 22:06:14 +00:00
Rafael Espindola
4ef1268b39 Gas is very inconsistent about when a relaxation/relocation is needed. Do
the right thing and stop trying to copy it. Fixes PR8944.

llvm-svn: 125648
2011-02-16 03:25:55 +00:00
Rafael Espindola
b59fdeb3de Add support for pushsection and popsection. Patch by Joerg Sonnenberger.
llvm-svn: 125629
2011-02-16 01:08:29 +00:00
Roman Divacky
3277e18a42 Add support for parsing [expr].
This is submitted by Joerg Sonnenberger and fixes his PR8685.

llvm-svn: 125595
2011-02-15 20:43:39 +00:00
Rafael Espindola
3c32af5834 Switch llvm to using comdats. For now always use groups with a single
section.

llvm-svn: 125526
2011-02-14 22:23:49 +00:00
Rafael Espindola
a667a598aa Move broken HasCommonSymbols to ELFWriter.cpp.
llvm-svn: 125490
2011-02-14 16:51:08 +00:00
Jim Grosbach
79e4b6b045 More whitespace cleanup...
llvm-svn: 125388
2011-02-11 19:05:56 +00:00
Shantonu Sen
70e390fa15 Fix comparator used for looking up previously instantiated EDDisassemblers.
Now, Syntax is only used as a tie-breaker if the Arch
matches. Previously, a request for x86_64 disassembler followed by the
i386 disassembler in a single process would return the cached x86_64
disassembler. Fixes <rdar://problem/8958982>

llvm-svn: 125215
2011-02-09 21:03:19 +00:00
Benjamin Kramer
8ff71a1384 Support for .ifdef / .ifndef in the assembler parser. Patch by Joerg Sonnenberger.
llvm-svn: 125120
2011-02-08 22:29:56 +00:00
Jason W Kim
7342155b4c Teach ARM/MC/ELF about gcc compatible reloc output to get past odd linkage
failures with relocations.

The code committed is a first cut at compatibility for emitted relocations in
ELF .o.

Why do this? because existing ARM tools like emitting relocs symbols as
explicit relocations, not as section-offset relocs.

Result is that with these changes,
1) relocs are now substantially identical what to gcc outputs.
2) larger apps (including many spec2k tests) compile, cross-link, and pass

Added reminder fixme to tests for future conversion to .s form.

llvm-svn: 124996
2011-02-07 01:11:15 +00:00
Jason W Kim
056e5aacb7 Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to
5 to match the current doc.
Added FIXME reminder Make it really configurable later.

llvm-svn: 124899
2011-02-04 21:41:11 +00:00
Jason W Kim
10c1a81736 Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps.
(yes, this is different from R_ARM_CALL)

- Adds a new method getARMBranchTargetOpValue() which handles the
  necessary distinction between the conditional and unconditional br/bl
  needed for ARM/ELF

At least for ARM mode, the needed fixup for conditional versus unconditional
br/bl is identical, but the ARM docs and existing ARM tools expect this
reloc type...

Added a few FIXME's for future naming fixups in ARMInstrInfo.td

llvm-svn: 124895
2011-02-04 19:47:15 +00:00
Bob Wilson
f6a7104e41 Do not sign extend floating-point values in the asm parser.
llvm-svn: 124831
2011-02-03 23:17:47 +00:00
Evan Cheng
3689d1302d Fix bogus assert condition noticed by Csaba Raduly.
llvm-svn: 124645
2011-02-01 01:50:49 +00:00
Roman Divacky
254f2ab16a Enumerate .code16/32/64 instead of checking .code prefix. This
unbreaks some ARM tests.

llvm-svn: 124608
2011-01-31 21:19:43 +00:00
Roman Divacky
9a8a680ed2 Error on all .code* directives instead of just .code16 as they
all lead to a silent miscompilation of code.

llvm-svn: 124603
2011-01-31 20:56:49 +00:00
Roman Divacky
82612f08c2 Error on .code16 instead of producing wrong (32bit) code.
llvm-svn: 124498
2011-01-28 19:29:48 +00:00
Roman Divacky
c6a20d1728 Add support for parsing .float
llvm-svn: 124485
2011-01-28 14:20:32 +00:00
Nico Weber
66fd0e8119 PR8951: Support for .equiv in integrated assembler, patch by Jörg Sonnenberger!
llvm-svn: 124467
2011-01-28 03:04:41 +00:00
Roman Divacky
f817c82cf3 Add support for specifying register name in cfi-register/offset/def
as well as register number.

llvm-svn: 124379
2011-01-27 17:16:37 +00:00
Bill Wendling
195d8c3988 Add support for parsing a Real value. It stores the Real value as its binary
encoding. It's up to the individual back-ends to convert it to their preferred
representation when printing.

llvm-svn: 124229
2011-01-25 21:26:41 +00:00
Rafael Espindola
ead58a5259 Handle strings in section names the same way as gas:
* If the name is a single string, we remove the quotes
* If the name starts without a quote, we include any quotes in the name

llvm-svn: 124127
2011-01-24 18:02:54 +00:00
Rafael Espindola
547873da60 Add support for the --noexecstack option.
llvm-svn: 124077
2011-01-23 17:55:27 +00:00
Rafael Espindola
14333be1af Add support for lowercase variants.
llvm-svn: 124071
2011-01-23 16:11:25 +00:00
Rafael Espindola
aefd549139 Delay the creation of eh_frame so that the user can change the defaults.
Add support for SHT_X86_64_UNWIND.

llvm-svn: 124059
2011-01-23 05:43:40 +00:00
Rafael Espindola
492ad6ca06 Remove more duplicated code.
llvm-svn: 124056
2011-01-23 04:43:11 +00:00
Rafael Espindola
59c1246cee Remove duplicated code.
llvm-svn: 124054
2011-01-23 04:28:49 +00:00
Jim Grosbach
868d2877dc Make sure to propogate the error code when we fail to parse a modifier.
llvm-svn: 123857
2011-01-19 23:06:07 +00:00
Anton Korobeynikov
aeeec825cd Use common style for .cfi directives
llvm-svn: 123472
2011-01-14 21:57:39 +00:00
Evan Cheng
0cdd5547f1 Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.
- Fixed :upper16: fix up routine. It should be shifting down the top 16 bits first.
- Added support for Thumb2 :lower16: and :upper16: fix up.
- Added :upper16: and :lower16: relocation support to mach-o object writer.

llvm-svn: 123424
2011-01-14 02:38:49 +00:00
Evan Cheng
579f2b17bf Add comment about Thumb2 fixup comments being completely bogus.
llvm-svn: 123411
2011-01-13 23:27:39 +00:00
Evan Cheng
cf9949ddbd Relax an assertion. On archs like ARM, an immediate field may be scattered. So it's possible for some bits of every 8 bits to be encoded already, and the rest still needs to be fixed up.
llvm-svn: 123403
2011-01-13 21:45:26 +00:00
Evan Cheng
cc474b4864 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
3b5ac1631f Style clean up - break up the breaks.
llvm-svn: 123347
2011-01-13 00:07:51 +00:00
Jason W Kim
ae183f9862 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
cf5967630b 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
e223c0aa14 Fix PR8878.
llvm-svn: 122658
2011-01-01 19:05:35 +00:00
Benjamin Kramer
c84434924f Make a bunch of symbols internal.
llvm-svn: 122642
2010-12-30 22:34:44 +00:00
Daniel Dunbar
9ee74282a6 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
7b1b3f5d82 Correctly encode pcrel|indirect.
llvm-svn: 122624
2010-12-29 04:31:26 +00:00
Rafael Espindola
ed7b5659d4 Remove second return.
llvm-svn: 122616
2010-12-29 02:42:33 +00:00
Rafael Espindola
0408a378e9 Fix bug when trying to output uint16_t or uint32_t.
llvm-svn: 122615
2010-12-29 02:30:49 +00:00
Rafael Espindola
d51ed1fc6a 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
257de5c4a2 Implement cfi_def_cfa_register.
llvm-svn: 122612
2010-12-29 00:26:06 +00:00
Rafael Espindola
061209eaf3 Initial .cfi_offset implementation.
llvm-svn: 122611
2010-12-29 00:09:59 +00:00
Rafael Espindola
d93ec3572d Don't produce a "DW_CFA_advance_loc 0".
llvm-svn: 122609
2010-12-28 23:38:03 +00:00
Rafael Espindola
3fdd045643 Implement .cfi_remember_state and .cfi_restore_state.
llvm-svn: 122602
2010-12-28 18:36:23 +00:00
Benjamin Kramer
5acd47c674 Cast away "comparison between signed and unsigned integer" warnings.
llvm-svn: 122598
2010-12-28 13:52:52 +00:00
Duncan Sands
4799c69192 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
c97d642bf7 Relax address updates in the eh_frame section.
llvm-svn: 122591
2010-12-28 05:39:27 +00:00
Rafael Espindola
0552cb0638 Start adding basic support for emitting the call frame instructions.
llvm-svn: 122590
2010-12-28 04:15:37 +00:00
Rafael Espindola
12c30aed07 Add support for .cfi_lsda.
llvm-svn: 122584
2010-12-27 15:56:22 +00:00
Daniel Dunbar
2d0cf8e149 MC/Mach-O/Thumb: Select appropriate relocation types for Thumb.
llvm-svn: 122583
2010-12-27 14:49:49 +00:00
Rafael Espindola
7f947794d7 Handle reloc_riprel_4byte_movq_load. Should make the bots happy.
llvm-svn: 122579
2010-12-27 02:03:24 +00:00
Rafael Espindola
e7e67fce10 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
e9e6794917 Fix .cfi_personality on 32 bit systems.
llvm-svn: 122570
2010-12-26 22:47:37 +00:00
Rafael Espindola
2ebe553431 Add support for @note. Patch by Jörg Sonnenberger.
llvm-svn: 122568
2010-12-26 21:30:59 +00:00
Rafael Espindola
99f1527316 Add basic support for .cfi_personality.
llvm-svn: 122566
2010-12-26 20:20:31 +00:00
Chris Lattner
2129ce0891 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
b2e09adc62 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
592854a10a MC/Mach-O/ARM: Start handling some Thumb branches.
llvm-svn: 122547
2010-12-24 16:41:46 +00:00
Kevin Enderby
ff7e68c5e7 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
9e462b3734 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
3897d5e658 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
81ac7c5fad 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
e6ec0e7149 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
6baac40d13 Revert r122359 while I debug PR8845.
llvm-svn: 122427
2010-12-22 19:05:49 +00:00
Matt Beaumont-Gay
2a54f466cf Fix another conditional expression mismatched enum type warning.
llvm-svn: 122419
2010-12-22 18:25:55 +00:00
Daniel Dunbar
cb8ac619a2 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
63f7a3a108 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
985567aebc 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
d85743ca7a MC/Mach-O/ARM: Recognize generic _Data_N fixup kinds.
llvm-svn: 122408
2010-12-22 16:32:37 +00:00
Daniel Dunbar
e44a2c1166 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
55eff2421b MC/Mach-O/ARM: Fix thinko.
llvm-svn: 122406
2010-12-22 16:19:20 +00:00
Rafael Espindola
c05eac148d Use references and simplify.
llvm-svn: 122405
2010-12-22 16:11:57 +00:00
Rafael Espindola
7c995a90fc Simplify the handling of .size expressions.
llvm-svn: 122404
2010-12-22 16:03:00 +00:00
Daniel Dunbar
17e19b2d45 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
8db4843cd3 Simplify.
llvm-svn: 122401
2010-12-22 13:49:56 +00:00
Daniel Dunbar
bc2bf96e91 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
b03146b50a 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
a1091c31ba Simplify EvaluateAsAbsolute now that EvaluateAsRelocatableImpl does all
the folding it can.

llvm-svn: 122359
2010-12-21 20:51:42 +00:00
Rafael Espindola
3d9afa3c44 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
1c98bbd915 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
e0e966982a 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
42b3eee794 Set the value of absolute symbols.
llvm-svn: 122268
2010-12-20 21:14:39 +00:00
Nick Lewycky
c85935836b Add missing standard headers. Patch by Joerg Sonnenberger!
llvm-svn: 122193
2010-12-19 20:43:38 +00:00
Rafael Espindola
894b34478f Fixed version of 122160 (the previous one would fold undefined symbols).
llvm-svn: 122167
2010-12-19 04:18:56 +00:00
Rafael Espindola
702b7a3b37 Revert 122160 while I debug it.
llvm-svn: 122165
2010-12-19 03:22:05 +00:00
Rafael Espindola
50fd4aa80f Move all folding to AttemptToFoldSymbolOffsetDifference.
llvm-svn: 122160
2010-12-19 02:15:04 +00:00
Roman Divacky
ed5bb14415 Add support for lexing single quotes like 'c'.
This fixed 8615.

llvm-svn: 122150
2010-12-18 08:56:37 +00:00
Rafael Espindola
df98fb74f6 Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
llvm-svn: 122148
2010-12-18 06:27:54 +00:00
Rafael Espindola
7f9be9e112 Remove the MCObjectFormat class.
llvm-svn: 122147
2010-12-18 05:37:28 +00:00
Rafael Espindola
0b15443dd3 Add a FIXME and explain a hack.
llvm-svn: 122144
2010-12-18 04:19:20 +00:00
Rafael Espindola
b8369170e9 Fix the note.
llvm-svn: 122139
2010-12-18 04:01:45 +00:00
Rafael Espindola
f3aeaaa3f4 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
9a4bfd7755 Move some data to the TargetWriter.
llvm-svn: 122134
2010-12-18 03:27:34 +00:00
Owen Anderson
900ac27338 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
3da3498b0a Store and free the TargetObjectWriter.
llvm-svn: 122070
2010-12-17 18:01:31 +00:00
Rafael Espindola
b9ca29bc1c Stub out explicit MCELFObjectTargetWriter interface.
llvm-svn: 122067
2010-12-17 17:45:22 +00:00
Rafael Espindola
38e6fdfd1d Move createELFObjectWriter to its own header.
llvm-svn: 122064
2010-12-17 16:59:53 +00:00
Rafael Espindola
709ffb7084 Use getFixupKindInfo to implement isFixupKindPCRel, ELF version.
llvm-svn: 122050
2010-12-17 07:28:17 +00:00
Daniel Dunbar
1f9fd0b79b 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
6979fc1057 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