From 67dbf094b22d00cce34e4c425acecfb18600ccb3 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 31 Jan 2022 17:43:31 +0000 Subject: [PATCH] genprotimg/zipl: boot: Makefile: do not link against shared libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's pretty obvious that we don't want to link against shared libraries therefore use `-static` for linking. `ld` call before this change: /usr/bin/ld -v -plugin /usr/lib/gcc/s390x-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/s390x-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccLfGZu4.res --build-id --eh-frame-hdr -m elf64_s390 --hash-style=gnu --as-needed -dynamic-linker /lib/ld64.so.1 -z relro -o stage3.exec -L/usr/lib/gcc/s390x-linux-gnu/9 -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../s390x-linux-gnu/lib/../lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../../s390x-linux-gnu -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../lib -L/lib/s390x-linux-gnu -L/lib/../lib -L/usr/lib/s390x-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../s390x-linux-gnu/lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../.. -T stage3.lds stage3.o head.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o sclp_stage3.o kdump.o entry.o `ld` call after this change: /usr/bin/ld -v -plugin /usr/lib/gcc/s390x-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/s390x-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccw0ELAp.res --build-id -m elf64_s390 --hash-style=gnu --as-needed -static -z relro -o stage3.exec -L/usr/lib/gcc/s390x-linux-gnu/9 -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../s390x-linux-gnu/lib/../lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../../s390x-linux-gnu -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../lib -L/lib/s390x-linux-gnu -L/lib/../lib -L/usr/lib/s390x-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../../../s390x-linux-gnu/lib -L/usr/lib/gcc/s390x-linux-gnu/9/../../.. -T stage3.lds stage3.o head.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o sclp_stage3.o kdump.o entry.o Fixes: b627b8d8e1ab ("Initial s390-tools-2.0.0 import") Fixes: 3356d6f4facd ("genprotimg: boot: initial bootloader support") Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Reviewed-by: Halil Pasic Reviewed-by: Stefan Haberland Signed-off-by: Jan Höppner --- genprotimg/boot/Makefile | 2 +- zipl/boot/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index 95bd6cc1..d71afdb1 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -79,7 +79,7 @@ stage3b_reloc.elf: stage3b) SFLAGS="$(NO_PIE_LDFLAGS) -nostdlib -Wl,-T,stage3b.lds";; \ stage3b_reloc) SFLAGS="$(NO_PIE_LDFLAGS) -nostdlib -Wl,-estage3b_reloc_start,-Ttext,0";; \ esac; \ - $(LINK) $$SFLAGS -m64 $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS -m64 -static $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin: %.elf diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index f4a68a9e..04a58952 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -74,7 +74,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \ 2) SFLAGS="$(NO_PIE_LDFLAGS) -nostdlib -Wl,-T,stage2.lds";; \ 3) SFLAGS="$(NO_PIE_LDFLAGS) -nostdlib -Wl,-T,stage3.lds";; \ esac; \ - $(LINK) $$SFLAGS -m64 $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS -m64 -static $(filter %.o, $^) -o $@ %.bin: %.exec $(OBJCOPY) -O binary \