| #
2b3d49b6 |
| 14-Aug-2019 |
Jonas Devlieghere <[email protected]> |
[Clang] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement o
[Clang] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo.
Differential revision: https://reviews.llvm.org/D66259
llvm-svn: 368942
show more ...
|
| #
0e497d15 |
| 09-Aug-2019 |
Peter Collingbourne <[email protected]> |
cfi-icall: Allow the jump table to be optionally made non-canonical.
The default behavior of Clang's indirect function call checker will replace the address of each CFI-checked function in the outpu
cfi-icall: Allow the jump table to be optionally made non-canonical.
The default behavior of Clang's indirect function call checker will replace the address of each CFI-checked function in the output file's symbol table with the address of a jump table entry which will pass CFI checks. We refer to this as making the jump table `canonical`. This property allows code that was not compiled with ``-fsanitize=cfi-icall`` to take a CFI-valid address of a function, but it comes with a couple of caveats that are especially relevant for users of cross-DSO CFI:
- There is a performance and code size overhead associated with each exported function, because each such function must have an associated jump table entry, which must be emitted even in the common case where the function is never address-taken anywhere in the program, and must be used even for direct calls between DSOs, in addition to the PLT overhead.
- There is no good way to take a CFI-valid address of a function written in assembly or a language not supported by Clang. The reason is that the code generator would need to insert a jump table in order to form a CFI-valid address for assembly functions, but there is no way in general for the code generator to determine the language of the function. This may be possible with LTO in the intra-DSO case, but in the cross-DSO case the only information available is the function declaration. One possible solution is to add a C wrapper for each assembly function, but these wrappers can present a significant maintenance burden for heavy users of assembly in addition to adding runtime overhead.
For these reasons, we provide the option of making the jump table non-canonical with the flag ``-fno-sanitize-cfi-canonical-jump-tables``. When the jump table is made non-canonical, symbol table entries point directly to the function body. Any instances of a function's address being taken in C will be replaced with a jump table address.
This scheme does have its own caveats, however. It does end up breaking function address equality more aggressively than the default behavior, especially in cross-DSO mode which normally preserves function address equality entirely.
Furthermore, it is occasionally necessary for code not compiled with ``-fsanitize=cfi-icall`` to take a function address that is valid for CFI. For example, this is necessary when a function's address is taken by assembly code and then called by CFI-checking C code. The ``__attribute__((cfi_jump_table_canonical))`` attribute may be used to make the jump table entry of a specific function canonical so that the external code will end up taking a address for the function that will pass CFI checks.
Fixes PR41972.
Differential Revision: https://reviews.llvm.org/D65629
llvm-svn: 368495
show more ...
|
| #
a5af2383 |
| 09-Aug-2019 |
Saleem Abdulrasool <[email protected]> |
CodeGen: ensure 8-byte aligned String Swift CF ABI
CFStrings should be 8-byte aligned when built for the Swift CF runtime ABI as the atomic CF info field must be properly aligned. This is a problem
CodeGen: ensure 8-byte aligned String Swift CF ABI
CFStrings should be 8-byte aligned when built for the Swift CF runtime ABI as the atomic CF info field must be properly aligned. This is a problem on 32-bit platforms which would give the structure 4-byte alignment rather than 8-byte alignment.
llvm-svn: 368471
show more ...
|
| #
49a3ad21 |
| 16-Jul-2019 |
Rui Ueyama <[email protected]> |
Fix parameter name comments using clang-tidy. NFC.
This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch:
$ git clone
Fix parameter name comments using clang-tidy. NFC.
This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch:
$ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h}
llvm-svn: 366177
show more ...
|
| #
c5e7f562 |
| 15-Jul-2019 |
Evgeniy Stepanov <[email protected]> |
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software impl
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software implementation of the same idea, but there are enough differencies to warrant a new sanitizer type IMHO. It is also expected to have very different performance properties.
The new sanitizer does not have a runtime library (it may grow one later, along with a "debugging" mode). Similar to SafeStack and StackProtector, the instrumentation pass (in a follow up change) will be inserted in all cases, but will only affect functions marked with the new sanitize_memtag attribute.
Reviewers: pcc, hctim, vitalybuka, ostannard
Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64169
llvm-svn: 366123
show more ...
|
| #
960ff081 |
| 15-Jul-2019 |
Anastasia Stulova <[email protected]> |
[OpenCL][PR41727] Prevent ICE on global dtors
Pass NULL to pointer arg of __cxa_atexit if addr space is not matching with its param. This doesn't align yet with how dtors are generated that should b
[OpenCL][PR41727] Prevent ICE on global dtors
Pass NULL to pointer arg of __cxa_atexit if addr space is not matching with its param. This doesn't align yet with how dtors are generated that should be changed too.
Differential Revision: https://reviews.llvm.org/D62413
llvm-svn: 366059
show more ...
|
| #
d7aae33a |
| 10-Jul-2019 |
Saar Raz <[email protected]> |
[Concepts] Concept definitions (D40381)
First in a series of patches to land C++2a Concepts support. This patch adds AST and parsing support for concept-declarations.
llvm-svn: 365699
|
| #
c3dfe908 |
| 26-Jun-2019 |
Yaxun Liu <[email protected]> |
[HIP] Support attribute hip_pinned_shadow
This patch introduces support of hip_pinned_shadow variable for HIP.
A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow. It
[HIP] Support attribute hip_pinned_shadow
This patch introduces support of hip_pinned_shadow variable for HIP.
A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow. It has external linkage on device side and has no initializer. It has internal linkage on host side and has initializer or static constructor. It can be accessed in both device code and host code.
This allows HIP runtime to implement support of HIP texture reference.
Differential Revision: https://reviews.llvm.org/D62738
llvm-svn: 364381
show more ...
|
| #
15e678e8 |
| 24-Jun-2019 |
Konstantin Pyzhov <[email protected]> |
[CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential Revision: https://reviews.llvm.org/D63277
llvm-svn: 364183
|
| #
0034e84a |
| 20-Jun-2019 |
Gheorghe-Teodor Bercea <[email protected]> |
[OpenMP] Add support for handling declare target to clause when unified memory is required
Summary: This patch adds support for the handling of the variables under the declare target to clause.
The
[OpenMP] Add support for handling declare target to clause when unified memory is required
Summary: This patch adds support for the handling of the variables under the declare target to clause.
The variables in this case are handled like link variables are. A pointer is created on the host and then mapped to the device. The runtime will then copy the address of the host variable in the device pointer.
Reviewers: ABataev, AlexEichenberger, caomhin
Reviewed By: ABataev
Subscribers: guansong, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63108
llvm-svn: 363959
show more ...
|
| #
e40f879e |
| 17-Jun-2019 |
Michael Liao <[email protected]> |
[HIP] Add the interface deriving the stub name of device kernels.
Summary: - Revise the interface to derive the stub name and simplify the assertion of it.
Reviewers: yaxunl, tra
Subscribers: cf
[HIP] Add the interface deriving the stub name of device kernels.
Summary: - Revise the interface to derive the stub name and simplify the assertion of it.
Reviewers: yaxunl, tra
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63335
llvm-svn: 363553
show more ...
|
| #
6cb2d9db |
| 14-Jun-2019 |
Akira Hatanaka <[email protected]> |
[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute 'objc_arc_inert'
The attribute enables the ARC optimizer to delete ObjC ARC runtime calls on the annotated globals (see https://r
[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute 'objc_arc_inert'
The attribute enables the ARC optimizer to delete ObjC ARC runtime calls on the annotated globals (see https://reviews.llvm.org/D62433). We currently only annotate global variables for string literals and global blocks with the attribute.
rdar://problem/49839633
Differential Revision: https://reviews.llvm.org/D62831
llvm-svn: 363467
show more ...
|
| #
e08e68de |
| 07-Jun-2019 |
Peter Collingbourne <[email protected]> |
Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.
Differential Revision: https://reviews.llvm.org/D62636
llvm-svn: 362829
|
| #
f61b5481 |
| 30-May-2019 |
Anastasia Stulova <[email protected]> |
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.
C++ is derived from OpenCL v2.0 therefore set the versions identically.
Differential Revision: https://reviews.llvm.org/D62657
llvm-svn: 3621
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.
C++ is derived from OpenCL v2.0 therefore set the versions identically.
Differential Revision: https://reviews.llvm.org/D62657
llvm-svn: 362102
show more ...
|
| #
4b7a713a |
| 29-May-2019 |
Michael Liao <[email protected]> |
[CUDA][HIP] Skip setting `externally_initialized` for static device variables.
Summary: - By declaring device variables as `static`, we assume they won't be addressable from the host side. Thus, n
[CUDA][HIP] Skip setting `externally_initialized` for static device variables.
Summary: - By declaring device variables as `static`, we assume they won't be addressable from the host side. Thus, no `externally_initialized` is required.
Reviewers: yaxunl
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62603
llvm-svn: 361994
show more ...
|
| #
02afe4e0 |
| 28-May-2019 |
Yaxun Liu <[email protected]> |
[CUDA][HIP] Emit dependent libs for host only
Recently D60274 was introduced to allow lld to handle dependent libs. However current usage of dependent libs (e.g. pragma comment(lib, *) in windows he
[CUDA][HIP] Emit dependent libs for host only
Recently D60274 was introduced to allow lld to handle dependent libs. However current usage of dependent libs (e.g. pragma comment(lib, *) in windows header files) are intended for host only. Emitting the metadata in device IR causes link error in device path.
Until there is a way to different it dependent libs for device or host, metadata for dependent libs should be emitted for host only. This patch enforces that.
Differential Revision: https://reviews.llvm.org/D62483
llvm-svn: 361880
show more ...
|
| #
e637cbe4 |
| 21-May-2019 |
Richard Smith <[email protected]> |
Refactor: split Uninitialized state on APValue into an "Absent" state representing no such object, and an "Indeterminate" state representing an uninitialized object. The latter is not yet used, but s
Refactor: split Uninitialized state on APValue into an "Absent" state representing no such object, and an "Indeterminate" state representing an uninitialized object. The latter is not yet used, but soon will be.
llvm-svn: 361328
show more ...
|
| #
66cdbb47 |
| 21-May-2019 |
Gheorghe-Teodor Bercea <[email protected]> |
[OpenMP] Add support for registering requires directives with the runtime
Summary: This patch adds support for the registration of the requires directives with the runtime.
Each requires directive
[OpenMP] Add support for registering requires directives with the runtime
Summary: This patch adds support for the registration of the requires directives with the runtime.
Each requires directive clause will enable a particular flag to be set.
The set of flags is passed to the runtime to be checked for compatibility with other such flags coming from other object files.
The registration function is called whenever OpenMP is present even if a requires directive is not present. This helps detect cases in which requires directives are used inconsistently.
Reviewers: ABataev, AlexEichenberger, caomhin
Reviewed By: ABataev, AlexEichenberger
Subscribers: jholewinski, guansong, jfb, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60568
llvm-svn: 361298
show more ...
|
| #
6b21c4a4 |
| 21-May-2019 |
Alexey Bataev <[email protected]> |
[OPENMP]Use the attributes for dso locality when building for device.
Currently, we ignore all dso locality attributes/info when building for the device and thus all symblos are externally visible a
[OPENMP]Use the attributes for dso locality when building for device.
Currently, we ignore all dso locality attributes/info when building for the device and thus all symblos are externally visible and can be preemted at the runtime. It may lead to incorrect results. We need to follow the same logic, compiler uses for static/pie builds.
llvm-svn: 361283
show more ...
|
| #
1d16515f |
| 17-May-2019 |
Ben Dunbobbin <[email protected]> |
[ELF] Implement Dependent Libraries Feature
This patch implements a limited form of autolinking primarily designed to allow either the --dependent-library compiler option, or "comment lib" pragmas (
[ELF] Implement Dependent Libraries Feature
This patch implements a limited form of autolinking primarily designed to allow either the --dependent-library compiler option, or "comment lib" pragmas ( https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=vs-2017) in C/C++ e.g. #pragma comment(lib, "foo"), to cause an ELF linker to automatically add the specified library to the link when processing the input file generated by the compiler.
Currently this extension is unique to LLVM and LLD. However, care has been taken to design this feature so that it could be supported by other ELF linkers.
The design goals were to provide:
- A simple linking model for developers to reason about. - The ability to to override autolinking from the linker command line. - Source code compatibility, where possible, with "comment lib" pragmas in other environments (MSVC in particular).
Dependent library support is implemented differently for ELF platforms than on the other platforms. Primarily this difference is that on ELF we pass the dependent library specifiers directly to the linker without manipulating them. This is in contrast to other platforms where they are mapped to a specific linker option by the compiler. This difference is a result of the greater variety of ELF linkers and the fact that ELF linkers tend to handle libraries in a more complicated fashion than on other platforms. This forces us to defer handling the specifiers to the linker.
In order to achieve a level of source code compatibility with other platforms we have restricted this feature to work with libraries that meet the following "reasonable" requirements:
1. There are no competing defined symbols in a given set of libraries, or if they exist, the program owner doesn't care which is linked to their program. 2. There may be circular dependencies between libraries.
The binary representation is a mergeable string section (SHF_MERGE, SHF_STRINGS), called .deplibs, with custom type SHT_LLVM_DEPENDENT_LIBRARIES (0x6fff4c04). The compiler forms this section by concatenating the arguments of the "comment lib" pragmas and --dependent-library options in the order they are encountered. Partial (-r, -Ur) links are handled by concatenating .deplibs sections with the normal mergeable string section rules. As an example, #pragma comment(lib, "foo") would result in:
.section ".deplibs","MS",@llvm_dependent_libraries,1 .asciz "foo"
For LTO, equivalent information to the contents of a the .deplibs section can be retrieved by the LLD for bitcode input files.
LLD processes the dependent library specifiers in the following way:
1. Dependent libraries which are found from the specifiers in .deplibs sections of relocatable object files are added when the linker decides to include that file (which could itself be in a library) in the link. Dependent libraries behave as if they were appended to the command line after all other options. As a consequence the set of dependent libraries are searched last to resolve symbols. 2. It is an error if a file cannot be found for a given specifier. 3. Any command line options in effect at the end of the command line parsing apply to the dependent libraries, e.g. --whole-archive. 4. The linker tries to add a library or relocatable object file from each of the strings in a .deplibs section by; first, handling the string as if it was specified on the command line; second, by looking for the string in each of the library search paths in turn; third, by looking for a lib<string>.a or lib<string>.so (depending on the current mode of the linker) in each of the library search paths. 5. A new command line option --no-dependent-libraries tells LLD to ignore the dependent libraries.
Rationale for the above points:
1. Adding the dependent libraries last makes the process simple to understand from a developers perspective. All linkers are able to implement this scheme. 2. Error-ing for libraries that are not found seems like better behavior than failing the link during symbol resolution. 3. It seems useful for the user to be able to apply command line options which will affect all of the dependent libraries. There is a potential problem of surprise for developers, who might not realize that these options would apply to these "invisible" input files; however, despite the potential for surprise, this is easy for developers to reason about and gives developers the control that they may require. 4. This algorithm takes into account all of the different ways that ELF linkers find input files. The different search methods are tried by the linker in most obvious to least obvious order. 5. I considered adding finer grained control over which dependent libraries were ignored (e.g. MSVC has /nodefaultlib:<library>); however, I concluded that this is not necessary: if finer control is required developers can fall back to using the command line directly.
RFC thread: http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html.
Differential Revision: https://reviews.llvm.org/D60274
llvm-svn: 360984
show more ...
|
|
Revision tags: llvmorg-8.0.1-rc1 |
|
| #
ab8cde44 |
| 12-May-2019 |
Lubos Lunak <[email protected]> |
make -ftime-trace also print template arguments
Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill<unsigned long *, int>'.
Differential Revision: https://r
make -ftime-trace also print template arguments
Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill<unsigned long *, int>'.
Differential Revision: https://reviews.llvm.org/D61822
llvm-svn: 360539
show more ...
|
| #
e6cf6c78 |
| 09-May-2019 |
Anastasia Stulova <[email protected]> |
[OpenCL] Make global ctor init function a kernel
We need to be able to enqueue internal function that initializes global constructors on the host side. Therefore it has to be converted to a kernel.
[OpenCL] Make global ctor init function a kernel
We need to be able to enqueue internal function that initializes global constructors on the host side. Therefore it has to be converted to a kernel.
This change factors out common logic for adding kernel metadata and moves it from CodeGenFunction to CodeGenModule in order to make it accessible for the extra use case.
Differential revision: https://reviews.llvm.org/D61488
llvm-svn: 360342
show more ...
|
| #
eba9a6e0 |
| 09-May-2019 |
Anastasia Stulova <[email protected]> |
[SPIR] Simplified target checking.
Switched to Triple::isSPIR() helper to simplify code.
Patch by kpet (Kevin Petit)!
Differential revision: https://reviews.llvm.org/D61639
llvm-svn: 360325
|
| #
6bf108d7 |
| 07-May-2019 |
Reid Kleckner <[email protected]> |
[COFF] Use COFF stubs for extern_weak functions
Summary: A COFF stub indirects the reference to a symbol through memory. A .refptr.$sym global variable pointer is created to refer to $sym. Typically
[COFF] Use COFF stubs for extern_weak functions
Summary: A COFF stub indirects the reference to a symbol through memory. A .refptr.$sym global variable pointer is created to refer to $sym. Typically mingw uses these for external global variable declarations, but we can use them for weak function declarations as well.
Updates the dso_local classification to add a special case for extern_weak symbols on COFF in both clang and LLVM.
Fixes PR37598
Reviewers: smeenai, mstorsjo
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D61615
llvm-svn: 360207
show more ...
|
| #
1808c02c |
| 29-Apr-2019 |
Reid Kleckner <[email protected]> |
Re-land r359250, [COFF] Statically link certain runtime library functions
Reverts the revert of r359251, this time with fixed tests.
Differential Revision: https://reviews.llvm.org/D55229
llvm-svn
Re-land r359250, [COFF] Statically link certain runtime library functions
Reverts the revert of r359251, this time with fixed tests.
Differential Revision: https://reviews.llvm.org/D55229
llvm-svn: 359513
show more ...
|