From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 676123838005; Thu, 19 Aug 2021 08:38:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 676123838005 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3015] testsuite, JIT, Darwin: Adjust asm tests for Mach-O. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/master X-Git-Oldrev: 4e6a5fa403782590088b2796261b023963f912af X-Git-Newrev: cb23be4fa59be26a7ba08918d6973e1d94629f8a Message-Id: <20210819083836.676123838005@sourceware.org> Date: Thu, 19 Aug 2021 08:38:36 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 08:38:36 -0000 https://gcc.gnu.org/g:cb23be4fa59be26a7ba08918d6973e1d94629f8a commit r12-3015-gcb23be4fa59be26a7ba08918d6973e1d94629f8a Author: Iain Sandoe Date: Fri Aug 13 20:25:59 2021 +0100 testsuite, JIT, Darwin: Adjust asm tests for Mach-O. This provides adjusted assembler fragments that are suitable for x86_64 Mach-O. Signed-off-by: Iain Sandoe gcc/testsuite/ChangeLog: * jit.dg/test-asm.c: Provide Mach-O fragment. * jit.dg/test-asm.cc: Likewise. Diff: --- gcc/testsuite/jit.dg/test-asm.c | 13 +++++++++++++ gcc/testsuite/jit.dg/test-asm.cc | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/gcc/testsuite/jit.dg/test-asm.c b/gcc/testsuite/jit.dg/test-asm.c index 35a9f9d8605..43255dc7561 100644 --- a/gcc/testsuite/jit.dg/test-asm.c +++ b/gcc/testsuite/jit.dg/test-asm.c @@ -438,6 +438,18 @@ verify_code_4 (gcc_jit_context *ctxt, gcc_jit_result *result) static void create_test_i386_basic_asm_5 (gcc_jit_context *ctxt) { +#if __APPLE__ + /* Darwin's assemblers do not support push/pop section, do not use .type + and external symbols should use __USER_LABEL_PREFIX__. */ + gcc_jit_context_add_top_level_asm (ctxt, NULL, + "\t.text\n" + "\t.globl _add_asm\n" + "_add_asm:\n" + "\tmovq %rdi, %rax\n" + "\tadd %rsi, %rax\n" + "\tret\n" + "\t# some asm here\n"); +#else /* Quote from here in docs/topics/asm.rst: example 5: jit. */ gcc_jit_context_add_top_level_asm (ctxt, NULL, "\t.pushsection .text\n" @@ -450,6 +462,7 @@ create_test_i386_basic_asm_5 (gcc_jit_context *ctxt) "\t# some asm here\n" "\t.popsection\n"); /* Quote up to here in docs/topics/asm.rst: example 5: jit. */ +#endif } static void diff --git a/gcc/testsuite/jit.dg/test-asm.cc b/gcc/testsuite/jit.dg/test-asm.cc index be487e3fb69..a3b45dacf07 100644 --- a/gcc/testsuite/jit.dg/test-asm.cc +++ b/gcc/testsuite/jit.dg/test-asm.cc @@ -400,6 +400,17 @@ static void create_test_i386_basic_asm_5 (gcc_jit_context *c_ctxt) { gccjit::context ctxt (c_ctxt); +#if __APPLE__ + /* Darwin's assemblers do not support push/pop section, do not use .type + and external symbols should use __USER_LABEL_PREFIX__. */ + ctxt.add_top_level_asm ("\t.text\n" + "\t.globl _add_asm\n" + "_add_asm:\n" + "\tmovq %rdi, %rax\n" + "\tadd %rsi, %rax\n" + "\tret\n" + "\t# some asm here\n"); +#else /* Quote from here in docs/cp/topics/asm.rst: example 5: jit. */ ctxt.add_top_level_asm ("\t.pushsection .text\n" "\t.globl add_asm\n" @@ -411,6 +422,7 @@ create_test_i386_basic_asm_5 (gcc_jit_context *c_ctxt) "\t# some asm here\n" "\t.popsection\n"); /* Quote up to here in docs/cp/topics/asm.rst: example 5: jit. */ +#endif } static void