summaryrefslogtreecommitdiff
path: root/0001-Fix-CPPFLAGS-in-test-Makefile.patch
blob: 22dd89b6705892ab0c041d497b7094e86325e8f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From a33d2ca97d119ef657207fc27248db4c3103531f Mon Sep 17 00:00:00 2001
From: Thibaut Sautereau <thibaut@sautereau.fr>
Date: Tue, 2 Nov 2021 20:22:05 +0100
Subject: [PATCH] Fix CPPFLAGS in test Makefile

In particular, the _GNU_SOURCE feature test macro needs to be set in
order to correctly define mmap(2) flags such as MAP_ANONYMOUS.
Otherwise, compilation of some test files fails when CPPFLAGS is not
defined in the initial user environment, as Make then does not export it
from the root Makefile to the sub-make.
---
 test/simple-memory-corruption/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/simple-memory-corruption/Makefile b/test/simple-memory-corruption/Makefile
index 609677e7e670..d217b4806565 100644
--- a/test/simple-memory-corruption/Makefile
+++ b/test/simple-memory-corruption/Makefile
@@ -6,7 +6,8 @@ ifeq (,$(filter $(CONFIG_SLAB_CANARY),true false))
     $(error CONFIG_SLAB_CANARY must be true or false)
 endif
 
-CFLAGS += -DSLAB_CANARY=$(CONFIG_SLAB_CANARY)
+CPPFLAGS += -D_GNU_SOURCE \
+    -DSLAB_CANARY=$(CONFIG_SLAB_CANARY)
 
 LDLIBS := -lhardened_malloc
 
-- 
2.33.1