Rafael Espindola
a32d0e9ec0
Delete MCSectionData.
...
llvm-svn: 238331
2015-05-27 15:14:11 +00:00
Rafael Espindola
e15b1b766e
Remove uses of MCSectionData from ELFObjectWriter. NFC.
...
llvm-svn: 238317
2015-05-27 13:30:50 +00:00
Rafael Espindola
64acc7fcc7
Remove most uses of MCSectionData from MCAssembler.
...
llvm-svn: 238172
2015-05-26 02:17:21 +00:00
Rafael Espindola
5a1e80bc43
Stop using MCSectionData in MCAsmLayout.h.
...
llvm-svn: 238170
2015-05-26 02:00:36 +00:00
Rafael Espindola
7549f87672
Return a MCSection from MCFragment::getParent().
...
Another step in merging MCSectionData and MCSection.
llvm-svn: 238162
2015-05-26 00:36:57 +00:00
Rafael Espindola
a554c05d95
Turn MCSectionData into a field of MCSection.
...
This also changes MCAssembler to store a vector of MCSections instead of an
iplist of MCSectionData.
llvm-svn: 238159
2015-05-25 23:14:17 +00:00
Rafael Espindola
08850b3a88
Make a few MCSectionELF& variables const. NFC.
...
This just reduces the noise from another patch.
llvm-svn: 238156
2015-05-25 21:56:55 +00:00
Rafael Espindola
5960cee1f5
Produce a single string table in a ELF .o
...
Normally an ELF .o has two string tables, one for symbols, one for section
names.
With the scheme of naming sections like ".text.foo" where foo is a symbol,
there is a big potential saving in using a single one.
Building llvm+clang+lld with master and with this patch the results were:
master: 193,267,008 bytes
patch: 186,107,952 bytes
master non unique section names: 183,260,192 bytes
patch non unique section names: 183,118,632 bytes
So using non usique saves 10,006,816 bytes, and the patch saves 7,159,056 while
still using distinct names for the sections.
llvm-svn: 238073
2015-05-22 23:58:30 +00:00
Duncan P. N. Exon Smith
1247bbd82a
MC: Lift MCSymbolData::Index up to MCSymbol::Index, NFC
...
Lift `MCSymbolData::Index` up a level to `MCSymbol`, as preparation for
packing it into the bitfield in `MCSymbol`.
llvm-svn: 238001
2015-05-22 05:54:01 +00:00
Rafael Espindola
967d6a6914
Stop forwarding (get|set)Aligment from MCSectionData to MCSection.
...
llvm-svn: 237956
2015-05-21 21:02:35 +00:00
Rafael Espindola
0a82ad798c
Stop creating MCSectionData is the ELF writer.
...
Now is is just its use of MCSymbolData that requires it to take a non const
MCAssembler.
llvm-svn: 237951
2015-05-21 20:43:13 +00:00
Rafael Espindola
883dec058f
writeSymbolTable now only needs a MCContext.
...
It used to use an MCAssembler just to record the alignment of the sections.
llvm-svn: 237944
2015-05-21 19:54:44 +00:00
Rafael Espindola
1aa20fcb41
Pass a const MCAssembler to writeSectionHeader.
...
It never creates sections, so it can use Asm.getSectionData instead of
Asm.getOrCreateSectionData.
llvm-svn: 237943
2015-05-21 19:46:39 +00:00
Rafael Espindola
e92c1bfa4b
Remove unused argument. NFC.
...
llvm-svn: 237940
2015-05-21 19:42:35 +00:00
Rafael Espindola
286875874a
Fetch alignment directly out of MCSection. NFC.
...
llvm-svn: 237938
2015-05-21 19:36:43 +00:00
Rafael Espindola
0709a7bd1a
Move alignment from MCSectionData to MCSection.
...
This starts merging MCSection and MCSectionData.
There are a few issues with the current split between MCSection and
MCSectionData.
* It optimizes the the not as important case. We want the production
of .o files to be really fast, but the split puts the information used
for .o emission in a separate data structure.
* The ELF/COFF/MachO hierarchy is not represented in MCSectionData,
leading to some ad-hoc ways to represent the various flags.
* It makes it harder to remember where each item is.
The attached patch starts merging the two by moving the alignment from
MCSectionData to MCSection.
Most of the patch is actually just dropping 'const', since
MCSectionData is mutable, but MCSection was not.
llvm-svn: 237936
2015-05-21 19:20:38 +00:00
Duncan P. N. Exon Smith
5266ad9bec
MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC
...
Continue to prefer `MCSymbol` when we need both.
llvm-svn: 237798
2015-05-20 15:10:03 +00:00
Duncan P. N. Exon Smith
469f9dbdb9
MC: Use MCSymbol in most of ELFObjectWriter, NFC
...
Stop using MCSymbolData where we also need MCSymbol.
llvm-svn: 237770
2015-05-20 04:39:01 +00:00
Duncan P. N. Exon Smith
2a40483418
MC: Use MCSymbol in MCAsmLayout::getSymbolOffset(), NFC
...
Continue to canonicalize on MCSymbol instead of MCSymbolData when both
are needed.
llvm-svn: 237749
2015-05-19 23:53:20 +00:00
Jim Grosbach
6f482000e9
MC: Clean up method names in MCContext.
...
The naming was a mish-mash of old and new style. Update to be consistent
with the new. NFC.
llvm-svn: 237594
2015-05-18 18:43:14 +00:00
Duncan P. N. Exon Smith
d81ba532ed
MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()
...
Transition one API from `MCSymbolData` to `MCSymbol`. The function
needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is
going away.
llvm-svn: 237498
2015-05-16 01:01:55 +00:00
Duncan P. N. Exon Smith
f48de1cb7b
MC: Change MCAssembler::Symbols to store MCSymbol, NFC
...
Instead of storing a list of the `MCSymbolData` in use, store the
`MCSymbol`s. Churning in the direction of removing the back pointer
from `MCSymbolData`.
llvm-svn: 237496
2015-05-16 00:35:24 +00:00
Yaron Keren
f3465e10e9
Update ELFObjectWriter::reset() following r236255.
...
llvm-svn: 237261
2015-05-13 15:17:19 +00:00
Rafael Espindola
327fd4a255
Remove unnecessary break.
...
llvm-svn: 236275
2015-04-30 22:41:12 +00:00
Rafael Espindola
868b3f47d2
Simplify the creation of compressed debug sections.
...
This is actually fairly simple in the current code layout: Check if we should
compress just before writing out and everything else just works.
This removes the last case in which the object writer was creating a
fragment.
llvm-svn: 236267
2015-04-30 21:51:58 +00:00
Rafael Espindola
74ef480f8f
Replace unreachable code with llvm_unreachable.
...
llvm-svn: 236261
2015-04-30 21:20:06 +00:00
Rafael Espindola
b186391e2d
Don't create a MCSectionData when we don't have to.
...
llvm-svn: 236260
2015-04-30 21:10:06 +00:00
Rafael Espindola
a001a32c31
Avoid an extra loop over the sections.
...
Add string to the section header string table as we add sections.
llvm-svn: 236257
2015-04-30 20:57:14 +00:00
Rafael Espindola
03d7abbbe5
Make the section table a member of ELFObjectWriter.
...
This avoids passing it around and lets us build a small helper to add
a section to the table.
llvm-svn: 236255
2015-04-30 20:53:27 +00:00
Rafael Espindola
657117f82c
Nothing inherits from this, drop the protected:
...
llvm-svn: 236253
2015-04-30 20:37:36 +00:00
Rafael Espindola
bda1980917
Write sections mostly in one pass.
...
During ELF writing, there is no need to further relax the sections, so we
should not be creating fragments. This patch avoids doing so in all cases
but debug section compression (that is next).
Also, the ELF format is fairly simple to write. We can do a single pass over
the sections to write them out and compute the section header table.
llvm-svn: 236235
2015-04-30 14:21:49 +00:00
Aaron Ballman
9cab732161
Silencing an "enumeral and non-enumeral type in conditional expression" warning; NFC.
...
llvm-svn: 236234
2015-04-30 14:03:12 +00:00
Rafael Espindola
34948e5e22
Store relocations in a map from MCSectionELF.
...
Saves finding the MCSectionData just to do a map lookup.
llvm-svn: 236189
2015-04-30 00:45:46 +00:00
Rafael Espindola
b8cbb2678f
Write relocations directly to the output stream. NFC.
...
llvm-svn: 236187
2015-04-30 00:30:40 +00:00
Rafael Espindola
59f0e3182d
Inline FragmentWriter into the only user.
...
llvm-svn: 236158
2015-04-29 21:13:30 +00:00
Rafael Espindola
91fd2778b0
Write the symbol table directly to the output file.
...
There is no need to first accumulate it in fragments.
llvm-svn: 236157
2015-04-29 21:09:32 +00:00
Rafael Espindola
8c7829b82f
Use pwrite to write the number of sections.
...
This avoids having to compute the number upfront, which will be used in the
next patch.
llvm-svn: 236153
2015-04-29 20:39:37 +00:00
Rafael Espindola
88abc39d70
Write the string table directly to the output file.
...
There is no need to accumulate it in fragments first.
llvm-svn: 236148
2015-04-29 20:34:31 +00:00
Rafael Espindola
88d1f632cf
Write the section header string table directly to the output stream.
...
Instead of accumulating the content in a fragment first, just write it
to the output stream.
Also put it first in the section table, so that we never have to worry
about its index being >= SHN_LORESERVE.
llvm-svn: 236145
2015-04-29 20:25:24 +00:00
Rafael Espindola
ae7e4995ca
Avoid a few const_cast.
...
llvm-svn: 236141
2015-04-29 19:20:10 +00:00
Rafael Espindola
89feff3b76
Map directly from signature symbol to group index. NFC.
...
llvm-svn: 236058
2015-04-28 22:59:58 +00:00
Rafael Espindola
cf6d5a9f94
Remove redundant temporary std::vector.
...
New sections are added to the end of the list, so the RelSections array was
redundant.
llvm-svn: 236053
2015-04-28 22:26:19 +00:00
Rafael Espindola
41920d0382
Avoid one more walk over all sections. NFC.
...
Set the group section index as they are created.
llvm-svn: 236049
2015-04-28 22:03:22 +00:00
Rafael Espindola
fac3fbc5ff
Use a range loop. NFC.
...
llvm-svn: 236047
2015-04-28 21:58:05 +00:00
Rafael Espindola
8a90d87d76
Avoid an extra walk over the sections just to assign sections to groups.
...
Assign the sections in the same pass we compute the index.
llvm-svn: 236045
2015-04-28 21:52:33 +00:00
Rafael Espindola
55a3afb418
Remove the GroupMapTy DenseMap. NFC.
...
Instead use the Group symbol of MCSectionELF.
llvm-svn: 236033
2015-04-28 21:07:28 +00:00
Rafael Espindola
ad3cfaaa20
Use range loops. NFC.
...
llvm-svn: 236028
2015-04-28 20:23:35 +00:00
Rafael Espindola
e3ff9305cd
Avoid adding to SectionIndexMap sections that we never lookup. NFC.
...
llvm-svn: 236026
2015-04-28 20:09:13 +00:00
Rafael Espindola
163f672cd5
Use a range loop. NFC.
...
llvm-svn: 236015
2015-04-28 19:07:16 +00:00
Rafael Espindola
a820169711
Use a std::vector to record the offsets of the sections. NFC.
...
llvm-svn: 235995
2015-04-28 15:26:21 +00:00