2 Commits

Author SHA1 Message Date
Gergely Bálint
674f308324
[BOLT][BTI] Add needed BTIs in LongJmp or refuse to optimize binary (#171149)
This patch adds BTI landing pads to ShortJmp/LongJmp targets in the
LongJmp pass when optimizing BTI binaries.

BOLT does not have the ability to add BTI to all types of functions.
This patch aims to insert the landing pad where possible, and emit an
error and exit where it currently is not.

BOLT cannot insert BTIs into several function "types", including:
- ignored functions,
- PLT functions,
- other functions without a CFG.

Additional context:

In #161206, BOLT gained the ability to decode the .note.gnu.property
section, and warn about lack of BTI support for BOLT. However, this
warning is misleading: the emitted binary may not need extra BTI landing
pads.

With this patch, the emitted binary will be "BTI-safe".
2025-12-22 12:24:42 +01:00
Gergely Bálint
441f0c7c9a
[BOLT] Add GNUPropertyRewriter and warn on AArch64 BTI note (#161206)
This commit adds the GNUPropertyRewriter, which parses features from the
.note.gnu.property section.

Currently we only read the bit indicating BTI support
(GNU_PROPERTY_AARCH64_FEATURE_1_BTI).

As BOLT does not add BTI landing pads to targets of indirect
branches/calls, we have to emit a warning that the output binary may be
corrupted.
2025-10-03 09:45:56 +02:00