[PATCH v1 0/4] aarch64 gas: various fixes for memory leaks
Matthieu Longo
matthieu.longo@arm.com
Tue Feb 24 16:26:13 GMT 2026
This patch series contains fixes for memory leaks in the GAS AArch64 backend. These leaks were identified using LeakSanitizer.
The issues can be reproduced with the following configure options:
../configure \
--target=aarch64-none-linux-gnu \
--enable-maintainer-mode \
CFLAGS="-DDEBUG_AARCH64 -O0 -g3 -fsanitize=address" \
CXXFLAGS="-DDEBUG_AARCH64 -O0 -g3 -fsanitize=address" \
--disable-gdb --disable-gdbtk --disable-nls \
--disable-tui --without-gdb --without-x \
--srcdir=..
The first patch is a republication of patch 7/7 from [1]. Since it is related to patch 4/4, these two patches should be reviewed together, as they adopt different approaches to solve a similar problem. This divergence is intentional because the constraints are slightly different; one is not an alternative to the other.
The second patch is a minor refactoring changing some function signatures to return a bool instead of a int.
Finally, the third patch simplifies the feature-set lifetime management and fixes the associated memory leaks.
Once this series is merged, the GAS testsuite configured for AArch64 targets will be free of memory leaks and will no longer trigger LeakSanitizer. It can then serve as a clean baseline for CI builds of binutils with AddressSanitizer and LeakSanitizer enabled.
Regards,
Matthieu
[1]: https://inbox.sourceware.org/binutils/20260203100048.1022743-1-matthieu.longo@arm.com/
Matthieu Longo (4):
aarch64 gas: free hash tables in md_begin() to avoid memory leaks
aarch64 gas: use bool return type for sub-option parsing
aarch64 gas: simplify feature-set lifetime management and fix leaks
aarch64 gas: track and free dynamically allocated register aliases
gas/config/tc-aarch64.c | 288 ++++++++++++++----
gas/config/tc-aarch64.h | 3 +
gas/testsuite/gas/aarch64/register_aliases.d | 4 +
gas/testsuite/gas/aarch64/register_aliases.s | 10 +-
.../gas/aarch64/register_aliases_invalid.l | 7 +
.../gas/aarch64/register_aliases_invalid.s | 21 +-
6 files changed, 267 insertions(+), 66 deletions(-)
--
2.53.0
More information about the Binutils
mailing list