b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 893a55831e5abbcd15b171db66fa1f389fb61506 Mon Sep 17 00:00:00 2001 |
| 2 | From: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| 3 | Date: Tue, 7 May 2024 19:32:16 +0200 |
| 4 | Subject: Makefile: Move -pie to LDFLAGS |
| 5 | |
| 6 | Move -pie from LDLIBS to LDFLAGS and make LDFLAGS configurable to allow |
| 7 | the user to drop it by setting their own LDFLAGS (e.g. PIE could be |
| 8 | enabled or disabled by the buildsystem such as buildroot). |
| 9 | |
| 10 | Suggested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> |
| 11 | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| 12 | Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> |
| 13 | --- |
| 14 | Makefile | 4 ++-- |
| 15 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 16 | |
| 17 | --- a/Makefile |
| 18 | +++ b/Makefile |
| 19 | @@ -132,12 +132,12 @@ CFLAGS += -DUSE_PTHREADS |
| 20 | MON_LDFLAGS += -pthread |
| 21 | endif |
| 22 | |
| 23 | -LDFLAGS = -Wl,-z,now,-z,noexecstack |
| 24 | +LDFLAGS ?= -pie -Wl,-z,now,-z,noexecstack |
| 25 | |
| 26 | # If you want a static binary, you might uncomment these |
| 27 | # LDFLAGS += -static |
| 28 | # STRIP = -s |
| 29 | -LDLIBS = -ldl -pie |
| 30 | +LDLIBS = -ldl |
| 31 | |
| 32 | # To explicitly disable libudev, set -DNO_LIBUDEV in CXFLAGS |
| 33 | ifeq (, $(findstring -DNO_LIBUDEV, $(CXFLAGS))) |