public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: xuchenghua@loongson.cn
Cc: gcc-patches@gcc.gnu.org,  chenglulu@loongson.cn,
	 joseph@codesourcery.com
Subject: Re: [PATCH v8 08/12] LoongArch Port: libgcc
Date: Tue, 08 Mar 2022 18:59:44 +0000	[thread overview]
Message-ID: <mpt1qzci82n.fsf@arm.com> (raw)
In-Reply-To: <20220304071809.3082015-9-xuchenghua@loongson.cn> (xuchenghua@loongson.cn's message of "Fri, 4 Mar 2022 15:18:05 +0800")

xuchenghua@loongson.cn writes:
> diff --git a/libgcc/config/loongarch/crti.S b/libgcc/config/loongarch/crti.S
> new file mode 100644
> index 00000000000..27b7eab3626
> --- /dev/null
> +++ b/libgcc/config/loongarch/crti.S
> @@ -0,0 +1,43 @@
> +/* Copyright (C) 2021-2022 Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify it under
> +the terms of the GNU General Public License as published by the Free
> +Software Foundation; either version 3, or (at your option) any later
> +version.
> +
> +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
> +WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
> +for more details.
> +
> +Under Section 7 of GPL version 3, you are granted additional
> +permissions described in the GCC Runtime Library Exception, version
> +3.1, as published by the Free Software Foundation.
> +
> +You should have received a copy of the GNU General Public License and
> +a copy of the GCC Runtime Library Exception along with this program;
> +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> +<http://www.gnu.org/licenses/>.  */
> +
> +/* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
> +   Return spill offset of 8.  Aligned to 16 bytes for lp64.  */

The comment doesn't apply to the Loongson code.  Probably best
to delete it.

Same for crtn.S.

> +
> +	.section .init,"ax",@progbits
> +	.globl	_init
> +	.type	_init,@function
> +_init:
> +	addi.d   $r3,$r3,-16
> +	st.d      $r1,$r3,8
> +	addi.d   $r3,$r3,16
> +	jirl	$r0,$r1,0
> +
> +	.section .fini,"ax",@progbits
> +	.globl	_fini
> +	.type	_fini,@function
> +_fini:
> +	addi.d   $r3,$r3,-16
> +	st.d      $r1,$r3,8
> +	addi.d   $r3,$r3,16
> +	jirl	$r0,$r1,0

Are you sure this is right?  It looks like it pushes LR and then
immediately pops it and returns, which would have the effect of
bypassing the rest of the .init and .fini code.

The idea instead is that .init starts with the code in crti.S,
then contains any .init code linked in from .o files, then ends
with the .init code in crtn.S.  Same for .fini.

Looks good to me otherwise.

Thanks,
Richard

  reply	other threads:[~2022-03-08 18:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  7:17 [PATCH v8 00/12] Add LoongArch support xuchenghua
2022-03-04  7:17 ` [PATCH v8 01/12] LoongArch Port: Regenerate configure xuchenghua
2022-03-04  7:17 ` [PATCH v8 02/12] LoongArch Port: gcc build xuchenghua
2022-03-06 10:29   ` Richard Sandiford
2022-03-06 10:34     ` Andreas Schwab
2022-03-04  7:18 ` [PATCH v8 03/12] LoongArch Port: Regenerate gcc/configure xuchenghua
2022-03-04  7:18 ` [PATCH v8 04/12] LoongArch Port: Machine description files xuchenghua
2022-03-06 16:16   ` Richard Sandiford
2022-03-07  3:59     ` 程璐璐
2022-03-19  9:40     ` 程璐璐
2022-03-07 20:15   ` Xi Ruoyao
2022-03-10  6:26     ` 程璐璐
2022-03-04  7:18 ` [PATCH v8 05/12] LoongArch Port: Machine description C files and .h files xuchenghua
2022-03-07 18:17   ` Richard Sandiford
2022-03-19  9:35     ` 程璐璐
2022-03-04  7:18 ` [PATCH v8 06/12] LoongArch Port: Builtin functions xuchenghua
2022-03-08 18:43   ` Richard Sandiford
2022-03-04  7:18 ` [PATCH v8 07/12] LoongArch Port: Builtin macros xuchenghua
2022-03-04  7:18 ` [PATCH v8 08/12] LoongArch Port: libgcc xuchenghua
2022-03-08 18:59   ` Richard Sandiford [this message]
2022-03-08 19:37     ` Andreas Schwab
2022-03-04  7:18 ` [PATCH v8 09/12] LoongArch Port: Regenerate libgcc/configure xuchenghua
2022-03-04  7:18 ` [PATCH v8 10/12] LoongArch Port: libgomp xuchenghua
2022-03-04  7:18 ` [PATCH v8 11/12] LoongArch Port: gcc/testsuite xuchenghua
2022-03-08 19:06   ` Richard Sandiford
2022-03-04  7:18 ` [PATCH v8 12/12] LoongArch Port: Add doc xuchenghua
2022-03-08 19:53   ` Richard Sandiford
2022-03-04 20:02 ` [PATCH v8 00/12] Add LoongArch support Xi Ruoyao
2022-03-05  1:36   ` Paul Hua
2022-03-05  1:39     ` Paul Hua
2022-03-05  9:21     ` Xi Ruoyao
2022-03-08 19:57   ` Richard Sandiford
2022-03-15 14:35 ` Xi Ruoyao
2022-03-16 12:31   ` 程璐璐

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=mpt1qzci82n.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=xuchenghua@loongson.cn \
    /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).