<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/lib/CodeGen/CGExprConstant.cpp, branch users/koachan/spr/main.sparcias-enable-parseforallfeatures-in-matchoperandparserimpl</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title> [clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (#94056)</title>
<updated>2024-06-27T01:35:10+00:00</updated>
<author>
<name>Oliver Hunt</name>
<email>oliver@apple.com</email>
</author>
<published>2024-06-27T01:35:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1b8ab2f08998d3220e5d95003d47bb3d7cac966b'/>
<id>1b8ab2f08998d3220e5d95003d47bb3d7cac966b</id>
<content type='text'>
Virtual function pointer entries in v-tables are signed with address
discrimination in addition to declaration-based discrimination, where an
integer discriminator the string hash (see
`ptrauth_string_discriminator`) of the mangled name of the overridden
method. This notably provides diversity based on the full signature of
the overridden method, including the method name and parameter types.
This patch introduces ItaniumVTableContext logic to find the original
declaration of the overridden method.
On AArch64, these pointers are signed using the `IA` key (the
process-independent code key.)

V-table pointers can be signed with either no discrimination, or a
similar scheme using address and decl-based discrimination. In this
case, the integer discriminator is the string hash of the mangled
v-table identifier of the class that originally introduced the vtable
pointer.
On AArch64, these pointers are signed using the `DA` key (the
process-independent data key.)

Not using discrimination allows attackers to simply copy valid v-table
pointers from one object to another. However, using a uniform
discriminator of 0 does have positive performance and code-size
implications on AArch64, and diversity for the most important v-table
access pattern (virtual dispatch) is already better assured by the
signing schemas used on the virtual functions. It is also known that
some code in practice copies objects containing v-tables with `memcpy`,
and while this is not permitted formally, it is something that may be
invasive to eliminate.

This is controlled by:
```
  -fptrauth-vtable-pointer-type-discrimination
  -fptrauth-vtable-pointer-address-discrimination
```

In addition, this provides fine-grained controls in the
ptrauth_vtable_pointer attribute, which allows overriding the default
ptrauth schema for vtable pointers on a given class hierarchy, e.g.:
```
  [[clang::ptrauth_vtable_pointer(no_authentication, no_address_discrimination, 
                                  no_extra_discrimination)]]
  [[clang::ptrauth_vtable_pointer(default_key, default_address_discrimination,
                                  custom_discrimination, 0xf00d)]]
```

The override is then mangled as a parametrized vendor extension:
```
"__vtptrauth" I
 &lt;key&gt;
 &lt;addressDiscriminated&gt;
 &lt;extraDiscriminator&gt;
E
```

To support this attribute, this patch adds a small extension to the
attribute-emitter tablegen backend.

Note that there are known areas where signing is either missing
altogether or can be strengthened. Some will be addressed in later
changes (e.g., member function pointers, some RTTI).
`dynamic_cast` in particular is handled by emitting an artificial
v-table pointer load (in a way that always authenticates it) before the
runtime call itself, as the runtime doesn't have enough information
today to properly authenticate it. Instead, the runtime is currently
expected to strip the v-table pointer.

---------

Co-authored-by: John McCall &lt;rjmccall@apple.com&gt;
Co-authored-by: Ahmed Bougacha &lt;ahmed@bougacha.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Virtual function pointer entries in v-tables are signed with address
discrimination in addition to declaration-based discrimination, where an
integer discriminator the string hash (see
`ptrauth_string_discriminator`) of the mangled name of the overridden
method. This notably provides diversity based on the full signature of
the overridden method, including the method name and parameter types.
This patch introduces ItaniumVTableContext logic to find the original
declaration of the overridden method.
On AArch64, these pointers are signed using the `IA` key (the
process-independent code key.)

V-table pointers can be signed with either no discrimination, or a
similar scheme using address and decl-based discrimination. In this
case, the integer discriminator is the string hash of the mangled
v-table identifier of the class that originally introduced the vtable
pointer.
On AArch64, these pointers are signed using the `DA` key (the
process-independent data key.)

Not using discrimination allows attackers to simply copy valid v-table
pointers from one object to another. However, using a uniform
discriminator of 0 does have positive performance and code-size
implications on AArch64, and diversity for the most important v-table
access pattern (virtual dispatch) is already better assured by the
signing schemas used on the virtual functions. It is also known that
some code in practice copies objects containing v-tables with `memcpy`,
and while this is not permitted formally, it is something that may be
invasive to eliminate.

This is controlled by:
```
  -fptrauth-vtable-pointer-type-discrimination
  -fptrauth-vtable-pointer-address-discrimination
```

In addition, this provides fine-grained controls in the
ptrauth_vtable_pointer attribute, which allows overriding the default
ptrauth schema for vtable pointers on a given class hierarchy, e.g.:
```
  [[clang::ptrauth_vtable_pointer(no_authentication, no_address_discrimination, 
                                  no_extra_discrimination)]]
  [[clang::ptrauth_vtable_pointer(default_key, default_address_discrimination,
                                  custom_discrimination, 0xf00d)]]
```

The override is then mangled as a parametrized vendor extension:
```
"__vtptrauth" I
 &lt;key&gt;
 &lt;addressDiscriminated&gt;
 &lt;extraDiscriminator&gt;
E
```

To support this attribute, this patch adds a small extension to the
attribute-emitter tablegen backend.

Note that there are known areas where signing is either missing
altogether or can be strengthened. Some will be addressed in later
changes (e.g., member function pointers, some RTTI).
`dynamic_cast` in particular is handled by emitting an artificial
v-table pointer load (in a way that always authenticates it) before the
runtime call itself, as the runtime doesn't have enough information
today to properly authenticate it. Instead, the runtime is currently
expected to strip the v-table pointer.

---------

Co-authored-by: John McCall &lt;rjmccall@apple.com&gt;
Co-authored-by: Ahmed Bougacha &lt;ahmed@bougacha.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[clang][codegen][NFC] Improve const correctness</title>
<updated>2024-06-23T14:35:06+00:00</updated>
<author>
<name>Timm Bäder</name>
<email>tbaeder@redhat.com</email>
</author>
<published>2024-06-21T07:33:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8990763d2c974a179dd0ed42b0cfb7b8b60e9c0c'/>
<id>8990763d2c974a179dd0ed42b0cfb7b8b60e9c0c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang] Implement function pointer signing and authenticated function calls (#93906)</title>
<updated>2024-06-21T17:20:15+00:00</updated>
<author>
<name>Ahmed Bougacha</name>
<email>ahmed@bougacha.org</email>
</author>
<published>2024-06-21T17:20:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e23250ecb7e09170e584db60375100790f39fac9'/>
<id>e23250ecb7e09170e584db60375100790f39fac9</id>
<content type='text'>
The functions are currently always signed/authenticated with zero
discriminator.

Co-Authored-By: John McCall &lt;rjmccall@apple.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The functions are currently always signed/authenticated with zero
discriminator.

Co-Authored-By: John McCall &lt;rjmccall@apple.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[clang] Define ptrauth_sign_constant builtin. (#93904)</title>
<updated>2024-06-20T19:09:54+00:00</updated>
<author>
<name>Ahmed Bougacha</name>
<email>ahmed@bougacha.org</email>
</author>
<published>2024-06-20T19:09:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566'/>
<id>7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566</id>
<content type='text'>
This is a constant-expression equivalent to
ptrauth_sign_unauthenticated.  Its constant nature lets us guarantee
a non-attackable sequence is generated, unlike
ptrauth_sign_unauthenticated which we generally discourage using.

It being a constant also allows its usage in global initializers, though
requiring constant pointers and discriminators.

The value must be a constant expression of pointer type which evaluates
to a non-null pointer.

The key must be a constant expression of type ptrauth_key.
The extra data must be a constant expression of pointer or integer type;
if an integer, it will be coerced to ptrauth_extra_data_t.
The result will have the same type as the original value.

This can be used in constant expressions.

Co-authored-by: John McCall &lt;rjmccall@apple.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a constant-expression equivalent to
ptrauth_sign_unauthenticated.  Its constant nature lets us guarantee
a non-attackable sequence is generated, unlike
ptrauth_sign_unauthenticated which we generally discourage using.

It being a constant also allows its usage in global initializers, though
requiring constant pointers and discriminators.

The value must be a constant expression of pointer type which evaluates
to a non-null pointer.

The key must be a constant expression of type ptrauth_key.
The extra data must be a constant expression of pointer or integer type;
if an integer, it will be coerced to ptrauth_extra_data_t.
The result will have the same type as the original value.

This can be used in constant expressions.

Co-authored-by: John McCall &lt;rjmccall@apple.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (#95802)</title>
<updated>2024-06-20T12:38:46+00:00</updated>
<author>
<name>Mariya Podchishchaeva</name>
<email>mariya.podchishchaeva@intel.com</email>
</author>
<published>2024-06-20T12:38:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=41c6e4379204ffc00948edd33d59ba5ebbceaba2'/>
<id>41c6e4379204ffc00948edd33d59ba5ebbceaba2</id>
<content type='text'>
This commit implements the entirety of the now-accepted [N3017
-Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded by
AST consumers (CodeGen or constant expression evaluators) or expand
embed directive as a comma expression.

This reverts commit
https://github.com/llvm/llvm-project/commit/682d461d5a231cee54d65910e6341769419a67d7.

---------

Co-authored-by: The Phantom Derpstorm &lt;phdofthehouse@gmail.com&gt;
Co-authored-by: Aaron Ballman &lt;aaron@aaronballman.com&gt;
Co-authored-by: cor3ntin &lt;corentinjabot@gmail.com&gt;
Co-authored-by: H. Vetinari &lt;h.vetinari@gmx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements the entirety of the now-accepted [N3017
-Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded by
AST consumers (CodeGen or constant expression evaluators) or expand
embed directive as a comma expression.

This reverts commit
https://github.com/llvm/llvm-project/commit/682d461d5a231cee54d65910e6341769419a67d7.

---------

Co-authored-by: The Phantom Derpstorm &lt;phdofthehouse@gmail.com&gt;
Co-authored-by: Aaron Ballman &lt;aaron@aaronballman.com&gt;
Co-authored-by: cor3ntin &lt;corentinjabot@gmail.com&gt;
Co-authored-by: H. Vetinari &lt;h.vetinari@gmx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (#95299)</title>
<updated>2024-06-12T20:14:26+00:00</updated>
<author>
<name>Vitaly Buka</name>
<email>vitalybuka@google.com</email>
</author>
<published>2024-06-12T20:14:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=682d461d5a231cee54d65910e6341769419a67d7'/>
<id>682d461d5a231cee54d65910e6341769419a67d7</id>
<content type='text'>
Reverts llvm/llvm-project#68620

Introduce or expose a memory leak and UB, see llvm/llvm-project#68620</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#68620

Introduce or expose a memory leak and UB, see llvm/llvm-project#68620</pre>
</div>
</content>
</entry>
<entry>
<title>[clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (#68620)</title>
<updated>2024-06-12T07:16:02+00:00</updated>
<author>
<name>The Phantom Derpstorm</name>
<email>phdofthehouse@gmail.com</email>
</author>
<published>2024-06-12T07:16:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5989450e0061dce8cff89d8acfdd5225c14cd065'/>
<id>5989450e0061dce8cff89d8acfdd5225c14cd065</id>
<content type='text'>
This commit implements the entirety of the now-accepted [N3017 -
Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded
by AST consumers (CodeGen or constant expression evaluators) or
expand embed directive as a comma expression.

---------

Co-authored-by: Aaron Ballman &lt;aaron@aaronballman.com&gt;
Co-authored-by: cor3ntin &lt;corentinjabot@gmail.com&gt;
Co-authored-by: H. Vetinari &lt;h.vetinari@gmx.com&gt;
Co-authored-by: Podchishchaeva, Mariya &lt;mariya.podchishchaeva@intel.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements the entirety of the now-accepted [N3017 -
Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded
by AST consumers (CodeGen or constant expression evaluators) or
expand embed directive as a comma expression.

---------

Co-authored-by: Aaron Ballman &lt;aaron@aaronballman.com&gt;
Co-authored-by: cor3ntin &lt;corentinjabot@gmail.com&gt;
Co-authored-by: H. Vetinari &lt;h.vetinari@gmx.com&gt;
Co-authored-by: Podchishchaeva, Mariya &lt;mariya.podchishchaeva@intel.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[clang] Replace X &amp;&amp; isa&lt;Y&gt;(X) with isa_and_nonnull&lt;Y&gt;(X). NFC (#94987)</title>
<updated>2024-06-11T02:30:50+00:00</updated>
<author>
<name>Pavel Samolysov</name>
<email>samolisov@gmail.com</email>
</author>
<published>2024-06-11T02:30:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=69e9e779b783bb34a3c1f73c93ca63ee6b89ab09'/>
<id>69e9e779b783bb34a3c1f73c93ca63ee6b89ab09</id>
<content type='text'>
This addresses a clang-tidy suggestion.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This addresses a clang-tidy suggestion.</pre>
</div>
</content>
</entry>
<entry>
<title>[CodeGen] Support arrays with initializers of 64-bit size</title>
<updated>2024-05-17T17:59:39+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-05-17T17:59:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f7516c7f3f00fca7271056cc9abeda2da4687c17'/>
<id>f7516c7f3f00fca7271056cc9abeda2da4687c17</id>
<content type='text'>
Based on @OfekShochat's https://reviews.llvm.org/D133648

init.c is the primary test for array initialization, but it uses a
32-bit triple, which would lead to an "array is too large" error. Add
the new test to array-init.c instead.

Fix #57353

Pull Request: https://github.com/llvm/llvm-project/pull/92473
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Based on @OfekShochat's https://reviews.llvm.org/D133648

init.c is the primary test for array initialization, but it uses a
32-bit triple, which would lead to an "array is too large" error. Add
the new test to array-init.c instead.

Fix #57353

Pull Request: https://github.com/llvm/llvm-project/pull/92473
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang][CodeGen][NFC] Make ConstExprEmitter a ConstStmtVisitor (#89041)</title>
<updated>2024-04-23T04:04:15+00:00</updated>
<author>
<name>Timm Baeder</name>
<email>tbaeder@redhat.com</email>
</author>
<published>2024-04-23T04:04:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e5f9de89e540b06893709d97f3ce9671071b3df0'/>
<id>e5f9de89e540b06893709d97f3ce9671071b3df0</id>
<content type='text'>
No reason for this to not be one. This gets rid of a few const_casts.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No reason for this to not be one. This gets rid of a few const_casts.</pre>
</div>
</content>
</entry>
</feed>
