Commit Graph

273624 Commits

Author SHA1 Message Date
Rui Ueyama 1f4d7b56f4 Avoid a pointer to a pointer to an input section.
llvm-svn: 315424
2017-10-11 03:23:29 +00:00
Rui Ueyama ec5c4adbf2 Add comment.
llvm-svn: 315423
2017-10-11 03:23:17 +00:00
Rui Ueyama 2b714b56a9 Split decompressAndMergeSection into two separate functions.
Even though they are called sequentially, they are separate
operations, so it is better to split it.

llvm-svn: 315422
2017-10-11 03:12:53 +00:00
Rui Ueyama b801441ed3 Remove useless cast.
llvm-svn: 315421
2017-10-11 02:55:05 +00:00
Rui Ueyama 04c9ca7408 Rename filename -> getFilename.
llvm-svn: 315420
2017-10-11 02:54:52 +00:00
Rui Ueyama 71f840672d Rename Align -> Alignment.
llvm-svn: 315419
2017-10-11 02:46:09 +00:00
Rui Ueyama 29b240c671 Rename CurAddressState -> Ctx.
We used CurAddressState to capture a dynamic context just like
we use lambdas to capture static contexts. So, CurAddressState
is used everywhere in LinkerScript.cpp. It is worth a shorter
name.

llvm-svn: 315418
2017-10-11 02:45:54 +00:00
Jake Ehrlich d9a283463a Revert "[llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data"
This reverts commit rL315412

llvm-svn: 315417
2017-10-11 02:42:29 +00:00
Rui Ueyama 183aa2731e Make LinkerScript::addSymbol a private member function.
llvm-svn: 315416
2017-10-11 02:28:39 +00:00
Rui Ueyama 5908c2f877 Rename processCommands -> processSectionCommands.
llvm-svn: 315415
2017-10-11 02:28:28 +00:00
Rui Ueyama a80633ca14 Inline small functions.
llvm-svn: 315414
2017-10-11 02:20:00 +00:00
Peter Collingbourne b4f1b88551 WIN32_FIND_DATA -> WIN32_FIND_DATAW.
Should fix mingw bot.

