1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Note: yes, we do not want stack protection in the pgadjust.o output.
---
initrd/Makefile | 10 +++++-----
src/srclinux/Makefile | 10 ++++++----
2 files changed, 11 insertions(+), 9 deletions(-)
--- a/initrd/Makefile
+++ b/initrd/Makefile
@@ -1,16 +1,16 @@
CC = gcc
-CFLAGS = -O2 -fomit-frame-pointer
+CFLAGS ?= -O2
+CFLAGS += -fomit-frame-pointer
all: initdisk freeramdisk Makefile
-linuxrc: linuxrc.c
- $(CC) $(CFLAGS) -static -o linuxrc linuxrc.c
+linuxrc: linuxrc.o
+linuxrc: LDFLAGS+=-static
initdisk: linuxrc Makefile freeramdisk mkdisk
./mkdisk linuxrc
-freeramdisk: freeramdisk.c
- $(CC) $(CFLAGS) -o freeramdisk freeramdisk.c
+freeramdisk: freeramdisk.o
clean:
rm -f hello initdisk freeramdisk *~ *.o linuxrc
--- a/src/srclinux/Makefile
+++ b/src/srclinux/Makefile
@@ -6,7 +6,8 @@ SYS_SIZE = -DSYS_SIZE=0xFFFF
OBJECTS = $(HEAD) pgadjust.o
-CFLAGS = -D__KERNEL__ -march=i386 -Os -DSTDC_HEADERS -fomit-frame-pointer \
+CFLAGS += -fcf-protection=none \
+ -D__KERNEL__ -march=i386 -Os -DSTDC_HEADERS -fomit-frame-pointer \
-fno-strength-reduce -fPIC -ffreestanding -fno-stack-protector
CC=gcc -m32
@@ -25,17 +26,18 @@ pgadjust.out: pgadjust Makefile
# objdump -k -q -o $(IMAGE_OFFSET) pgadjust > pgadjust.out
loadlinh.o: loadlinh.S
- $(CC) -traditional -c loadlinh.S
+ $(CC) $(CPPFLAGS) -traditional -c loadlinh.S
pgadjust: $(OBJECTS) Makefile
ld -m elf_i386 -Ttext $(IMAGE_OFFSET) -N -e startup_32 -o pgadjust $(OBJECTS)
# this avoids page align ^^ (and holes between sections)
pgadjust.o: pgadjust.c
- $(CC) $(CFLAGS) -c pgadjust.c -o pgadjust.o
+ echo blhc: ignore-line-regexp: .*-fno-stack-protector.*
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c pgadjust.c -o pgadjust.o
testpg: pgadjust.c
- $(CC) $(CFLAGS) -DSTANDALONE_DEBUG -o testpg pgadjust.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSTANDALONE_DEBUG -o testpg pgadjust.c
clean:
rm -f $(OBJECTS) ../pgadjust.asm pgadjust.out pgadjust
|