Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3832184
[flang][docs] Fix typo in array description
Mxfg-incense Apr 15, 2025
1b42bbd
Merge branch 'main' into fix-typo-0416
Mxfg-incense Apr 15, 2025
7a41761
[lldb] Make SBProcess thread related actions listen to StopLocker (#1…
kusmour Apr 15, 2025
9b13d34
[libc][bazel] Remove a no-op libc_internal_target macro. (#135818)
vonosmas Apr 15, 2025
3b91030
[llvm] add documentation for public interface annotations (LLVM_ABI, …
andrurogerz Apr 15, 2025
30d13e3
[CIR] Upstream ArraySubscriptExpr from function parameter with pointe…
AmrDeveloper Apr 15, 2025
3f58ff2
AArch64: Remove the PAUTH_BLEND pseudo-instruction.
pcc Apr 15, 2025
a5aa0c4
Introduce -funique-source-file-names flag.
pcc Apr 15, 2025
d0c973a
[llvm][clang] Allocate a new stack instead of spawning a new thread t…
Bigcheese Apr 15, 2025
429a84f
[clang] Fix ambiguity in `runOnNewStack`
Bigcheese Apr 15, 2025
227f406
[gn build] Port d0c973a7a014
llvmgnsyncbot Apr 15, 2025
13615f7
[flang][openacc] Allow if clause on atomic directives (#135451)
clementval Apr 15, 2025
8f25e43
[NFC] Rename hasSameElementsOrSplat to hasSameNumElementsOrSplat (#13…
hiraditya Apr 15, 2025
9a1ece2
[clang] Clear `NeedsCleaning` flag after `ExpandBuiltinMacro` (#133574)
mariusdr Apr 15, 2025
b581bd3
[flang][OpenACC] use correct type when create private box init recipe…
rscottmanley Apr 15, 2025
bd9c511
[mlir][tosa] Add error_if checks for Transpose (#135219)
Tai78641 Apr 15, 2025
96064e1
[mlir][tosa] Add table size check for Table Op (#135262)
Tai78641 Apr 15, 2025
4f64c80
[llvm] Add missing include for !LLVM_ENABLE_THREADS
Bigcheese Apr 15, 2025
e6e56f5
[MemProf] Handle recursion during stack node update (#135837)
teresajohnson Apr 15, 2025
a3283a9
[PAC] Add support for __ptrauth type qualifier (#100830)
ahatanak Apr 15, 2025
a1d52fc
Clarify documentation for -funique-source-file-names.
pcc Apr 15, 2025
2271f0b
[SLP]Check for perfect/shuffled match for the split node
alexey-bataev Apr 15, 2025
823adc7
[BOLT] Validate secondary entry point (#135731)
yozhu Apr 15, 2025
14cb656
[lldb-dap] Improve error reporting for dap command arguments. (#135684)
ashgti Apr 15, 2025
85eb44e
[SLP]Fix number of operands for the split node
alexey-bataev Apr 15, 2025
2b983a2
[MLIR][AMDGPU] Adding dynamic size check to avoid subword buffer load…
jerryyin Apr 15, 2025
f83c5fe
[nfc] Expose `canReturn` from FunctionAttrs (#135650)
mtrofin Apr 15, 2025
12697c5
[LegalizeTypes] Check getTypeAction before calling GetScalarizedVecto…
topperc Apr 15, 2025
ddb1267
[SLP]Insert vector instruction after landingpad
alexey-bataev Apr 15, 2025
0f3e460
[mlir][Tensor] Generalize the pattern to swap `tensor.collapse_shape`…
MaheshRavishankar Apr 15, 2025
d30a5b4
[RISCV] Fix xmipscmov extension name (#135647)
djtodoro Apr 15, 2025
9c73eba
Merge similar Clang Thread Safety attributes (#135561)
aaronpuchert Apr 15, 2025
7cb7b2d
[llvm] Build Windows release package with clang-cl if possible (#135446)
aganea Apr 15, 2025
d037217
[nfc] Add doc comment for `canReturn` in Analysis/CFG.h (#135862)
mtrofin Apr 15, 2025
2d98bdc
Revert "[llvm][clang] Allocate a new stack instead of spawning a new …
mysterymath Apr 15, 2025
8ed397d
[DAGCombiner] Disable narrowExtractedVectorLoad for indexed loads. (#…
topperc Apr 15, 2025
a6208ce
[nfc] move `isPresplitCoroSuspendExitEdge` to Analysis/CFG (#135849)
mtrofin Apr 15, 2025
6e2bca8
[gn build] Port 2d98bdc12c29
llvmgnsyncbot Apr 15, 2025
31f39c8
[AMDGPU] Remove the AnnotateKernelFeatures pass (#130198)
jwanggit86 Apr 15, 2025
16980d5
Revert "[Clang] Fix dependent local class instantiation bugs" (#135870)
mizvekov Apr 15, 2025
af63e1b
[OpenACC][CIR] Implement 'self' lowering on compute constructs (#135851)
erichkeane Apr 15, 2025
e4d951d
LowerTypeTests: Fix quadratic complexity.
pcc Apr 15, 2025
3428cc9
[flang] Implement external routine usage of hostnm() (#134900)
eugeneepshteyn Apr 15, 2025
58c3fba
Revert "LowerTypeTests: Fix quadratic complexity."
pcc Apr 15, 2025
860d038
[Fuchsia] Not building llvm-mt when LIBXML2 is not enabled. (#135877)
zeroomega Apr 15, 2025
6ad922b
[OpenACC][CIR] Implement lowering for 'if' on compute constructs
erichkeane Apr 15, 2025
0b8f817
[BOLT] Fix conditional compilation of hugify.cpp (#135880)
maksfb Apr 15, 2025
bd4d351
[ASan] Prevent ASan/LSan deadlock by preloading modules before error …
Camsyn Apr 16, 2025
77f0708
[libc]: Remove `-Wglobal-constructors` for libc tests (#131485)
vinay-deshmukh Apr 16, 2025
6c6ab2a
AArch64: Set FMAXIMUMNUM and FMINIMUMNUM as Promote if not fullfp16 (…
wzssyqa Apr 16, 2025
4c97c51
[RISCV] Add ISel patterns for Xqcilia instructions (#135724)
svs-quic Apr 16, 2025
0ce8ad6
[SPARC] Use fzero/fzeros to materialize FP zeros when we have VIS
koachan Apr 16, 2025
f3de63c
[SPARC] Use addxccc to do multiword addition when we have VIS3
koachan Apr 16, 2025
e4f2191
[SPARC] Use umulxhi to do extending 64x64->128 multiply when we have …
koachan Apr 16, 2025
0439a4e
[RISCV] Add new CondCode COND_CV_BEQIMM/COND_CV_BNEIMM for CV immedia…
tclin914 Apr 16, 2025
5e9650e
Revert "[SPARC] Use umulxhi to do extending 64x64->128 multiply when …
koachan Apr 16, 2025
bed03ae
[X86] Fix the issue of creating index reg negations (#135632)
fzou1 Apr 16, 2025
e676866
[Mips] Fix clang crashes when compiling a variadic function while tar…
yingopq Apr 16, 2025
517605c
[alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPt…
rniwa Apr 16, 2025
71d0916
[libc][bazel] Fold "libc_function_deps" into "deps" for libc_tests. (…
vonosmas Apr 16, 2025
a024d13
[LoongArch] make ABDS/ABDU legal for lsx/lasx (#134190)
tangaac Apr 16, 2025
b07c885
[Support] Add format object for interleaved ranges (#135517)
kuhar Apr 16, 2025
04b87e1
[flang][fir] Lower `do concurrent` loop nests to `fir.do_concurrent` …
ergawy Apr 16, 2025
8af1dd3
[flang][docs] Fix typo in array description
Mxfg-incense Apr 15, 2025
3daa82f
Merge branch 'fix-typo-0416' of github.com:Mxfg-incense/llvm-project …
Mxfg-incense Apr 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,11 @@ class BinaryFunction {
return getSecondaryEntryPointSymbol(BB.getLabel());
}

/// Remove a label from the secondary entry point map.
void removeSymbolFromSecondaryEntryPointMap(const MCSymbol *Label) {
SecondaryEntryPoints.erase(Label);
}

/// Return true if the basic block is an entry point into the function
/// (either primary or secondary).
bool isEntryPoint(const BinaryBasicBlock &BB) const {
Expand Down Expand Up @@ -2126,6 +2131,10 @@ class BinaryFunction {
return Islands && !Islands->DataOffsets.empty();
}

bool isStartOfConstantIsland(uint64_t Offset) const {
return hasConstantIsland() && Islands->DataOffsets.count(Offset);
}

/// Return true iff the symbol could be seen inside this function otherwise
/// it is probably another function.
bool isSymbolValidInScope(const SymbolRef &Symbol, uint64_t SymbolSize) const;
Expand Down
9 changes: 9 additions & 0 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,15 @@ void BinaryFunction::postProcessEntryPoints() {
if (BC.isAArch64() && Offset == getSize())
continue;

// If we have grabbed a wrong code label which actually points to some
// constant island inside the function, ignore this label and remove it
// from the secondary entry point map.
if (isStartOfConstantIsland(Offset)) {
BC.SymbolToFunctionMap.erase(Label);
removeSymbolFromSecondaryEntryPointMap(Label);
continue;
}

BC.errs() << "BOLT-WARNING: reference in the middle of instruction "
"detected in function "
<< *this << " at offset 0x" << Twine::utohexstr(Offset) << '\n';
Expand Down
4 changes: 2 additions & 2 deletions bolt/runtime/hugify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===---------------------------------------------------------------------===//

#if defined(__x86_64__) || \
(defined(__aarch64__) || defined(__arm64__)) && !defined(__APPLE__)
#if (defined(__x86_64__) || defined(__aarch64__) || defined(__arm64__)) && \
!defined(__APPLE__)

#include "common.h"

Expand Down
34 changes: 34 additions & 0 deletions bolt/test/AArch64/validate-secondary-entry-point.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This test is to verify that BOLT won't take a label pointing to constant
# island as a secondary entry point (function `_start` doesn't have ELF size
# set originally) and the function won't otherwise be mistaken as non-simple.

# RUN: %clang %cflags -pie %s -o %t.so -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
# RUN: llvm-bolt %t.so -o %t.bolt.so --print-cfg 2>&1 | FileCheck %s
# CHECK-NOT: BOLT-WARNING: reference in the middle of instruction detected \
# CHECK-NOT: function _start at offset 0x{{[0-9a-f]+}}
# CHECK: Binary Function "_start" after building cfg

.text

.global _foo
.type _foo, %function
_foo:
ret

.global _start
.type _start, %function
_start:
b _foo

.balign 16
_random_consts:
.long 0x12345678
.long 0x90abcdef

.global _bar
.type _bar, %function
_bar:
ret

# Dummy relocation to force relocation mode
.reloc 0, R_AARCH64_NONE
34 changes: 34 additions & 0 deletions bolt/test/RISCV/validate-secondary-entry-point.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This test is to verify that BOLT won't take a label pointing to constant
# island as a secondary entry point (function `_start` doesn't have ELF size
# set originally) and the function won't otherwise be mistaken as non-simple.

# RUN: %clang %cflags -pie %s -o %t.so -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
# RUN: llvm-bolt %t.so -o %t.bolt.so --print-cfg 2>&1 | FileCheck %s
# CHECK-NOT: BOLT-WARNING: reference in the middle of instruction detected \
# CHECK-NOT: function _start at offset 0x{{[0-9a-f]+}}
# CHECK: Binary Function "_start" after building cfg

.text

.global _foo
.type _foo, %function
_foo:
ret

.global _start
.type _start, %function
_start:
j _foo

.balign 16
_random_consts:
.long 0x12345678
.long 0x90abcdef

.global _bar
.type _bar, %function
_bar:
ret

# Dummy relocation to force relocation mode
.reloc 0, R_RISCV_NONE
5 changes: 4 additions & 1 deletion clang/cmake/caches/Fuchsia-stage2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ set(LLVM_TOOLCHAIN_TOOLS
llvm-libtool-darwin
llvm-lipo
llvm-ml
llvm-mt
llvm-nm
llvm-objcopy
llvm-objdump
Expand All @@ -481,6 +480,10 @@ set(LLVM_TOOLCHAIN_TOOLS
scan-build-py
CACHE STRING "")

if (LLVM_ENABLE_LIBXML2)
list(APPEND LLVM_TOOLCHAIN_TOOLS llvm-mt)
endif()

set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
bolt
clang
Expand Down
5 changes: 5 additions & 0 deletions clang/docs/ControlFlowIntegrity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ default visibility setting is ``-fvisibility=default``, which would disable
CFI checks for classes without visibility attributes. Most users will want
to specify ``-fvisibility=hidden``, which enables CFI checks for such classes.

When using ``-fsanitize=cfi*`` with ``-flto=thin``, it is recommended
to reduce link times by passing `-funique-source-file-names
<UsersManual.html#cmdoption-f-no-unique-source-file-names>`_, provided
that your program is compatible with it.

Experimental support for :ref:`cross-DSO control flow integrity
<cfi-cross-dso>` exists that does not require classes to have hidden LTO
visibility. This cross-DSO support has unstable ABI at this time.
Expand Down
46 changes: 46 additions & 0 deletions clang/docs/PointerAuthentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,52 @@ a number of different tests.
normal interface. This may be true even on targets where pointer
authentication is not enabled by default.

__ptrauth Qualifier
^^^^^^^^^^^^^^^^^^^

``__ptrauth(key, address, discriminator)`` is an extended type
qualifier which causes so-qualified objects to hold pointers signed using the
specified schema rather than the default schema for such types.

In the current implementation in Clang, the qualified type must be a C pointer
type, either to a function or to an object. It currently cannot be an
Objective-C pointer type, a C++ reference type, or a block pointer type; these
restrictions may be lifted in the future.

The qualifier's operands are as follows:

- ``key`` - an expression evaluating to a key value from ``<ptrauth.h>``; must
be a constant expression

- ``address`` - whether to use address diversity (1) or not (0); must be
a constant expression with one of these two values

- ``discriminator`` - a constant discriminator; must be a constant expression

See `Discriminators`_ for more information about discriminators.

Currently the operands must be constant-evaluable even within templates. In the
future this restriction may be lifted to allow value-dependent expressions as
long as they instantiate to a constant expression.

Consistent with the ordinary C/C++ rule for parameters, top-level ``__ptrauth``
qualifiers on a parameter (after parameter type adjustment) are ignored when
deriving the type of the function. The parameter will be passed using the
default ABI for the unqualified pointer type.

If ``x`` is an object of type ``__ptrauth(key, address, discriminator) T``,
then the signing schema of the value stored in ``x`` is a key of ``key`` and
a discriminator determined as follows:

- if ``address`` is 0, then the discriminator is ``discriminator``;

- if ``address`` is 1 and ``discriminator`` is 0, then the discriminator is
``&x``; otherwise

- if ``address`` is 1 and ``discriminator`` is non-zero, then the discriminator
is ``ptrauth_blend_discriminator(&x, discriminator)``; see
`ptrauth_blend_discriminator`_.

``<ptrauth.h>``
~~~~~~~~~~~~~~~

Expand Down
5 changes: 4 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ Bug Fixes in This Version
- Defining an integer literal suffix (e.g., ``LL``) before including
``<stdint.h>`` in a freestanding build no longer causes invalid token pasting
when using the ``INTn_C`` macros. (#GH85995)
- Fixed an assertion failure in the expansion of builtin macros like ``__has_embed()`` with line breaks before the
closing paren. (#GH133574)
- Clang no longer accepts invalid integer constants which are too large to fit
into any (standard or extended) integer type when the constant is unevaluated.
Merely forming the token is sufficient to render the program invalid. Code
Expand Down Expand Up @@ -455,7 +457,6 @@ Bug Fixes to C++ Support
by template argument deduction.
- Clang is now better at instantiating the function definition after its use inside
of a constexpr lambda. (#GH125747)
- Fixed a local class member function instantiation bug inside dependent lambdas. (#GH59734), (#GH132208)
- Clang no longer crashes when trying to unify the types of arrays with
certain differences in qualifiers (this could happen during template argument
deduction or when building a ternary operator). (#GH97005)
Expand Down Expand Up @@ -546,6 +547,8 @@ Arm and AArch64 Support
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
also now printed when the ``--print-supported-extensions`` option is used.

- Support for __ptrauth type qualifier has been added.

Android Support
^^^^^^^^^^^^^^^

Expand Down
30 changes: 30 additions & 0 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,36 @@ are listed below.
pure ThinLTO, as all split regular LTO modules are merged and LTO linked
with regular LTO.

.. option:: -f[no-]unique-source-file-names

When enabled, allows the compiler to assume that each object file
passed to the linker has been compiled using a unique source file
path. This is useful for reducing link times when doing ThinLTO
in combination with whole-program devirtualization or CFI.

The full source path passed to the compiler must be unique. This
means that, for example, the following is a usage error:

.. code-block:: console

$ cd foo
$ clang -funique-source-file-names -c foo.c
$ cd ../bar
$ clang -funique-source-file-names -c foo.c
$ cd ..
$ clang foo/foo.o bar/foo.o

but this is not:

.. code-block:: console

$ clang -funique-source-file-names -c foo/foo.c
$ clang -funique-source-file-names -c bar/foo.c
$ clang foo/foo.o bar/foo.o

A misuse of this flag may result in a duplicate symbol error at
link time.

.. option:: -fforce-emit-vtables

In order to improve devirtualization, forces emitting of vtables even in
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/AST/OpenACCClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ class OpenACCSelfClause final
}

bool isConditionExprClause() const { return HasConditionExpr.has_value(); }
bool isVarListClause() const { return !isConditionExprClause(); }
bool isEmptySelfClause() const {
return (isConditionExprClause() && !hasConditionExpr()) ||
(!isConditionExprClause() && getVarList().empty());
}

bool hasConditionExpr() const {
assert(HasConditionExpr.has_value() &&
Expand Down
21 changes: 17 additions & 4 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ class PointerAuthQualifier {
return Result;
}

std::string getAsString() const;
std::string getAsString(const PrintingPolicy &Policy) const;

bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const;
void print(raw_ostream &OS, const PrintingPolicy &Policy) const;

void Profile(llvm::FoldingSetNodeID &ID) const { ID.AddInteger(Data); }
};

Expand Down Expand Up @@ -562,7 +568,7 @@ class Qualifiers {

bool hasAddressSpace() const { return Mask & AddressSpaceMask; }
LangAS getAddressSpace() const {
return static_cast<LangAS>(Mask >> AddressSpaceShift);
return static_cast<LangAS>((Mask & AddressSpaceMask) >> AddressSpaceShift);
}
bool hasTargetSpecificAddressSpace() const {
return isTargetAddressSpace(getAddressSpace());
Expand Down Expand Up @@ -803,17 +809,18 @@ class Qualifiers {
static_assert(sizeof(PointerAuthQualifier) == sizeof(uint32_t),
"PointerAuthQualifier must be 32 bits");

static constexpr uint64_t PtrAuthShift = 32;
static constexpr uint64_t PtrAuthMask = UINT64_C(0xffffffff) << PtrAuthShift;

static constexpr uint64_t UMask = 0x8;
static constexpr uint64_t UShift = 3;
static constexpr uint64_t GCAttrMask = 0x30;
static constexpr uint64_t GCAttrShift = 4;
static constexpr uint64_t LifetimeMask = 0x1C0;
static constexpr uint64_t LifetimeShift = 6;
static constexpr uint64_t AddressSpaceMask =
~(CVRMask | UMask | GCAttrMask | LifetimeMask);
~(CVRMask | UMask | GCAttrMask | LifetimeMask | PtrAuthMask);
static constexpr uint64_t AddressSpaceShift = 9;
static constexpr uint64_t PtrAuthShift = 32;
static constexpr uint64_t PtrAuthMask = uint64_t(0xffffffff) << PtrAuthShift;
};

class QualifiersAndAtomic {
Expand Down Expand Up @@ -1449,6 +1456,12 @@ class QualType {
return getQualifiers().getPointerAuth();
}

bool hasAddressDiscriminatedPointerAuth() const {
if (PointerAuthQualifier PtrAuth = getPointerAuth())
return PtrAuth.isAddressDiscriminated();
return false;
}

enum PrimitiveDefaultInitializeKind {
/// The type does not fall into any of the following categories. Note that
/// this case is zero-valued so that values of this enum can be used as a
Expand Down
Loading