qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 12/12] tests/tcg/s390x: Test unaligned accesses


From: Ilya Leoshkevich
Subject: Re: [PATCH v4 12/12] tests/tcg/s390x: Test unaligned accesses
Date: Fri, 17 Mar 2023 12:02:12 +0100
User-agent: Evolution 3.46.4 (3.46.4-1.fc37)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]