mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-20 07:16:46 +02:00
29 lines
952 B
Diff
29 lines
952 B
Diff
From 0a876ce2825f1e54bec7059a387e43a2e0386665 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Kolesa <daniel@octaforge.org>
|
|
Date: Sun, 23 Oct 2022 01:02:35 +0200
|
|
Subject: [PATCH 2/4] clang: enable fortify by default on optimizing musl
|
|
targets
|
|
|
|
---
|
|
lib/Frontend/InitPreprocessor.cpp | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
|
|
index 20bfbf144..9095c0f2f 100644
|
|
--- a/lib/Frontend/InitPreprocessor.cpp
|
|
+++ b/lib/Frontend/InitPreprocessor.cpp
|
|
@@ -1508,6 +1508,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|
#undef TARGET_OS
|
|
}
|
|
|
|
+ // Enable fortify by default on musl when optimizing, but not with asan
|
|
+ if (TI.getTriple().isMusl() && LangOpts.Optimize &&
|
|
+ !LangOpts.Sanitize.has(SanitizerKind::Address))
|
|
+ Builder.defineMacro("_FORTIFY_SOURCE", "2");
|
|
+
|
|
// Get other target #defines.
|
|
TI.getTargetDefines(LangOpts, Builder);
|
|
}
|
|
--
|
|
2.38.0
|
|
|