pc-bios/s390-ccw: Small Makefile improvements
cover pc-bios/s390-ccw: Small Makefile improvements
Jens Remus (2):
pc-bios/s390-ccw: Clarify alignment is in bytes
pc-bios/s390-ccw: Don't generate TEXTRELs
Marc Hartmayer (1):
pc-bios/s390-ccw: Introduce EXTRA_LDFLAGS
pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/Makefile | 5 +++-- pc-bios/s390-ccw/start.S | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-)
base-commit: 718780d20470c66a3a36d036b29148d5809dc855
Signature · 1 line
2.43.0
PATCH 1/3 pc-bios/s390-ccw: Clarify alignment is in bytes
From: Jens Remus <[email protected]>
The assembler directive .align [1] has architecture-dependent behavior, which may be ambiguous for the reader. Some architectures perform the alignment in bytes, others in power of two. s390 does in bytes.
Use the directive .balign [2] instead, to clarify that the alignment request is in bytes. No functional change.
[1] https://sourceware.org/binutils/docs/as/Align.html
[2] https://sourceware.org/binutils/docs/as/Balign.html
--- pc-bios/s390-ccw/start.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/start.S +2 -2
@@ -112,7 +112,7 @@ io_new_code: lctlg %c6,%c6,0(%r15) br %r14 - .align 8 + .balign 8 bss_start_literal: .quad __bss_start disabled_wait_psw:
@@ -125,7 +125,7 @@ io_new_mask: .quad 0x0000000180000000 .bss - .align 8 + .balign 8 stack: .space STACK_SIZE .size stack,STACK_SIZE
Signature · 1 line
2.43.0
PATCH 2/3 pc-bios/s390-ccw: Don't generate TEXTRELs
In reply to Marc HartmayerFrom: Jens Remus <[email protected]>
Commit 7cd50cbe4ca3 ("pc-bios/s390-ccw: Don't use __bss_start with the "larl" instruction") introduced the address constant bss_start_literal for __bss_start in the .text section, which introduced a relocation in code (i.e. TEXTREL). The dedicated constant is required, as __bss_start may not necessarily be aligned on a 2-byte boundary (see subject commit for details).
Move the constant to the .data section to get rid of the relocation in the .text section. Add the linker option -z text to prevent TEXTRELs to get introduced in the future.
Note that the R_390_RELATIVE relocations are taken care of by function glue() in include/hw/elf_ops.h.inc introduced by commit 5dce07e1cb67 ("elf-loader: Provide the possibility to relocate s390 ELF files").
--- pc-bios/s390-ccw/Makefile | 2 +- pc-bios/s390-ccw/start.S | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
pc-bios/s390-ccw/Makefile +1 -1
@@ -40,7 +40,7 @@ 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 += -std=gnu99 -LDFLAGS += -Wl,-pie -nostdlib -z noexecstack +LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text 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 \
pc-bios/s390-ccw/start.S +5 -2
@@ -113,8 +113,6 @@ io_new_code: br %r14 .balign 8 -bss_start_literal: - .quad __bss_start disabled_wait_psw: .quad 0x0002000180000000,0x0000000000000000 enabled_wait_psw:
@@ -124,6 +122,11 @@ external_new_mask: io_new_mask: .quad 0x0000000180000000 +.data + .balign 8 +bss_start_literal: + .quad __bss_start + .bss .balign 8 stack:
Signature · 1 line
2.43.0
PATCH 3/3 pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS`
In reply to Marc HartmayerSome packaging tools want to override LDFLAGS when building QEMU, this will result in a build error as most likely no -nostdlib flag is passed. Introduce EXTRA_LDFLAGS so that the packager can override LDFLAGS without breaking the build.
---
Note: Normally, I would rather use ALL_LDFLAGS, but adding EXTRA_LDFLAGS matches
with the current Makefile style.
--- pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
pc-bios/s390-ccw/netboot.mak +1 -1
@@ -6,7 +6,7 @@ NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include LIBNET_INC := -I$(SLOF_DIR)/lib/libnet -NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 +NETLDFLAGS := $(EXTRA_LDFLAGS) $(LDFLAGS) -Wl,-Ttext=0x7800000 $(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
pc-bios/s390-ccw/Makefile +3 -2
@@ -4,6 +4,7 @@ all: build-all include config-host.mak CFLAGS = -O2 -g +LDFLAGS ?= MAKEFLAGS += -rR GIT_SUBMODULES = roms/SLOF
@@ -40,7 +41,7 @@ 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 += -std=gnu99 -LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text +EXTRA_LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text 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 \
@@ -58,7 +59,7 @@ config-cc.mak: Makefile build-all: s390-ccw.img s390-netboot.img s390-ccw.elf: $(OBJECTS) - $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking) + $(call quiet-command,$(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $(OBJECTS),Linking) s390-ccw.img: s390-ccw.elf $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
Signature · 1 line
2.43.0
Quoted 5 lines · Marc Hartmayer
Jens Remus (2):
pc-bios/s390-ccw: Clarify alignment is in bytes pc-bios/s390-ccw: Don't generate TEXTRELs
Quoted 7 lines
Marc Hartmayer (1):
pc-bios/s390-ccw: IntroduceEXTRA_LDFLAGSpc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/Makefile | 5 +++-- pc-bios/s390-ccw/start.S | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-)
Series
I'll queue it ... but will likely wait with sending a merge request for a while to see whether other s390-ccw bios patches will be ready within the next weeks (so that I don't have to build the s390-ccw.img multiple times within a release cycle)
Thomas
Quoted 9 lines · Thomas Huth
Quoted 8 lines · Marc Hartmayer
Jens Remus (2):
pc-bios/s390-ccw: Clarify alignment is in bytes pc-bios/s390-ccw: Don't generate TEXTRELsMarc Hartmayer (1):
pc-bios/s390-ccw: IntroduceEXTRA_LDFLAGS
Quoted 7 lines
Quoted 4 lines
pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/Makefile | 5 +++-- pc-bios/s390-ccw/start.S | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-)Series
Reviewed-by Thomas Huth <[email protected]>
Thanks.
Quoted 5 lines
I'll queue it ... but will likely wait with sending a merge request for a while to see whether other s390-ccw bios patches will be ready within the next weeks (so that I don't have to build the s390-ccw.img multiple times within a release cycle)
Makes sense.
Quoted 4 lines
Thomas
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294