1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

2957 Commits

Author SHA1 Message Date
Jim Grosbach
39b6b1defc MC: Clean up the naming for MCMachObjectWriter. NFC.
s/ExecutePostLayoutBinding/executePostLayoutBinding/
s/ComputeSymbolTable/computeSymbolTable/
s/BindIndirectSymbols/bindIndirectSymbols/
s/RecordTLVPRelocation/recordTLVPRelocation/
s/RecordScatteredRelocation/recordScatteredRelocation/
s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/
s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/
s/WriteNlist/writeNlist/
s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/
s/WriteSymtabLoadCommand/writeSymtabLoadCommand/
s/WriteSection/writeSection/
s/WriteSegmentLoadCommand/writeSegmentLoadCommand/
s/WriteHeader/writeHeader/

llvm-svn: 239119
2015-06-04 23:25:54 +00:00
Jim Grosbach
e76e79548b MC: Clean up naming in MCObjectWriter. NFC.
s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

llvm-svn: 239108
2015-06-04 22:24:41 +00:00
Benjamin Kramer
91499ad655 [MachOWriter] Use for-range and roll some duplicated code into loops.
No functionality change intended.

llvm-svn: 239096
2015-06-04 21:17:27 +00:00
Rafael Espindola
82da927483 Remove unused argument. NFC.
llvm-svn: 239092
2015-06-04 20:55:49 +00:00
Jim Grosbach
3a8310cc67 MC: Remove obsolete MachO UseAggressiveSymbolFolding.
Fix the FIXME and remove this old as(1) compat option. It was useful for
bringup of the integrated assembler to diff object files, but now it's
just causing more relocations than strictly necessary to be generated.

rdar://21201804

llvm-svn: 239084
2015-06-04 20:27:42 +00:00
Gabor Ballabas
b3a8428737 Test commit access.
Fix trailing whitespace.

llvm-svn: 239058
2015-06-04 17:30:26 +00:00
Rafael Espindola
e4278af625 Omit unused section symbols from the symbol table.
Section symbols exist as an optimization: instead of having multiple relocations
point to different symbols, many of them can point to a single section symbol.

When that optimization is unused, a section symbol is also unused and adds no
extra information to the object file.

This saves a bit of space on the object files and makes the output of
llvm-objdump -t easier to read and consequently some tests get quite a bit
simpler.

llvm-svn: 239045
2015-06-04 15:33:30 +00:00
Rafael Espindola
58fdd31cd1 Bring back r239006 with a fix.
The fix is just that getOther had not been updated for packing the st_other
values in fewer bits and could return spurious values:

