From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Daniel Santos <daniel.santos@pobox.com>
Cc: Mike Stump <mikestump@comcast.net>,
gcc-patches <gcc-patches@gcc.gnu.org>,
Bernd Edlinger <bernd.edlinger@hotmail.de>
Subject: Re: [PATCH 2/2] [testsuite] PR 80759 Remove gas extensions from do-test.S, fix other problems
Date: Fri, 19 May 2017 08:54:00 -0000 [thread overview]
Message-ID: <yddmva9z0u3.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <20170519063418.7836-2-daniel.santos@pobox.com> (Daniel Santos's message of "Fri, 19 May 2017 01:34:18 -0500")
Hi Daniel,
> Use of .struct in do_test.S causes breakages when gas isn't the
> assembler (e.g., Solaris). I also wasn't including TEST_ALWAYS_FLAGS in
> my CFLAGS resulting in super-ugly log files. Finally, this patch
> eliminates spam of "test unsupported" (limiting it to one printing).
>
> Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
> ---
> .../gcc.target/x86_64/abi/ms-sysv/do-test.S | 26 +++++-----------------
> .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.c | 7 ++++++
> .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp | 24 ++++++++++++--------
> 3 files changed, 27 insertions(+), 30 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> index 1395235fd1e..967eb959fbc 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> @@ -46,22 +46,6 @@ fn:
> # define MOVAPS movaps
> # endif
>
> -/* TODO: Is there a cleaner way to provide these offsets? */
> - .struct 0
> -test_data_save:
> -
> - .struct test_data_save + 224
> -test_data_input:
> -
> - .struct test_data_save + 448
> -test_data_output:
> -
> - .struct test_data_save + 672
> -test_data_fn:
> -
> - .struct test_data_save + 680
> -test_data_retaddr:
> -
> .text
>
> regs_to_mem:
> @@ -132,23 +116,23 @@ L0:
> call regs_to_mem
>
> # Load register with random data
> - lea test_data + test_data_input(%rip), %rax
> + lea test_data + 224(%rip), %rax
> call mem_to_regs
>
> # Save original return address
> pop %rax
> - movq %rax, test_data + test_data_retaddr(%rip)
> + movq %rax, test_data + 680(%rip)
>
> # Call the test function
> - call *test_data + test_data_fn(%rip)
> + call *test_data + 672(%rip)
>
> # Restore the original return address
> - movq test_data + test_data_retaddr(%rip), %rcx
> + movq test_data + 680(%rip), %rcx
> push %rcx
>
> # Save test function return value and store resulting register values
> push %rax
> - lea test_data + test_data_output(%rip), %rax
> + lea test_data + 448(%rip), %rax
> call regs_to_mem
>
> # Restore registers
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
> index 2a011f5103d..7cec312c386 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
> @@ -346,6 +346,13 @@ int main (int argc, char *argv[])
> assert (!((long)&test_data.regdata[REG_SET_INPUT] & 15));
> assert (!((long)&test_data.regdata[REG_SET_OUTPUT] & 15));
>
> + /* Verify offsets hard-coded into assembly. */
> + assert (__builtin_offsetof (struct test_data, regdata[REG_SET_SAVE]) == 0);
> + assert (__builtin_offsetof (struct test_data, regdata[REG_SET_INPUT]) == 224);
> + assert (__builtin_offsetof (struct test_data, regdata[REG_SET_OUTPUT]) == 448);
> + assert (__builtin_offsetof (struct test_data, fn) == 672);
> + assert (__builtin_offsetof (struct test_data, retaddr) == 680);
> +
> while ((c = getopt (argc, argv, "s:f")) != -1)
> {
> switch (c)
while .struct is a gas extension and doesn't work with the Solaris/x86
/bin/as, having the same (mostly unexplained) constants hardcoded in two
places isn't exactly helpful. I'd suggest moving them to (say)
ms-sysv.h and include that from both do-test.S (which is preprocessed
assembler after all) and ms-sysv.c.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
next prev parent reply other threads:[~2017-05-19 8:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 6:29 [PATCH 0/2] [testsuite] PR80759 Fix test breakages on i386-pc-solaris2.* Daniel Santos
2017-05-19 6:29 ` [PATCH 1/2] [testsuite] Move non-standard parallelization support into new lib and fix flaw Daniel Santos
2017-05-19 6:50 ` [PATCH 2/2] [testsuite] PR 80759 Remove gas extensions from do-test.S, fix other problems Daniel Santos
2017-05-19 8:54 ` Rainer Orth [this message]
2017-05-20 0:38 ` Daniel Santos
2017-05-19 9:04 ` [PATCH 0/2] [testsuite] PR80759 Fix test breakages on i386-pc-solaris2.* Rainer Orth
2017-07-02 5:06 ` [PATCH v2 0/2] [testsuite, libgcc] PR80759 Fix FAILs on Solaris and Darwin Daniel Santos
2017-07-02 5:10 ` [PATCH 1/2] [testsuite] PR80759 fix tests " Daniel Santos
2017-07-02 5:10 ` [PATCH 2/2] [libgcc]: PR80759 fixes for Solaris & Darwin Daniel Santos
2017-07-17 16:11 ` PING: [PATCH v2 0/2] [testsuite, libgcc] PR80759 Fix FAILs on Solaris and Darwin Daniel Santos
2017-07-17 16:38 ` Mike Stump
2017-07-17 18:50 ` Uros Bizjak
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=yddmva9z0u3.fsf@CeBiTec.Uni-Bielefeld.DE \
--to=ro@cebitec.uni-bielefeld.de \
--cc=bernd.edlinger@hotmail.de \
--cc=daniel.santos@pobox.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mikestump@comcast.net \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).