When we add -ffreestanding the compiler won't get to inline this any more. Signed-off-by: David Woodhouse <dwmw2 at infradead.org> --- com32/lib/math/fabs.S | 15 +++++++++++++++ mk/lib.mk | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 com32/lib/math/fabs.S diff --git a/com32/lib/math/fabs.S b/com32/lib/math/fabs.S new file mode 100644 index 00000000..794a53c0 --- /dev/null +++ b/com32/lib/math/fabs.S @@ -0,0 +1,15 @@ +/* + * fabs.S + * + * double fabs(double x) + */ + + .text + .globl fabs + .type fabs, at function +fabs: + fldl 4(%esp) + fabs + ret + + .size fabs,.-fabs diff --git a/mk/lib.mk b/mk/lib.mk index 54f1fd54..d5660242 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -107,7 +107,7 @@ LIBOTHER_OBJS = \ pci/readb.o pci/readw.o pci/readl.o \ pci/writeb.o pci/writew.o pci/writel.o \ \ - sys/x86_init_fpu.o math/pow.o math/strtod.o \ + sys/x86_init_fpu.o math/pow.o math/fabs.o math/strtod.o \ syslinux/disk.o \ \ syslinux/setup_data.o -- 2.17.1
David Woodhouse
2018-Aug-02 11:53 UTC
[syslinux] [PATCH 2/2] Add -ffreestanding to compiler flags
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