-  unsigned Other = (getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
+  unsigned Other = (getFlags() & (0x7 << ELF_STO_Shift)) >> ELF_STO_Shift;

Original message:

Pack the MCSymbolELF bit fields into MCSymbol's Flags.

This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

llvm-svn: 239012
2015-06-04 05:59:23 +00:00
Rafael Espindola
ab39f50035 Revert "Pack the MCSymbolELF bit fields into MCSymbol's Flags."
This reverts commit r239006.

I am debugging the powerpc failures.

llvm-svn: 239010
2015-06-04 05:00:12 +00:00
Rafael Espindola
e2a1190807 Pack the MCSymbolELF bit fields into MCSymbol's Flags.
This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

llvm-svn: 239006
2015-06-04 02:32:20 +00:00
Rafael Espindola
f7db6d4a8a Remove MCELFSymbolFlags.h. It is now internal to MCSymbolELF.
llvm-svn: 238996
2015-06-04 00:47:43 +00:00
Rafael Espindola
2e73b12f3d Remember if a weakref of a symbol has been used.
This avoids yet another last minute patching of the binding.

While at it, also simplify the weakref implementation a bit by not walking
past it in the expression evaluation.

llvm-svn: 238982
2015-06-03 21:52:06 +00:00
Rafael Espindola
d8f4abb370 Store whether a symbol is a comdat signature in MCSymbolELF.
With this getBinging can now return the correct answer for all cases not
involving a .symver and the elf writer doesn't need to patch it last minute.

llvm-svn: 238980
2015-06-03 21:41:59 +00:00
Rafael Espindola
556c09100f Record in a MCSymbolELF if it has been used in a relocation.
No functionality change, just saves an on the side map.

llvm-svn: 238979
2015-06-03 21:30:10 +00:00
Rafael Espindola
5d6d3e1b4d Simplify the logic in ELFObjectWriter::isInSymtab. NFC.
_GLOBAL_OFFSET_TABLE_ is not magical and we can now directly check for a
symbol never getting an explicit binding.

llvm-svn: 238978
2015-06-03 21:23:21 +00:00
Rafael Espindola
63813d4589 Convert BindingExplicitlySet into a MCSymbolELF field.
I will pack it better in a followup patch.

llvm-svn: 238975
2015-06-03 21:18:03 +00:00
Rafael Espindola
821a91ff77 Clarify when we can avoid creating names for temp symbols.
Some temporary symbols are created by MC itself. These symbols are never used
for lookup and are never included in the object symbol table, so we can
avoid creating a name for them.

Other temporaries are created by CodeGen or by the user by explicitly asking
for a name starting with .L (or L on MachO).

These temporaries behave like regular symbols, we just try to avoid including
them in the object symbol table, but sometimes they end up there:

const char *foo() {
  return "abc" + 3;
}

will have a relocation pointing to a .L symbol.

It just so happens that almost all MC created temporary has the AlwaysAddSuffix
option and CodeGen/user created ones don't.

One interesting future optimization would be to use unnamed symbols for
all temporaries, but that would require use an st_name of 0 or
having the object writer create the names if a symbol does end up in the
symbol table.

No testcase since this just avoid creating a few extra names for MC created
temporaries.

llvm-svn: 238887
2015-06-02 22:52:13 +00:00
Rafael Espindola
2e71400006 Pass a MCSymbolELF to a few ELF only functions. NFC.
llvm-svn: 238868
2015-06-02 21:30:13 +00:00
Rafael Espindola
1fc8198d33 Merge MCELF.h into MCSymbolELF.h.
Now that we have a dedicated type for ELF symbol, these helper functions can
become member function of MCSymbolELF.

llvm-svn: 238864
2015-06-02 20:38:46 +00:00
Daniel Sanders
eca59314c9 [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.

Previous attempts at committing this broke the buildbots due to bugs in IAS.
These bugs have now been fixed so trying again.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

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

llvm-svn: 238863
2015-06-02 20:32:50 +00:00
Rafael Espindola
f9aa800569 Create a MCSymbolELF.
This create a MCSymbolELF class and moves SymbolSize since only ELF
needs a size expression.

This reduces the size of MCSymbol from 56 to 48 bytes.

llvm-svn: 238801
2015-06-02 00:25:12 +00:00
Jim Grosbach
0403ba02bc MC: Tidy up LOH naming a bit. NFC.
llvm-svn: 238800
2015-06-01 23:55:06 +00:00
Rafael Espindola
6524f4a546 The fragment implies the section, don't store both.
This reduces MCSymbol from 64 to 56 bytes on x86_64.

llvm-svn: 238747
2015-06-01 14:34:40 +00:00
David Majnemer
5ab2bd121b [WinCOFF] Ignore .safeseh for non-x86 architectures
We don't want to bother with creating .sxdata sections on Win64; all the
relevant information is already in the .pdata section.

llvm-svn: 238730
2015-06-01 07:34:26 +00:00
Rafael Espindola
2dada5337b Rename HasData to IsRegistered.
There is no MCSectionData, so the old name is now meaningless.

Also remove some asserts/checks that were there just because the information
they used was in MCSectionData.

llvm-svn: 238708
2015-06-01 01:52:18 +00:00
Rafael Espindola
a2bccb49b3 Remove trivial forwarding function.
llvm-svn: 238707
2015-06-01 01:39:15 +00:00
Rafael Espindola
b789b9f175 Store a bit in MCSection saying if it was registered with MCAssembler.
With this we can replace a SetVector with a plain std::vector.

llvm-svn: 238706
2015-06-01 01:30:01 +00:00
Rafael Espindola
26cbe76486 Use a bitfield. NFC.
llvm-svn: 238705
2015-06-01 01:05:07 +00:00
Benjamin Kramer
bccd30ee34 [MC] Simplify code. No functionality change intended.
llvm-svn: 238676
2015-05-31 18:49:28 +00:00
Colin LeMahieu
8b4d5b0298 [MC] Allow backends to decide relaxation for unresolved fixups.
Differential Revision: http://reviews.llvm.org/D8217

llvm-svn: 238659
2015-05-30 18:42:22 +00:00
David Majnemer
4c20c6ffa9 [WinCOFF] Add support for the .safeseh directive
.safeseh adds an entry to the .sxdata section to register all the
appropriate functions which may handle an exception.  This entry is not
a relocation to the symbol but instead the symbol table index of the
function.

llvm-svn: 238641
2015-05-30 04:56:02 +00:00
Jim Grosbach
30efd68a58 MC: Clean up MCExpr naming. NFC.
llvm-svn: 238634
2015-05-30 01:25:56 +00:00
Rafael Espindola
27d0b57917 Remove getData.
This completes the mechanical part of merging MCSymbol and MCSymbolData.

llvm-svn: 238617
2015-05-29 21:45:01 +00:00
Rafael Espindola
b365b7fead Remove the MCSymbolData typedef.
The getData member function is next.

llvm-svn: 238611
2015-05-29 20:41:47 +00:00
Rafael Espindola
d8fde42970 Merge MCSymbol and MCSymbolData.
As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be
removing that in a second.

llvm-svn: 238609
2015-05-29 20:31:23 +00:00
Rafael Espindola
caf32aa8f6 Rename getOrCreateSymbolData to registerSymbol and return void.
Another step in merging MCSymbol and MCSymbolData.

llvm-svn: 238607
2015-05-29 20:21:02 +00:00
Benjamin Kramer
0e31955b32 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238602
2015-05-29 19:43:39 +00:00
Rafael Espindola
f5a21976c3 Move Flags from MCSymbolData to MCSymbol.
llvm-svn: 238598
2015-05-29 19:07:51 +00:00
Rafael Espindola
144bb0a67a Fix build without asserts.
llvm-svn: 238597
2015-05-29 19:04:38 +00:00
Rafael Espindola
d72e3e8f02 Pass MCSymbols to the helper functions in MCELF.h.
llvm-svn: 238596
2015-05-29 18:47:23 +00:00
Rafael Espindola
72bab9e25e Pass a MCSymbol to needsRelocateWithSymbol.
llvm-svn: 238589
2015-05-29 18:26:09 +00:00
Rafael Espindola
757c374655 Move common symbol related information from MCSectionData to MCSymbol.
llvm-svn: 238583
2015-05-29 17:48:04 +00:00
Rafael Espindola
3630b71760 Store MCSymbols in PendingLabels.
llvm-svn: 238582
2015-05-29 17:41:59 +00:00
Rafael Espindola
7ec1caedd1 Move SymbolSize from MCSymbolData to MCSymbol.
llvm-svn: 238580
2015-05-29 17:24:52 +00:00
Pete Cooper
d797e8039e 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.

llvm-svn: 238579
2015-05-29 17:19:11 +00:00
Reid Kleckner
8db67f8118 [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.

llvm-svn: 238575
2015-05-29 17:00:57 +00:00
Rafael Espindola
150d0a1719 Simplify now that symbols contain the correct section.
The complexity in here was because before r233995 variable symbols would report
the incorrect section.

llvm-svn: 238559
2015-05-29 15:07:27 +00:00
Rafael Espindola
2ea0919069 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.

llvm-svn: 238555
2015-05-29 14:20:40 +00:00
Rafael Espindola
c79576b357 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.

llvm-svn: 238513
2015-05-28 21:59:34 +00:00
Rafael Espindola
be6f69a9cc Remove a trivial forwarding function. NFC.
llvm-svn: 238506
2015-05-28 21:36:02 +00:00