From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 12/12] tests/tcg/s390x: Test unaligned accesses
Date: Fri, 17 Mar 2023 12:02:12 +0100 [thread overview]
Message-ID: <b60eab8dde6cb3f762d5d39015345bed970552dc.camel@linux.ibm.com> (raw)
In-Reply-To: <c7e9b213-bcf6-1f11-6c12-e62666a9def5@redhat.com>
On Fri, 2023-03-17 at 12:00 +0100, Thomas Huth wrote:
> On 17/03/2023 11.54, Thomas Huth wrote:
> > On 16/03/2023 17.44, Ilya Leoshkevich wrote:
> > > Add a number of small test that check whether accessing unaligned
> > > addresses in various ways leads to a specification exception.
> > >
> > > Run these test both in softmmu and user configurations; expect a
> > > PGM
> > > in one case and SIGILL in the other.
> > >
> > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > > ---
> > ...
> > > diff --git a/tests/tcg/s390x/Makefile.softmmu-target
> > > b/tests/tcg/s390x/Makefile.softmmu-target
> > > index 725b6c598db..6d8bf299b28 100644
> > > --- a/tests/tcg/s390x/Makefile.softmmu-target
> > > +++ b/tests/tcg/s390x/Makefile.softmmu-target
> > > @@ -1,11 +1,20 @@
> > > S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
> > > VPATH+=$(S390X_SRC)
> > > QEMU_OPTS=-action panic=exit-failure -kernel
> > > +LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
> > > +LDFLAGS=-nostdlib -static -Wl,-T$(LINK_SCRIPT)
> > > -%: %.S
> > > - $(CC) -march=z13 -m64 -nostdlib -static -Wl,-Ttext=0 \
> > > - -Wl,--build-id=none $< -o $@
> > > +%.o: %.S
> > > + $(CC) -march=z13 -m64 -c $< -o $@
> > > +
> > > +%: %.o $(LINK_SCRIPT)
> > > + $(CC) $< -o $@ $(LDFLAGS)
> > > TESTS += unaligned-lowcore
> > > TESTS += bal
> > > TESTS += sam
> > > +
> > > +include $(S390X_SRC)/pgm-specification.mak
> > > +$(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o
> > > +$(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o
> > > +TESTS += $(PGM_SPECIFICATION_TESTS)
> > > diff --git a/tests/tcg/s390x/Makefile.target
> > > b/tests/tcg/s390x/Makefile.target
> > > index cf93b966862..1002ab79886 100644
> > > --- a/tests/tcg/s390x/Makefile.target
> > > +++ b/tests/tcg/s390x/Makefile.target
> > > @@ -2,6 +2,9 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
> > > VPATH+=$(S390X_SRC)
> > > CFLAGS+=-march=zEC12 -m64
> > > +%.o: %.c
> > > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
> > > +
> > > config-cc.mak: Makefile
> > > $(quiet-@)( \
> > > $(call cc-option,-march=z14, CROSS_CC_HAS_Z14); \
> > > @@ -33,6 +36,11 @@ TESTS+=chrl
> > > cdsg: CFLAGS+=-pthread
> > > cdsg: LDFLAGS+=-pthread
> > > +include $(S390X_SRC)/pgm-specification.mak
> > > +$(PGM_SPECIFICATION_TESTS): pgm-specification-user.o
> > > +$(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-user.o
> > > +TESTS += $(PGM_SPECIFICATION_TESTS)
> > ...
> > > diff --git a/tests/tcg/s390x/softmmu.ld
> > > b/tests/tcg/s390x/softmmu.ld
> > > new file mode 100644
> > > index 00000000000..ea944eaa3cb
> > > --- /dev/null
> > > +++ b/tests/tcg/s390x/softmmu.ld
> > > @@ -0,0 +1,20 @@
> > > +/*
> > > + * Linker script for the softmmu test kernels.
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0-or-later
> > > + */
> > > +
> > > +ENTRY(_start)
> > > +
> > > +SECTIONS {
> > > + . = 0;
> > > +
> > > + .text : {
> > > + *(.head)
> > > + *(.text)
> > > + }
> > > +
> > > + /DISCARD/ : {
> > > + *(*)
> > > + }
> > > +}
> >
> > I just gave it a try, and while it's basically working, I see a lot
> > of these
> > messages in the console:
> >
> > /usr/bin/ld: warning: .note.gnu.build-id section discarded, --
> > build-id ignored
> >
> > I think you should either pass --build-id=none to the linker, or
> > add a
> > .note.gnu.build-id section to the linker script?
>
> This seems to work:
>
> diff --git a/tests/tcg/s390x/Makefile.softmmu-target
> b/tests/tcg/s390x/Makefile.softmmu-target
> --- a/tests/tcg/s390x/Makefile.softmmu-target
> +++ b/tests/tcg/s390x/Makefile.softmmu-target
> @@ -2,7 +2,7 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
> VPATH+=$(S390X_SRC)
> QEMU_OPTS=-action panic=exit-failure -kernel
> LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
> -LDFLAGS=-nostdlib -static -Wl,-T$(LINK_SCRIPT)
> +LDFLAGS=-nostdlib -static -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none
>
> %.o: %.S
> $(CC) -march=z13 -m64 -c $< -o $@
>
> I'll squash that in ... no need to resend.
>
> Thomas
Thanks! The Makefile used to have this, but I thought that the linker
script would replace this (since it /DISCARD/s the build id), and I did
not notice the warnings.
Your diff looks good to me.
prev parent reply other threads:[~2023-03-17 11:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 16:44 [PATCH v4 00/12] target/s390x: Handle unaligned accesses Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 01/12] target/s390x: Handle branching to odd addresses Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 02/12] target/s390x: Handle EXECUTE of " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 03/12] target/s390x: Handle LGRL from non-aligned addresses Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 04/12] target/s390x: Handle LRL and LGFRL " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 05/12] target/s390x: Handle LLGFRL " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 06/12] target/s390x: Handle CRL and CGFRL with " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 07/12] target/s390x: Handle CGRL and CLGRL " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 08/12] target/s390x: Handle CLRL and CLGFRL " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 09/12] target/s390x: Handle STRL to " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 10/12] target/s390x: Handle STGRL " Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 11/12] target/s390x: Update do_unaligned_access() comment Ilya Leoshkevich
2023-03-16 16:44 ` [PATCH v4 12/12] tests/tcg/s390x: Test unaligned accesses Ilya Leoshkevich
2023-03-17 8:43 ` Thomas Huth
2023-03-17 10:54 ` Thomas Huth
2023-03-17 11:00 ` Thomas Huth
2023-03-17 11:02 ` Ilya Leoshkevich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b60eab8dde6cb3f762d5d39015345bed970552dc.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).