Commit Graph

2913 Commits

Author SHA1 Message Date
Pete Cooper
b2faffd63a Fix crash in MCExpr::print.
Symbols are no longer required to be named, but this leads to a crash here if an
unnamed symbol checks that its first character is '$'.

Change the code to first check for a name, then check its first character.

No test case i'm afraid as this is debugging code, but any test case with temp labels
and 'llc --debug --filetype=obj' would have crashed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238579 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:19:11 +00:00
Reid Kleckner
16e4a624c4 [WinEH] Emit EH tables for __CxxFrameHandler3 on 32-bit x86
Small (really small!) C++ exception handling examples work on 32-bit x86
now.

This change disables the use of .seh_* directives in WinException when
CFI is not in use. It also uses absolute symbol references in the tables
instead of imagerel32 relocations.

Also fixes a cache invalidation bug in MMI personality classification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:00:57 +00:00
Rafael Espindola
616c7afb70 Simplify now that symbols contain the correct section.
The complexity in here was because before r233995 variable symbols would report
the incorrect section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 15:07:27 +00:00
Rafael Espindola
3b08750746 Fix ELFObjectWriter::isLocal for signature symbols.
And with that simplify the logic for inserting them in ExternalSymbolData or
LocalSymbolData.

No functionality change overall since the old code avoided the isLocal bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 14:20:40 +00:00
Rafael Espindola
fb48de619e Don't special case undefined symbol when deciding the symbol order.
ELF has no restrictions on where undefined symbols go relative to other defined
symbols. In fact, gas just sorts them together. Do the same.

