Message ID | 20230731065904.5869-2-akihiko.odaki@daynix.com |
---|---|
State | New |
Headers | show |
Series | Accompany -nostdlib with -fno-stack-protector | expand |
On 31/07/2023 08.58, Akihiko Odaki wrote: > A build of GCC 13.2 will have stack protector enabled by default if it > was configured with --enable-default-ssp option. For such a compiler, > it is necessary to explicitly disable stack protector when linking > without standard libraries. > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > --- > pc-bios/optionrom/Makefile | 2 +- > pc-bios/s390-ccw/Makefile | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile > index b1fff0ba6c..f220d81f2c 100644 > --- a/pc-bios/optionrom/Makefile > +++ b/pc-bios/optionrom/Makefile > @@ -19,7 +19,7 @@ quiet-command = $(call quiet-@,$2 $@)$1 > override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d > > override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16 > -override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include > +override CFLAGS += -ffreestanding -fno-stack-protector -I$(TOPSRC_DIR)/include > > cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null > cc-option = if $(call cc-test, $1); then \ > diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile > index acfcd1e71a..446d448913 100644 > --- a/pc-bios/s390-ccw/Makefile > +++ b/pc-bios/s390-ccw/Makefile > @@ -38,7 +38,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ > EXTRA_CFLAGS += -Wall > EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE > EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables > -EXTRA_CFLAGS += -msoft-float > +EXTRA_CFLAGS += -fno-stack-protector -msoft-float > EXTRA_CFLAGS += -std=gnu99 > LDFLAGS += -Wl,-pie -nostdlib > Both Makefiles seem to add -no-stack-protector in other lines already, so this patch does not seem to be necessary? Thomas
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index b1fff0ba6c..f220d81f2c 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -19,7 +19,7 @@ quiet-command = $(call quiet-@,$2 $@)$1 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16 -override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include +override CFLAGS += -ffreestanding -fno-stack-protector -I$(TOPSRC_DIR)/include cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null cc-option = if $(call cc-test, $1); then \ diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index acfcd1e71a..446d448913 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -38,7 +38,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ EXTRA_CFLAGS += -Wall EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables -EXTRA_CFLAGS += -msoft-float +EXTRA_CFLAGS += -fno-stack-protector -msoft-float EXTRA_CFLAGS += -std=gnu99 LDFLAGS += -Wl,-pie -nostdlib
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> --- pc-bios/optionrom/Makefile | 2 +- pc-bios/s390-ccw/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)