summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [libFuzzer] add 'weak' back to __sanitizer_malloc_hook and __sanitizer_free_hookKostya Serebryany2016-06-081-0/+2
| | | | llvm-svn: 272116
* AMDGPU: Verify subtarget specific builtinsMatt Arsenault2016-06-087-70/+133
| | | | | | Cleanup setup of subtarget features. llvm-svn: 272091
* [libFuzzer] add a test that is built w/o coverage instrumentation but has ↵Kostya Serebryany2016-06-085-1/+27
| | | | | | the coverage rt (it should now fail with a descriptive message) llvm-svn: 272090
* [profile] Un-hide two symbolsVedant Kumar2016-06-082-3/+2
| | | | | | | | | | | - lprofCurFilename was intended to have external visibility. This is pending further discussion. - The raw version number doesn't need to be hidden: hiding it may make it easier to accidentally combine FE/IR profiles. See the mailing list discussion on r272081. llvm-svn: 272089
* [libFuzzer] docs: merge two lines with cmake instructions, add ↵Kostya Serebryany2016-06-081-6/+5
| | | | | | -DLLVM_ENABLE_ASSERTIONS=ON llvm-svn: 272088
* Revive the error message from "process load" and SBProcess::LoadImage.Jim Ingham2016-06-081-1/+1
| | | | | | | | | | | IsPointedCString has problems with ValueObjects of type eTypeHostAddress. We should figure out the right thing to do in that case, but the test is silly here because we're reading a type we've defined, so we know it is a const char *, and if the memory is good, we won't be able to read any characters, when we do ReadPointedString. <rdar://problem/26612812> llvm-svn: 272087
* [AArch64][RegisterBankInfo] Use the generic implementation of copyCost.Quentin Colombet2016-06-081-1/+2
| | | | | | Long term we may want to give high cost at FPR to/from GPR copies. llvm-svn: 272086
* [RegisterBankInfo] Adapt the copy cost logic to give something sane by default.Quentin Colombet2016-06-081-1/+5
| | | | | | | | The generic implementation stated that all copies were free, which is unlikely. Now, only the copies within the same register bank are free. We assume they will get coalesced. llvm-svn: 272085
* [RegisterBankInfo] Add a size argument for the cost of copy.Quentin Colombet2016-06-084-8/+19
| | | | | | | The cost of a copy may be different based on how many bits we have to copy around. E.g., a 8-bit copy may be different than a 32-bit copy. llvm-svn: 272084
* [RegisterBankInfo] Move a hidden function into a static method. NFC.Quentin Colombet2016-06-082-24/+31
| | | | | | This will allow code reuse in the coming commits. llvm-svn: 272083
* MIR: Fix parsing of stack object references in MachineMemOperandsMatthias Braun2016-06-082-6/+28
| | | | | | | The MachineMemOperand parser lacked the code to handle %stack.X references (%fixed-stack.X was working). llvm-svn: 272082
* [profile] Hide a few external symbols (NFCI)Vedant Kumar2016-06-083-4/+5
| | | | | | | | There are still a few external symbols visible from InstrProfData.inc. The plan for dealing with those isn't as straightforward, so I'll try it in a separate commit. llvm-svn: 272081
* [Sema] Teach CheckPlaceholderExpr about unaddressable functions.George Burgess IV2016-06-085-25/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following C++: ``` void foo(); void foo() __attribute__((enable_if(false, ""))); bool bar() { auto P = foo; return P == foo; } ``` We'll currently happily (and correctly) resolve `foo` to the `foo` overload without `enable_if` when assigning to `P`. However, we'll complain about an ambiguous overload on the `P == foo` line, because `Sema::CheckPlaceholderExpr` doesn't recognize that there's only one `foo` that could possibly work here. This patch teaches `Sema::CheckPlaceholderExpr` how to properly deal with such cases. Grepping for other callers of things like `Sema::ResolveAndFixSingleFunctionTemplateSpecialization`, it *looks* like this is the last place that needed to be fixed up. If I'm wrong, I'll see if there's something we can do that beats what amounts to whack-a-mole with bugs. llvm-svn: 272080
* [ItaniumMangle] Mangle dependent __underlying_type correctlyDavid Majnemer2016-06-082-1/+11
| | | | | | | | | | We attempted to use the UnaryTransformType's UnderlyingType instead of it's BaseType. This is not correct for dependent UnaryTransformType because the have no underlying type. This fixes PR28045. llvm-svn: 272079
* [pdb] Try to fix use after free.Zachary Turner2016-06-085-2/+21
| | | | llvm-svn: 272078
* IR: Call dropAllReferences from GlobalVariable's destructor.Peter Collingbourne2016-06-081-0/+2
| | | | | | | | | | | | | We were previously failing to do this and as a result failing to drop attached metadata. Not sure if there's a good way to test this. An in-progress patch exposed this problem by allocating a GlobalVariable at the same address as a previously allocated GlobalVariable. Differential Revision: http://reviews.llvm.org/D21109 llvm-svn: 272077
* [esan] Intercept calloc to avoid deadlocks with tcmallocDerek Bruening2016-06-081-2/+52
| | | | | | | | | | | | | | | | | | Summary: When tcmalloc initializes before esan, esan's initialization ends up calling back into tcmalloc due to the calloc done by dlsym. This results in a deadlock. We avoid this by special-casing this single allocation. Intercepting calloc also gives us the opportunity to act on its zeroing as stores by the application. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21086 llvm-svn: 272076
* [pdbdump] Print out # of hash buckets.Rui Ueyama2016-06-074-0/+5
| | | | | | In the reference code, the field name is `cHashBuckets`. llvm-svn: 272075
* [scudo] trying to fix the bot: aligned_alloc is not known there; attempt 3Kostya Serebryany2016-06-071-1/+1
| | | | llvm-svn: 272074
* [pdbdump] Print out TPI hash key size.Rui Ueyama2016-06-074-0/+6
| | | | llvm-svn: 272073
* [LibFuzzer] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``Dan Liew2016-06-078-73/+84
| | | | | | | | | | | | | | | | | | | | | | | This fixes linking problems on OSX. Unfortunately it turns out we need to use an instance of the ``fuzzer::ExternalFunctions`` object in several places so this commit also replaces all instances with a single global instance. It also turns out initializing a global ``fuzzer::ExternalFunctions`` before main is entered (i.e. letting the object be initialised by the global initializers) is not safe (on OSX the call to ``Printf()`` in the CTOR crashes if it is called from a global initializer) so we instead have a global ``fuzzer::ExternalFunctions*`` and initialize it inside ``FuzzerDriver()``. Multiple unit tests depend also depend on the ``fuzzer::ExternalFunctions*`` global so a ``main()`` function has been added that initializes it before running any tests. Differential Revision: http://reviews.llvm.org/D20943 llvm-svn: 272072
* Now that there are no cycles that cause leaks in the ↵Greg Clayton2016-06-076-63/+9
| | | | | | | | disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue. <rdar://problem/26684190> llvm-svn: 272071
* [docs] fix the build by including ScudoHardenedAllocator into toc; mention ↵Kostya Serebryany2016-06-072-2/+7
| | | | | | SourceBasedCodeCoverage.html in libFuzzer docs llvm-svn: 272070
* Fix a memory leak in InstructionLLVMC where it held onto a strong reference ↵Greg Clayton2016-06-074-300/+394
| | | | | | | | | | | | | | | | | | | | | to the DisassemblerLLVMC which in turn had a vector of InstructionSP causing the strong cycle. This is fixed now. Rules are as follows for internal code using lldb::DisassemblerSP and lldb::InstructionSP: 1 - The disassembler needs to stay around as long as instructions do as the Instruction subclass now has a weak pointer to the disassembler 2 - The public API has been fixed so that if you get a SBInstruction, it will hold onto a strong reference to the disassembler in a new InstructionImpl class This will keep code like like: inst = lldb.target.ReadInstructions(frame.GetPCAddress(), 1).GetInstructionAtIndex(0) inst.GetMnemonic() Working as expected (not the SBInstructionList() that was returned by SBTarget.ReadInstructions() is gone, but "inst" has a strong reference inside of it to the disassembler and the instruction. All code inside the LLDB shared library was verified to correctly hold onto the disassembler instance in all places. <rdar://problem/24585496> llvm-svn: 272069
* Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar2016-06-073-6/+85
| | | | | | | | | | Changes since the initial commit: - Use echo instead of printf. This should side-step the character escaping issues on Windows. Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 272068
* [docs] Coverage: Explain how to avoid static initializersVedant Kumar2016-06-071-0/+16
| | | | llvm-svn: 272067
* [lit] Ignore errors when decoding redirected output.Daniel Dunbar2016-06-071-1/+1
| | | | llvm-svn: 272066
* Use FileCheck instead of grepping for patterns. NFC.Easwaran Raman2016-06-073-10/+11
| | | | llvm-svn: 272065
* [CFLAA] Kill dead code/fix comments in StratifiedSets.George Burgess IV2016-06-071-87/+23
| | | | | | | | Also use default/delete instead of hand-written ctors. Thanks to Jia Chen for bringing this stuff up. llvm-svn: 272064
* AMDGPU: Add amdgpu-ps-wqm-outputs function attributesNicolai Haehnle2016-06-072-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The presence of this attribute indicates that VGPR outputs should be computed in whole quad mode. This will be used by Mesa for prolog pixel shaders, so that derivatives can be taken of shader inputs computed by the prolog, fixing a bug. The generated code could certainly be improved: if a prolog pixel shader is used (which isn't common in modern OpenGL - they're used for gl_Color, polygon stipples, and forcing per-sample interpolation), Mesa will use this attribute unconditionally, because it has to be conservative. So WQM may be used in the prolog when it isn't really needed, and furthermore a silly back-and-forth switch is likely to happen at the boundary between prolog and main shader parts. Fixing this is a bit involved: we'd first have to add a mechanism by which LLVM writes the WQM-related input requirements to the main shader part binary, and then Mesa specializes the prolog part accordingly. At that point, we may as well just compile a monolithic shader... Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95130 Reviewers: arsenm, tstellarAMD, mareko Subscribers: arsenm, llvm-commits, kzhuravl Differential Revision: http://reviews.llvm.org/D20839 llvm-svn: 272063
* Revert "Make lldbinline.py regenerate the Makefile each time it builds."Pavel Labath2016-06-0710-91/+17
| | | | | | This reverts commit r272024 as it is not windows-compatible. llvm-svn: 272062
* [LibFuzzer] Split the fuzzer-oom.test into two tests.Dan Liew2016-06-073-1/+14
| | | | | | | | | | This is necessary because the existing fuzzer-oom.test was Linux specific due to its use of __sanitizer_print_memory_profile() which is only available on Linux right now and so the test would fail on OSX. Differential Revision: http://reviews.llvm.org/D20977 llvm-svn: 272061
* [X86][SSE4A] Regenerated SSE4A intrinsics testsSimon Pilgrim2016-06-072-16/+65
| | | | | | There are no VEX encoded versions of SSE4A instructions, make sure that AVX targets give the same output llvm-svn: 272060
* [pdb] Fix broken unit test compilation.Zachary Turner2016-06-071-4/+4
| | | | llvm-svn: 272059
* [pdb] Convert StringRefs to ArrayRef<uint8_t>s.Zachary Turner2016-06-074-12/+15
| | | | llvm-svn: 272058
* Add info to SourceLevelDebugging about CodeViewReid Kleckner2016-06-071-5/+78
| | | | | | | Adds some discussion of the nature of the format, and some developer docs on how to work with it in LLVM. llvm-svn: 272057
* Revert "Differential Revision: http://reviews.llvm.org/D20557"Eric Christopher2016-06-072-309/+18
| | | | | | | | | | | | | | | | Author: Wei Ding <wei.ding2@amd.com> Date: Tue Jun 7 19:04:44 2016 +0000 Differential Revision: http://reviews.llvm.org/D20557 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272044 91177308-0d34-0410-b5e6-96231b3b80d8 as it was breaking the bots. This reverts commit r272044. llvm-svn: 272056
* Reformat for some clarity and 80-columns. NFC.Eric Christopher2016-06-072-21/+32
| | | | llvm-svn: 272055
* [libfuzzer] custom crossover interface function.Mike Aizatsky2016-06-077-0/+107
| | | | | | Differential Revision: http://reviews.llvm.org/D21089 llvm-svn: 272054
* [stack-protection] Add support for MSVC buffer security checkEtienne Bergeron2016-06-0711-41/+668
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding support for the MSVC buffer security check implementation The buffer security check is turned on with the '/GS' compiler switch. * https://msdn.microsoft.com/en-us/library/8dbf701c.aspx * To be added to clang here: http://reviews.llvm.org/D20347 Some overview of buffer security check feature and implementation: * https://msdn.microsoft.com/en-us/library/aa290051(VS.71).aspx * http://www.ksyash.com/2011/01/buffer-overflow-protection-3/ * http://blog.osom.info/2012/02/understanding-vs-c-compilers-buffer.html For the following example: ``` int example(int offset, int index) { char buffer[10]; memset(buffer, 0xCC, index); return buffer[index]; } ``` The MSVC compiler is adding these instructions to perform stack integrity check: ``` push ebp mov ebp,esp sub esp,50h [1] mov eax,dword ptr [__security_cookie (01068024h)] [2] xor eax,ebp [3] mov dword ptr [ebp-4],eax push ebx push esi push edi mov eax,dword ptr [index] push eax push 0CCh lea ecx,[buffer] push ecx call _memset (010610B9h) add esp,0Ch mov eax,dword ptr [index] movsx eax,byte ptr buffer[eax] pop edi pop esi pop ebx [4] mov ecx,dword ptr [ebp-4] [5] xor ecx,ebp [6] call @__security_check_cookie@4 (01061276h) mov esp,ebp pop ebp ret ``` The instrumentation above is: * [1] is loading the global security canary, * [3] is storing the local computed ([2]) canary to the guard slot, * [4] is loading the guard slot and ([5]) re-compute the global canary, * [6] is validating the resulting canary with the '__security_check_cookie' and performs error handling. Overview of the current stack-protection implementation: * lib/CodeGen/StackProtector.cpp * There is a default stack-protection implementation applied on intermediate representation. * The target can overload 'getIRStackGuard' method if it has a standard location for the stack protector cookie. * An intrinsic 'Intrinsic::stackprotector' is added to the prologue. It will be expanded by the instruction selection pass (DAG or Fast). * Basic Blocks are added to every instrumented function to receive the code for handling stack guard validation and errors handling. * Guard manipulation and comparison are added directly to the intermediate representation. * lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp * lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp * There is an implementation that adds instrumentation during instruction selection (for better handling of sibbling calls). * see long comment above 'class StackProtectorDescriptor' declaration. * The target needs to override 'getSDagStackGuard' to activate SDAG stack protection generation. (note: getIRStackGuard MUST be nullptr). * 'getSDagStackGuard' returns the appropriate stack guard (security cookie) * The code is generated by 'SelectionDAGBuilder.cpp' and 'SelectionDAGISel.cpp'. * include/llvm/Target/TargetLowering.h * Contains function to retrieve the default Guard 'Value'; should be overriden by each target to select which implementation is used and provide Guard 'Value'. * lib/Target/X86/X86ISelLowering.cpp * Contains the x86 specialisation; Guard 'Value' used by the SelectionDAG algorithm. Function-based Instrumentation: * The MSVC doesn't inline the stack guard comparison in every function. Instead, a call to '__security_check_cookie' is added to the epilogue before every return instructions. * To support function-based instrumentation, this patch is * adding a function to get the function-based check (llvm 'Value', see include/llvm/Target/TargetLowering.h), * If provided, the stack protection instrumentation won't be inlined and a call to that function will be added to the prologue. * modifying (SelectionDAGISel.cpp) do avoid producing basic blocks used for inline instrumentation, * generating the function-based instrumentation during the ISEL pass (SelectionDAGBuilder.cpp), * if FastISEL (not SelectionDAG), using the fallback which rely on the same function-based implemented over intermediate representation (StackProtector.cpp). Modifications * adding support for MSVC (lib/Target/X86/X86ISelLowering.cpp) * adding support function-based instrumentation (lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, .h) Results * IR generated instrumentation: ``` clang-cl /GS test.cc /Od /c -mllvm -print-isel-input ``` ``` *** Final LLVM Code input to ISel *** ; Function Attrs: nounwind sspstrong define i32 @"\01?example@@YAHHH@Z"(i32 %offset, i32 %index) #0 { entry: %StackGuardSlot = alloca i8* <<<-- Allocated guard slot %0 = call i8* @llvm.stackguard() <<<-- Loading Stack Guard value call void @llvm.stackprotector(i8* %0, i8** %StackGuardSlot) <<<-- Prologue intrinsic call (store to Guard slot) %index.addr = alloca i32, align 4 %offset.addr = alloca i32, align 4 %buffer = alloca [10 x i8], align 1 store i32 %index, i32* %index.addr, align 4 store i32 %offset, i32* %offset.addr, align 4 %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 0 %1 = load i32, i32* %index.addr, align 4 call void @llvm.memset.p0i8.i32(i8* %arraydecay, i8 -52, i32 %1, i32 1, i1 false) %2 = load i32, i32* %index.addr, align 4 %arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 %2 %3 = load i8, i8* %arrayidx, align 1 %conv = sext i8 %3 to i32 %4 = load volatile i8*, i8** %StackGuardSlot <<<-- Loading Guard slot call void @__security_check_cookie(i8* %4) <<<-- Epilogue function-based check ret i32 %conv } ``` * SelectionDAG generated instrumentation: ``` clang-cl /GS test.cc /O1 /c /FA ``` ``` "?example@@YAHHH@Z": # @"\01?example@@YAHHH@Z" # BB#0: # %entry pushl %esi subl $16, %esp movl ___security_cookie, %eax <<<-- Loading Stack Guard value movl 28(%esp), %esi movl %eax, 12(%esp) <<<-- Store to Guard slot leal 2(%esp), %eax pushl %esi pushl $204 pushl %eax calll _memset addl $12, %esp movsbl 2(%esp,%esi), %esi movl 12(%esp), %ecx <<<-- Loading Guard slot calll @__security_check_cookie@4 <<<-- Epilogue function-based check movl %esi, %eax addl $16, %esp popl %esi retl ``` Reviewers: kcc, pcc, eugenis, rnk Subscribers: majnemer, llvm-commits, hans, thakis, rnk Differential Revision: http://reviews.llvm.org/D20346 llvm-svn: 272053
* [lit] Fix an uninitialized var on Windows.Daniel Dunbar2016-06-071-1/+2
| | | | llvm-svn: 272052
* [scudo] trying to fix the bot: aligned_alloc is not known there; attempt 2Kostya Serebryany2016-06-071-2/+3
| | | | llvm-svn: 272051
* Added notes for a bunch of the issuesMarshall Clow2016-06-071-10/+10
| | | | llvm-svn: 272050
* [yaml] Add a ScalarTraits for mapping endian aware types.Zachary Turner2016-06-072-0/+133
| | | | | | | | | | This allows mapping of any endian-aware type whose underlying type (e.g. uint32_t) provides a ScalarTraits specialization. Reviewed by: majnemer Differential Revision: http://reviews.llvm.org/D21057 llvm-svn: 272049
* Revert r272045 since GCC doesn't know how to compile it.Krzysztof Parzyszek2016-06-071-449/+507
| | | | llvm-svn: 272048
* [asan] Turn LSan-related #if’s into regular if’s in ASan initializerKuba Brecka2016-06-072-8/+15
| | | | | | | | Removing some preprocessor #if’s in favor of regular if’s. However, we need to declare empty stub functions to avoid linker errors. Differential Revision: http://reviews.llvm.org/D20911 llvm-svn: 272047
* Remove break after return.Rui Ueyama2016-06-071-2/+0
| | | | llvm-svn: 272046
* [Hexagon] Modify HexagonExpandCondsets to handle subregistersKrzysztof Parzyszek2016-06-071-507/+449
| | | | | | | Also, switch to using functions from LiveIntervalAnalysis to update live intervals, instead of performing the updates manually. llvm-svn: 272045
* Differential Revision: http://reviews.llvm.org/D20557Wei Ding2016-06-072-18/+309
| | | | llvm-svn: 272044
* [pdb] Fix a potential overflow and remove unnecessary comments.Zachary Turner2016-06-072-3/+3
| | | | llvm-svn: 272043
OpenPOWER on IntegriCloud