This was there since r111174 probably just because the MachO writer has it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:59:34 +00:00
Rafael Espindola
9886da621d Remove a trivial forwarding function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:36:02 +00:00
Rafael Espindola
db8eb52635 Inline trivial method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:53:09 +00:00
Daniel Sanders
1348f57925 Revert r238427 - [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
It caused a smaller number of failures than the previous attempt at committing but still caused a couple on the llvm-linux-mips builder. Reverting while I investigate the remainder.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:30:32 +00:00
Rafael Espindola
c66c8e7730 Remove structure field that can be computed just before use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:25:29 +00:00
Rafael Espindola
f3344cdffb Avoid warnings when building without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:19:31 +00:00
Rafael Espindola
7978ab3ad9 Move these vectors to the only function where they are used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238477 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:11:34 +00:00
Rafael Espindola
86c0a109d8 Merge redundant loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:00:13 +00:00
Rafael Espindola
48f886b9de Simplify LastLocalSymbolIndex computation. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:46:36 +00:00
Rafael Espindola
b665c2b05e Use range loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:43:20 +00:00
Rafael Espindola
24441414a3 Remove temporary FileSymbolData. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:29:15 +00:00
Colin LeMahieu
58dd70dced [llvm] Parameterizing the output stream for dumpbytes and outputting directly to stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:50 +00:00
Rafael Espindola
fd64e0f71a Use range loops for accessing file names. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:03:20 +00:00
Rafael Espindola
b9ffeb0979 Merge computeSymbolTable and writeSymbolTable.
For now this just saves a few loops, but it will allow more simplifications
in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 17:54:01 +00:00
Rafael Espindola
c4e38f605e Don't create an unused _GLOBAL_OFFSET_TABLE_.
This was a bug for bug compatibility with gas that is completely unnecessary.
If a _GLOBAL_OFFSET_TABLE_ symbol is used, it will already be created by
the time we get to the ELF writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 15:20:00 +00:00
Daniel Sanders
8bf191d139 [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

Differential Revision: http://reviews.llvm.org/D9669



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 14:52:15 +00:00
Benjamin Kramer
7f4bf08286 [MC] Replace custom string join function with the one from StringExtras.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:45:32 +00:00
Benjamin Kramer
24bccaf9f9 Don't call utostr in Twine/raw_ostream contexts.
Creating temporary std::strings there is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:24:24 +00:00
Rafael Espindola
792e158397 Rename and move getCurrentSectionData.
I think this concludes the merge of MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 21:04:14 +00:00
Rafael Espindola
41cea417fa There is only one current section.
Both MCStreamer and MCObjectStreamer were maintaining a current section
variable and they were slightly out of sync. I don't think this was observable,
but was inefficient and error prone.

Changing this requires a few cascading changes:

* SwitchSection has to call ChangeSection earlier for ChangeSection to see
  the old section.
* With that change, ChangeSection cannot call EmitLabel, since during
  ChangeSection we are still in the old section.
* When the object streamer requires a begin label, just reused the existing
  generic support for begin labels instead of calling EmitLabel directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 20:52:32 +00:00
Rafael Espindola
3e6e3602d5 Fix NDEBUG build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238332 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 15:18:34 +00:00
Rafael Espindola
899cab6126 Delete MCSectionData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 15:14:11 +00:00
Rafael Espindola
b167996819 Delete dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:55:09 +00:00
Rafael Espindola
7e5614efc2 Stop using MCSectionData in WinCOFFObjectWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:45:54 +00:00
Rafael Espindola
1da0f919d5 clang-format WinCOFFObjectWriter.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238328 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:37:12 +00:00
Rafael Espindola
faf287243a Remove uses of MCSectionData from MachObjectWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238327 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:33:39 +00:00
Rafael Espindola
919ce81d38 Move getSubsectionInsertionPoint to MCSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 13:37:28 +00:00
Rafael Espindola
a287fe7fa0 Remove uses of MCSectionData from ELFObjectWriter. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238317 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 13:30:50 +00:00
Rafael Espindola
eac1f66427 Use operator<< instead of print in a few more places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 13:05:42 +00:00
Rafael Espindola
baaf8b82c3 We always have an InstPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 12:13:06 +00:00
Daniel Sanders
3a9cbffdcb Revert r238190 and r238197: [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
This broke the llvm-mips-linux builder and several of our out-of-tree builders.
Initial investigations show that the commit probably isn't the problem but
reverting anyway while I investigate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238302 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 08:44:01 +00:00
Matthias Braun
299e50237a MCSymbol: Make print() robust against empty names
This shouldn't happen, but it's nice not to abort when printing broken machine
functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 05:12:37 +00:00
Rafael Espindola
b14ebd6a1d Replace getOrCreateSectionData with registerSection.
There is now no SectionData to be created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238208 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 15:07:25 +00:00
Rafael Espindola
7ff8c5c348 Have getCurrentSectionData return a MCSection.
I will fix the name shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 14:48:11 +00:00
Rafael Espindola
da68b18db5 Pass a MCSection to getCurrentSectionData.
A step towards merging MCSection and MCSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238203 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 14:42:52 +00:00
Michael Kuperstein
d714fcf5c8 Use std::bitset for SubtargetFeatures.
Previously, subtarget features were a bitfield with the underlying type being uint64_t. 
Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset.
No functional change.

The first several times this was committed (e.g. r229831, r233055), it caused several buildbot failures.
Apparently the reason for most failures was both clang and gcc's inability to deal with large numbers (> 10K) of bitset constructor calls in tablegen-generated initializers of instruction info tables. 
This should now be fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 10:47:10 +00:00
Daniel Sanders
bda72d8098 [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

This commit uses DW_EH_PE_sdata8 for N64 as far as is possible at the moment.
However, it is possible to end up with DW_EH_PE_sdata4 when a TargetMachine is
not available. There's no risk of issues with inconsistency here since the
tables are self describing but it does mean there is a small chance of the
PC-relative offset being out of range for particularly large programs.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

Differential Revision: http://reviews.llvm.org/D9669


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 10:19:18 +00:00
Rafael Espindola
2224f64c6d Remove most uses of MCSectionData from MCAssembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238172 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 02:17:21 +00:00
Rafael Espindola
ea3533b4c6 Stop using MCSectionData in MCAsmLayout.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 02:00:36 +00:00
Rafael Espindola
eac71e23fd Move MCSection destruction to MCContext::reset.
Fixes the leaks when running llc.

Also found by an asan bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238167 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 01:52:19 +00:00
Rafael Espindola
1826cd69f3 Stop using MCSectionData in MCMachObjectWriter.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 01:15:30 +00:00
Rafael Espindola
504473e6ae Stop using MCSectionData in MCExpr.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:52:18 +00:00
Rafael Espindola
f363960679 Return a MCSection from MCFragment::getParent().
Another step in merging MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:36:57 +00:00
Rafael Espindola
be38d7cb8c Call the destructors of the MCSections.
They now contain the fragments. If we don't call the destructors the
fragments leak.

Found by an asan bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238161 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:32:28 +00:00
Rafael Espindola
68e7d22de4 Store a MCSection in MCFragment.
Part of the work to merge MCSectionData into MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 23:48:22 +00:00
Rafael Espindola
e86bc46939 Turn MCSectionData into a field of MCSection.
This also changes MCAssembler to store a vector of MCSections instead of an
iplist of MCSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238159 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 23:14:17 +00:00