From 4561fc3586957f5d745bc9eb3baf8d859897da17 Mon Sep 17 00:00:00 2001 From: Stefan Bucur Date: Mon, 12 May 2008 21:47:23 +0300 Subject: [PATCH] Fixed the various Makefiles so that SYSLINUX compiles on platforms with GCC -fstack-protector flag enabled by default. --- com32/lib/MCONFIG | 2 +- com32/libutil/Makefile | 2 +- com32/menu/Makefile | 2 +- com32/modules/Makefile | 2 +- com32/samples/Makefile | 2 +- dos/Makefile | 3 ++- extlinux/Makefile | 2 +- memdisk/Makefile | 3 ++- memdump/Makefile | 3 ++- sample/Makefile | 3 ++- 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG index e9b2941..2e36597 100644 --- a/com32/lib/MCONFIG +++ b/com32/lib/MCONFIG @@ -1,13 +1,13 @@ # -*- makefile -*- TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) GCCOPT := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld INCLUDE = -I. AR = ar diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile index 5514f8b..01de06a 100644 --- a/com32/libutil/Makefile +++ b/com32/libutil/Makefile @@ -30,13 +30,13 @@ ## TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 AR = ar NASM = nasm diff --git a/com32/menu/Makefile b/com32/menu/Makefile index 4e0abc5..8d7b69f 100644 --- a/com32/menu/Makefile +++ b/com32/menu/Makefile @@ -15,13 +15,13 @@ ## TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 AR = ar NASM = nasm diff --git a/com32/modules/Makefile b/com32/modules/Makefile index 690183e..f7f12f0 100644 --- a/com32/modules/Makefile +++ b/com32/modules/Makefile @@ -15,13 +15,13 @@ ## TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 AR = ar NASM = nasm diff --git a/com32/samples/Makefile b/com32/samples/Makefile index 189dc18..77feb58 100644 --- a/com32/samples/Makefile +++ b/com32/samples/Makefile @@ -15,13 +15,13 @@ ## TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 AR = ar NASM = nasm diff --git a/dos/Makefile b/dos/Makefile index 4f344f4..964c7fd 100644 --- a/dos/Makefile +++ b/dos/Makefile @@ -1,5 +1,7 @@ TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc + gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) @@ -7,7 +9,6 @@ M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) \ $(call gcc_ok,-fno-stack-protector,) \ $(call gcc_ok,-fno-top-level-reorder,$(call gcc_ok,-fno-unit-at-a-time)) -CC = gcc LD = ld -m elf_i386 OBJCOPY = objcopy OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer diff --git a/extlinux/Makefile b/extlinux/Makefile index 9dd7ec9..f426702 100644 --- a/extlinux/Makefile +++ b/extlinux/Makefile @@ -1,4 +1,5 @@ TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) ../dummy.c -o $$tmpf 2>/dev/null; \ then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf) @@ -6,7 +7,6 @@ gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) ../dummy.c -o $$tmpf 2>/dev/nu comma := , LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) -CC = gcc OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libinstaller CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) diff --git a/memdisk/Makefile b/memdisk/Makefile index d9cc7f9..3c288ca 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -14,6 +14,8 @@ VERSION := $(shell cat ../version) TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc + gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) @@ -21,7 +23,6 @@ M32 := $(call gcc_ok,-m32,) ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0) FREE := $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc CFLAGS = $(M32) $(FREE) -g -W -Wall -Wno-sign-compare \ -Os -fomit-frame-pointer -march=i386 $(ALIGN) \ -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"' diff --git a/memdump/Makefile b/memdump/Makefile index 585381d..60c4229 100644 --- a/memdump/Makefile +++ b/memdump/Makefile @@ -1,11 +1,12 @@ TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc + gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 OBJCOPY = objcopy OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer diff --git a/sample/Makefile b/sample/Makefile index cf0d3f1..d2a00f9 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -16,12 +16,13 @@ TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) +CC = gcc + gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ then echo $(1); else echo $(2); fi; rm -f $$tmpf) M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,) -CC = gcc LD = ld -m elf_i386 AR = ar NASM = nasm -- 2.7.4