From a34006f8e9c1f80e1446d1007bfff3ffefef4d23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 25 Feb 2024 03:22:08 +0100 Subject: [PATCH] Makefile: Pass CFLAGS also when linking executable Optimization flags like -O2 from $(OPT) passed via $(CFLAGS) used during compiling individual object files are ignored when gcc's LTO is enabled for the linking final executable. Optimization flags used for compiling individual object files should be same as optimization flags for linking final executable. Fix propagation of $(CFLAGS) and $(OPT) when LTO is enabled. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aaec04e..37333c1 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ pcilmr$(EXEEXT): pcilmr.o $(LMROBJS) $(COMMON) lib/$(PCIIMPLIB) pcilmr.o: pcilmr.c $(LMRINC) %$(EXEEXT): %.o - $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ ifdef PCI_OS_WINDOWS comma := , -- 2.39.2