* [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements
@ 2024-10-01 15:36 Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes Marc Hartmayer
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Marc Hartmayer @ 2024-10-01 15:36 UTC (permalink / raw)
To: qemu-devel, Thomas Huth; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
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
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
@ 2024-10-01 15:36 ` Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 2/3] pc-bios/s390-ccw: Don't generate TEXTRELs Marc Hartmayer
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Marc Hartmayer @ 2024-10-01 15:36 UTC (permalink / raw)
To: qemu-devel, Thomas Huth; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
From: Jens Remus <jremus@linux.ibm.com>
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
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
pc-bios/s390-ccw/start.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S
index 061b06591cff..576fc12c06e8 100644
--- a/pc-bios/s390-ccw/start.S
+++ b/pc-bios/s390-ccw/start.S
@@ -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
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/3] pc-bios/s390-ccw: Don't generate TEXTRELs
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes Marc Hartmayer
@ 2024-10-01 15:36 ` Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 3/3] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS` Marc Hartmayer
2024-10-02 9:57 ` [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Thomas Huth
3 siblings, 0 replies; 6+ messages in thread
From: Marc Hartmayer @ 2024-10-01 15:36 UTC (permalink / raw)
To: qemu-devel, Thomas Huth; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
From: Jens Remus <jremus@linux.ibm.com>
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").
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
pc-bios/s390-ccw/Makefile | 2 +-
pc-bios/s390-ccw/start.S | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index 6207911b53aa..ab6bd1edf41e 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -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 \
diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S
index 576fc12c06e8..b70213e41246 100644
--- a/pc-bios/s390-ccw/start.S
+++ b/pc-bios/s390-ccw/start.S
@@ -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:
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 3/3] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS`
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 2/3] pc-bios/s390-ccw: Don't generate TEXTRELs Marc Hartmayer
@ 2024-10-01 15:36 ` Marc Hartmayer
2024-10-02 9:57 ` [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Thomas Huth
3 siblings, 0 replies; 6+ messages in thread
From: Marc Hartmayer @ 2024-10-01 15:36 UTC (permalink / raw)
To: qemu-devel, Thomas Huth; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
Some 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.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
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(-)
diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak
index 046aa35587ac..b1bc12603d99 100644
--- a/pc-bios/s390-ccw/netboot.mak
+++ b/pc-bios/s390-ccw/netboot.mak
@@ -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)
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index ab6bd1edf41e..56c971462992 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -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)
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
` (2 preceding siblings ...)
2024-10-01 15:36 ` [PATCH v1 3/3] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS` Marc Hartmayer
@ 2024-10-02 9:57 ` Thomas Huth
2024-10-02 10:13 ` Marc Hartmayer
3 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2024-10-02 9:57 UTC (permalink / raw)
To: Marc Hartmayer, qemu-devel; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
On 01/10/2024 17.36, Marc Hartmayer wrote:
>
> 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(-)
Series
Reviewed-by: Thomas Huth <thuth@redhat.com>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements
2024-10-02 9:57 ` [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Thomas Huth
@ 2024-10-02 10:13 ` Marc Hartmayer
0 siblings, 0 replies; 6+ messages in thread
From: Marc Hartmayer @ 2024-10-02 10:13 UTC (permalink / raw)
To: Thomas Huth, qemu-devel; +Cc: qemu-s390x, Christian Borntraeger, Jens Remus
On Wed, Oct 02, 2024 at 11:57 AM +0200, Thomas Huth <thuth@redhat.com> wrote:
> On 01/10/2024 17.36, Marc Hartmayer wrote:
>>
>> 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(-)
>
> Series
> Reviewed-by: Thomas Huth <thuth@redhat.com>
Thanks.
>
> 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.
>
> Thomas
>
>
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-02 10:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 2/3] pc-bios/s390-ccw: Don't generate TEXTRELs Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 3/3] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS` Marc Hartmayer
2024-10-02 9:57 ` [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Thomas Huth
2024-10-02 10:13 ` Marc Hartmayer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).