llvm-svn: 315413
2017-10-11 02:09:06 +00:00
Jake Ehrlich b5152447ba [llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data
elf utils implements a particularly extreme form of stripping that I'd
like to support. eu-strip has an option called "strip-sections" that
removes all section headers and leaves only program headers and the
segment data. I have implemented this option partly as a test but mainly
because in Fuchsia we would like to use this option to minimize the size
of our executables. The other strip options that are on my list include
--strip-all and --strip-debug. This is a preliminary implementation that
I'd like to start using in Fuchsia builds if possible. This change
implements such a stripping option for llvm-objcopy

Differential Revision: https://reviews.llvm.org/D38335

llvm-svn: 315412
2017-10-11 01:59:06 +00:00
Lang Hames 492cf98a8a Update cc1as_main for MCAsmBackend ownership change in r315410.
llvm-svn: 315411
2017-10-11 01:58:08 +00:00
Lang Hames 02d330548d [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.
MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that,
and allows us to remove another instance of MCObjectStreamer's weird "holding
ownership via someone else's reference" trick.

llvm-svn: 315410
2017-10-11 01:57:21 +00:00
Rui Ueyama 6b394caaf1 Rename Commands -> SectionCommands.
"Commands" was ambiguous because in the linker script, everything is
a command. We used to handle only SECTIONS commands, and at the time,
it might make sense to call them the commands, but it is no longer
the case. We handle not only SECTIONS but also MEMORY, PHDRS, VERSION,
etc., and they are all commands.

llvm-svn: 315409
2017-10-11 01:50:56 +00:00
Richard Smith 197f68da76 [modules] Fix visibility checking for using declarations via ADL.
We want to check whether the using (shadow) declaration itself is visible, not
whether its target is visible.

llvm-svn: 315408
2017-10-11 01:49:57 +00:00
Kostya Serebryany 4083d54675 [libFuzzer] experimental flag to tweak the corpus distribution. Seems to improve the situation dramatically on the png benchmark and make things worse on a number of micro-puzzles. Needs more A/B testing
llvm-svn: 315407
2017-10-11 01:44:26 +00:00
Reid Kleckner 51b2cd8fb9 Silence MSVC warnings about unsigned wrapping without UB
Of course, casting an unsigned value too large for 'int' is UB. So,
write out the ternary. LLVM folds it to ADD anyway.

Fixes the warning from r303693 a different way.

Thanks to Erich Keane for pointing this out!

llvm-svn: 315406
2017-10-11 01:40:38 +00:00
Rui Ueyama a323e2a722 Rename HasSections -> HasSectionsComand.
HasSections is true if there is at least one SECTIONS linker
script command, and it is not directly related to whether we have
section objects or not. So I think the new name is better.

llvm-svn: 315405
2017-10-11 01:34:51 +00:00
Rui Ueyama 7f1c266e43 Move a loop invariant outside the loop.
llvm-svn: 315404
2017-10-11 01:26:22 +00:00
Rui Ueyama ac27de9dc7 Remove ScriptConfiguration class and move the members to LinkerScript class.
ScriptConfiguration was a class to contain parsed results of
linker scripts. LinkerScript is a class to interpret it.

That ditinction was needed because we haven't instantiated
LinkerScript early (because, IIRC, LinkerScript class was a
ELFT template function). So, when we parse linker scripts,
we couldn't directly store the result to a LinkerScript instance.

Now, that limitation is gone. We instantiate LinkerScript
at the very beginning of our main function. We can directly
store parse results to a LinkerScript instance.

llvm-svn: 315403
2017-10-11 01:19:33 +00:00
Richard Smith b920f85d8e [modules] Only take visible using-directives into account during name lookup.
llvm-svn: 315402
2017-10-11 01:19:11 +00:00
Rui Ueyama 18d19687c8 Inline addRegular into addSymbol.
Because addRegular's functionality is tightly coupled with
addSymbol, and the former is called only once, it makes sense
to merge the two functions. This patch also adds comments.

llvm-svn: 315401
2017-10-11 01:03:37 +00:00
Peter Collingbourne 8a40a7b15c COFF: When generating code for LTO, use static reloc model on 32-bit x86.
Fixes PR34306.

This is because it usually results in more compact code, and because
there are also known code generation bugs when using the PIC model
(see bug).

Based on a patch by Carlo Kok.

Differential Revision: https://reviews.llvm.org/D38769

llvm-svn: 315400
2017-10-11 00:46:58 +00:00
Craig Topper 85b1da1dc4 [X86] Remove temporary std::string creation from shuffle comment printing. We can just write directly to the raw_ostream.
llvm-svn: 315399
2017-10-11 00:46:09 +00:00
Alex Lorenz c1e32fca96 A '<' with a trigraph '#' is not a valid editor placeholder
Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5

rdar://34923985

llvm-svn: 315398
2017-10-11 00:41:20 +00:00
Richard Smith 18057cb34c [Modules TS] Diagnose missing/duplicate module-declaration.
llvm-svn: 315397
2017-10-11 00:36:56 +00:00
Evgeniy Stepanov 922973a466 [sanitizer] Re-disable several tests on Android.
The tests have been enabled by accident in r315389.

llvm-svn: 315396
2017-10-11 00:32:03 +00:00
Craig Topper 6ce20bd184 [X86] Add 128-bit version of vbroadcasti32x2 to shuffle comment decoding.
llvm-svn: 315395
2017-10-11 00:11:53 +00:00
Rui Ueyama 4fbe351817 Remove a constructor from ExprValue. NFC.
I think three ctors are too many for this simple class.

llvm-svn: 315394
2017-10-11 00:06:27 +00:00
Rui Ueyama 41ef17bb3c Add comments.
llvm-svn: 315393
2017-10-11 00:01:49 +00:00
Adrian Prantl f3d9b488bd Include getting generated struct offsets in CodegenABITypes
This change adds a new function, CodeGen::getFieldNumber, that
enables a user of clang's code generation to get the field number
in a generated LLVM IR struct that corresponds to a particular field
in a C struct.

It is important to expose this information in Clang's code generation
interface because there is no reasonable way for users of Clang's code
generation to get this information. In particular:

LLVM struct types do not include field names.
Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.

Patch by Michael Ferguson!

Differential Revision: https://reviews.llvm.org/D38473

llvm-svn: 315392
2017-10-10 23:54:21 +00:00
Justin Bogner fdf9bf4f16 CodeGen: Minor cleanups to use MachineInstr::getMF. NFC
Since r315388 we have a shorter way to say this, so we'll replace
MI->getParent()->getParent() with MI->getMF() in a few places.

llvm-svn: 315390
2017-10-10 23:50:49 +00:00
Evgeniy Stepanov 0bf7717a02 Factor out "stable-runtime" feature and enable it on all android.
This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan
seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android.

llvm-svn: 315389
2017-10-10 23:37:26 +00:00
Justin Bogner ec7cba53e6 CodeGen: Add MachineInstr::getMF(). NFC
Similarly to how Instruction has getFunction, this adds a less verbose
way to write MI->getParent()->getParent(). I'll follow up shortly with
a change that changes a bunch of the uses.

llvm-svn: 315388
2017-10-10 23:34:01 +00:00
Alexander Shaposhnikov 64b4bcfa05 [lldb] Enable using out-of-tree dwps
Previously LLDB required the DWP file 
to be located next to the executable file.
This diff uses the helper function 
Symbols::LocateExecutableSymbolFile to search for 
DWP files in the standard locations for debug symbols.

Test plan:

Build a toy test example:
main.cpp
clang -gsplit-dwarf -g -O0 main.cpp -o main.exe
llvm-dwp -e main.exe -o main.exe.dwp
mkdir -p debug_symbols
mv main.exe.dwp debug_symbols/main.exe.dwp

Run lldb:
lldb
settings set target.debug-file-search-paths ./debug_symbols
file ./main.exe
br set --name f
run

Check that debugging works:
setting breakpoints, printing local variables.

Differential revision: https://reviews.llvm.org/D38568

llvm-svn: 315387
2017-10-10 23:28:34 +00:00
Rui Ueyama ed94f36154 Remove an unused default argument.
llvm-svn: 315386
2017-10-10 23:09:23 +00:00
Jake Ehrlich fcc05627d4 [llvm-objcopy] Add ability to remove multiple sections by name
This change adds the ability to use the "-R"/"-remove-section" option
multiple times.

Differential Revision: https://reviews.llvm.org/D38332

llvm-svn: 315385
2017-10-10 23:02:43 +00:00
Rui Ueyama a1b79dff2a Handle input section liveness only in MarkLive.cpp.
The condition whether a section is alive or not by default
is becoming increasingly complex, so the decision of garbage
collection is spreading over InputSection.h and MarkLive.cpp,
which is not a good state.

This moves the code to MarkLive.cpp, to keep the file the central
place to make decisions about garbage collection.

llvm-svn: 315384
2017-10-10 22:59:32 +00:00
Eugene Zelenko e9ea08a097 [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 315383
2017-10-10 22:49:55 +00:00
Craig Topper bb0e316dc7 [X86] Add broadcast patterns that allow a scalar_to_vector between the broadcast and the load.
We already have these patterns for AVX512VL, but not AVX1 or 2.

llvm-svn: 315382
2017-10-10 22:40:31 +00:00
Richard Smith d97d35e150 [Modules TS] Diagnose attempts to enter module implementation units without the module interface being available.
llvm-svn: 315381
2017-10-10 22:35:27 +00:00
Eugene Zelenko 149178d92b [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 315380
2017-10-10 22:33:29 +00:00
Richard Smith becb92dec8 [Modules TS] Module ownership semantics for redeclarations.
When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

This reinstates r315251 and r315256, reverted in r315309 and r315308
respectively, tweaked to avoid triggering a linkage calculation when declaring
implicit special members (this exposed our pre-existing issue with typedef
names for linkage changing the linkage of types whose linkage has already been
computed and cached in more cases). A testcase for that regression has been
added in r315366.

llvm-svn: 315379
2017-10-10 22:33:17 +00:00
Peter Collingbourne 0dfdb44797 Support: Have directory_iterator::status() return FindFirstFileEx/FindNextFile results on Windows.
This allows clients to avoid an unnecessary fs::status() call on each
directory entry. Because the information returned by FindFirstFileEx
is a subset of the information returned by a regular status() call,
I needed to extract a base class from file_status that contains only
that information.

On my machine, this reduces the time required to enumerate a ThinLTO
cache directory containing 520k files from almost 4 minutes to less
than 2 seconds.

Differential Revision: https://reviews.llvm.org/D38716

llvm-svn: 315378
2017-10-10 22:19:46 +00:00
Rafael Espindola ae5e9ed422 Update for llvm change.
llvm-svn: 315377
2017-10-10 22:18:16 +00:00
Rafael Espindola 8f1f7b1442 Make the ELFFile constructor private.
With this all clients have to use the new create method which returns
an Expected.

Fixes a crash on invalid input.

llvm-svn: 315376
2017-10-10 22:17:49 +00:00
Matthew Simpson 82744da47b [SparsePropagation] Let the Instruction work list hold Values.
llvm-svn: 315375
2017-10-10 22:14:12 +00:00
Hans Wennborg 4a6ee430bb XFAIL ubsan/TestCases/TypeCheck/Function/function.cpp on Windows
I think it got accidentally enabled in r315105 or thereabouts.

llvm-svn: 315374
2017-10-10 22:11:25 +00:00