[syslinux] [PATCH 2/2] Add -ffreestanding to compiler flags

David Woodhouse dwmw2 at infradead.org
Thu Aug 2 04:53:55 PDT 2018


Without it, the Fedora build with GCC 8.1.1 was observed to turn a section
of code calling pow() in zzjson_parse.c::parse_value() into a presumably
more efficient sequence calling exp(). Which didn't exist, causing libgpl
to fail to load:

Undef symbol FAIL: exp
Failed to load libgpl.c32

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 dos/Makefile | 2 +-
 mk/com32.mk  | 4 ++--
 mk/efi.mk    | 2 +-
 mk/elf.mk    | 2 +-
 mk/lib.mk    | 2 +-
 mk/rosh.mk   | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dos/Makefile b/dos/Makefile
index 4c930d19..5b5aa33d 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -21,7 +21,7 @@ CFLAGS	+= -D__MSDOS__ -mregparm=3 -DREGPARM=3
 
 LDFLAGS	 = -T $(SRC)/dosexe.ld
 OPTFLAGS = -g
-INCLUDES = -include code16.h -nostdinc -iwithprefix include \
+INCLUDES = -include code16.h -ffreestanding -nostdinc -iwithprefix include \
 	   -I$(SRC) -I$(SRC)/.. -I$(SRC)/../libfat \
 	   -I $(SRC)/../libinstaller -I $(SRC)/../libinstaller/getopt \
 	   -I$(objdir)
diff --git a/mk/com32.mk b/mk/com32.mk
index aeb8a2cc..6f7f0e0d 100644
--- a/mk/com32.mk
+++ b/mk/com32.mk
@@ -66,14 +66,14 @@ endif
 
 CFLAGS     = $(GCCOPT) $(GCCWARN) \
 	     -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
-	     -nostdinc -iwithprefix include \
+	     -ffreestanding -nostdinc -iwithprefix include \
 	     -I$(com32)/libutil/include -I$(com32)/include \
 	     -I$(com32)/include/sys $(GPLINCLUDE) \
 	     -I$(topdir)/core \
 	     -I$(topdir)/core/include
 SFLAGS     = $(GCCOPT) $(GCCWARN) \
 	     -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
-	     -nostdinc -iwithprefix include \
+	     -ffreestanding -nostdinc -iwithprefix include \
 	     -I$(com32)/libutil/include -I$(com32)/include \
 	     -I$(com32)/include/sys $(GPLINCLUDE) \
 	     -I$(topdir)/core \
diff --git a/mk/efi.mk b/mk/efi.mk
index f097ad22..0201c4ff 100644
--- a/mk/efi.mk
+++ b/mk/efi.mk
@@ -41,7 +41,7 @@ LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc
 
 SFLAGS     = $(GCCOPT) $(GCCWARN) $(ARCHOPT) \
 	     -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
-	     -nostdinc -iwithprefix include \
+	     -ffreestanding -nostdinc -iwithprefix include \
 	     -I$(com32)/libutil/include -I$(com32)/include -I$(com32)/include/sys $(GPLINCLUDE)
 
 LIBEFI = $(objdir)/lib/libefi.a
diff --git a/mk/elf.mk b/mk/elf.mk
index b46dbd06..51990b00 100644
--- a/mk/elf.mk
+++ b/mk/elf.mk
@@ -56,7 +56,7 @@ endif
 
 CFLAGS     = $(GCCOPT) $(GCCWARN) -W -Wall \
 	     -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -DDYNAMIC_MODULE \
-	     -nostdinc -iwithprefix include \
+	     -ffreestanding -nostdinc -iwithprefix include \
 	     -I$(com32)/libutil/include -I$(com32)/include \
 		-I$(com32)/include/sys $(GPLINCLUDE) -I$(core)/include \
 		-I$(objdir) -DLDLINUX=\"$(LDLINUX)\"
diff --git a/mk/lib.mk b/mk/lib.mk
index d5660242..6fbf6568 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -44,7 +44,7 @@ LIBFLAGS = -DDYNAMIC_CRC_TABLE -DPNG_NO_CONSOLE_IO \
 # LIBFLAGS += -DPNG_NO_FLOATING_POINT_SUPPORTED
 
 REQFLAGS  = $(GCCOPT) -g -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
-	    -nostdinc -iwithprefix include -I. -I$(SRC)/sys \
+	    -ffreestanding -nostdinc -iwithprefix include -I. -I$(SRC)/sys \
 	    -I$(SRC)/../include -I$(com32)/include/sys \
 	    -I$(topdir)/core/include -I$(com32)/lib/ \
 	    -I$(com32)/lib/sys/module -I$(OBJ)/../..
diff --git a/mk/rosh.mk b/mk/rosh.mk
index 68693488..9889fdc8 100644
--- a/mk/rosh.mk
+++ b/mk/rosh.mk
@@ -19,7 +19,7 @@ include $(MAKEDIR)/elf.mk
 
 # CFLAGS     = $(GCCOPT) $(GCCWARN) -march=i386 \
 # 	     -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
-# 	     -nostdinc -iwithprefix include \
+# 	     -ffreestanding -nostdinc -iwithprefix include \
 # 	     -I$(com32)/libutil/include -I$(com32)/include
 # 	 -g3 -dD
 
-- 
2.17.1



More information about the Syslinux mailing list