public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mao Han <han_mao@c-sky.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com,
	libc-alpha@sourceware.org
Subject: Re: [PATCH v4 01/13] C-SKY: ABI related code
Date: Wed, 12 Sep 2018 07:07:00 -0000	[thread overview]
Message-ID: <20180912070735.GA3771@vmh-VirtualBox> (raw)
In-Reply-To: <CAMe9rOq1aukA=Df8Qx1kUpQ5DB7U0E6+HHWrpQNV3_UpgKvbtQ@mail.gmail.com>

On Tue, Sep 11, 2018 at 09:15:19PM -0700, H.J. Lu wrote:
> On Tue, Sep 11, 2018 at 7:56 PM, Mao Han <han_mao@c-sky.com> wrote:
> > Codes in this patch contains lots of C-SKY ABI related code.  They are
> > written accroding to the registers assgnments, relocations, assemblly
> > described in C-SKY CPU ABI Standards and C-SKY architercure user guide.
> >
> > diff --git a/sysdeps/csky/abiv2/crti.S b/sysdeps/csky/abiv2/crti.S
> > new file mode 100644
> > index 0000000..4526a9e
> > --- /dev/null
> > +++ b/sysdeps/csky/abiv2/crti.S
> > @@ -0,0 +1,99 @@
> > +/* Special .init and .fini section support for C-SKY ABIV2.
> > +   Copyright (C) 2018 Free Software Foundation, Inc.
> > +   This file is part of the GNU C Library.
> > +
> > +   The GNU C Library is free software; you can redistribute it and/or
> > +   modify it under the terms of the GNU Lesser General Public
> > +   License as published by the Free Software Foundation; either
> > +   version 2.1 of the License, or (at your option) any later version.
> > +
> > +   In addition to the permissions in the GNU Lesser General Public
> > +   License, the Free Software Foundation gives you unlimited
> > +   permission to link the compiled version of this file with other
> > +   programs, and to distribute those programs without any restriction
> > +   coming from the use of this file. (The GNU Lesser General Public
> > +   License restrictions do apply in other respects; for example, they
> > +   cover modification of the file, and distribution when not linked
> > +   into another program.)
> > +
> > +   Note that people who make modified versions of this file are not
> > +   obligated to grant this special exception for their modified
> > +   versions; it is their choice whether to do so. The GNU Lesser
> > +   General Public License gives permission to release a modified
> > +   version without this exception; this exception also makes it
> > +   possible to release a modified version which carries forward this
> > +   exception.
> > +
> > +   The GNU C Library 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
> > +   Lesser General Public License for more details.
> > +
> > +   You should have received a copy of the GNU Lesser General Public
> > +   License along with the GNU C Library.  If not, see
> > +   <http://www.gnu.org/licenses/>.  */
> > +
> > +/* crti.S puts a function prologue at the beginning of the .init and
> > +   .fini sections and defines global symbols for those addresses, so
> > +   they can be called as functions.  The symbols _init and _fini are
> > +   magic and cause the linker to emit DT_INIT and DT_FINI.  */
> > +
> > +#include <libc-symbols.h>
> > +#include <sysdep.h>
> > +
> > +#ifndef PREINIT_FUNCTION
> > +# define PREINIT_FUNCTION __gmon_start__
> > +#endif
> > +
> > +#ifndef PREINIT_FUNCTION_WEAK
> > +# define PREINIT_FUNCTION_WEAK 1
> > +#endif
> > +
> > +#if PREINIT_FUNCTION_WEAK
> > +       weak_extern (PREINIT_FUNCTION)
> > +#else
> > +       .hidden PREINIT_FUNCTION
> > +#endif
> > +
> > +       .section .init,"ax",@progbits
> > +       .align 4
> > +       .globl _init
> > +       .hidden _init
> 
> Does C-SKY really need _init and _fini?
> 
> 
> -- 
> H.J.

It seems used to call some pre-init function for libc, register transactional
memory clone tables and invoke global constructors on C-SKY. Althrough I 
haven't found any constructors call by _init, I just tend to have _init and
_fini as most other arch have these.

Han Mao

  reply	other threads:[~2018-09-12  7:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  2:56 [PATCH v4 00/13] port C-SKY to glibc Mao Han
     [not found] ` <cover.1536720821.git.han_mao@c-sky.com>
2018-09-12  2:56   ` [PATCH v4 01/13] C-SKY: ABI related code Mao Han
2018-09-12  4:16     ` H.J. Lu
2018-09-12  7:07       ` Mao Han [this message]
2018-09-12  8:23         ` Florian Weimer
2018-09-12  9:06           ` Mao Han
2018-09-29  1:46           ` Palmer Dabbelt
2018-09-30  9:04             ` Manuel A. Fernandez Montecelo
2018-10-01  8:18             ` Richard W.M. Jones
2018-09-17 21:46     ` Joseph Myers
2018-09-18  6:09       ` Mao Han
2018-09-12  2:56   ` [PATCH v4 05/13] C-SKY: Linux Syscall Interface Mao Han
2018-09-12  2:56   ` [PATCH v4 02/13] C-SKY: TLS support Mao Han
2018-09-12  2:56   ` [PATCH v4 03/13] C-SKY: Math support Mao Han
2018-09-17 21:49     ` Joseph Myers
2018-09-18  6:05       ` Mao Han
2018-09-12  2:57   ` [PATCH v4 13/13] C-SKY: Skeleton documentation Mao Han
2018-09-12  2:57   ` [PATCH v4 06/13] C-SKY: Linux ABI Mao Han
2018-09-12 13:40     ` Arnd Bergmann
2018-09-12 14:21       ` Joseph Myers
2018-09-12 15:34         ` Arnd Bergmann
2018-09-12 21:28           ` struct elf_prstatus and Y2038 (was: Re: [PATCH v4 06/13] C-SKY: Linux ABI) Florian Weimer
2018-09-13 10:48             ` Arnd Bergmann
2018-09-13 10:56               ` struct elf_prstatus and Y2038 Florian Weimer
2018-09-13  8:17       ` [PATCH v4 06/13] C-SKY: Linux ABI Mao Han
2018-09-13  8:46         ` Arnd Bergmann
2018-09-13 15:32           ` [gnu-csky] " Joseph Myers
2018-09-13 16:35             ` Joseph Myers
2018-09-13 20:47               ` Arnd Bergmann
2018-09-13 20:59                 ` Joseph Myers
2018-09-13 21:32                   ` Arnd Bergmann
2018-09-13 22:57                     ` Joseph Myers
2018-09-13 20:31             ` Arnd Bergmann
2018-09-13 20:49               ` Joseph Myers
2018-09-13 21:38                 ` Arnd Bergmann
2018-09-12  2:57   ` [PATCH v4 08/13] C-SKY: Linux Startup and Dynamic Loading Code Mao Han
2018-09-12  2:57   ` [PATCH v4 12/13] C-SKY: Add build-many-glibcs.py support Mao Han
2018-09-12  2:57   ` [PATCH v4 11/13] C-SKY: Add ABI definitions in config.h.in Mao Han
2018-09-12  2:57   ` [PATCH v4 09/13] C-SKY: Add dynamic relocations to elf.h Mao Han
2018-09-12  3:05   ` [PATCH v4 04/13] C-SKY: NPTL support and Atomic Mao Han
2018-09-12  3:05   ` [PATCH v4 07/13] C-SKY: ABI Lists Mao Han
2018-09-12  6:51     ` Andreas Schwab
2018-09-12  7:12       ` Mao Han
2018-09-12 12:35       ` Joseph Myers
2018-09-12 13:46         ` Andreas Schwab
2018-09-12 15:19           ` Joseph Myers
2018-09-13  8:23         ` Mao Han
2018-09-12  3:05   ` [PATCH v4 10/13] C-SKY: Build Infastructure Mao Han
2018-09-17 21:52     ` Joseph Myers
2018-09-18  6:02       ` Mao Han
2018-09-12  3:05 ` [PATCH 1/1] Update config.guess and config.sub to current versions Mao Han
2018-09-12 12:31 ` [PATCH v4 00/13] port C-SKY to glibc Joseph Myers
2018-09-13  8:14   ` Mao Han
2018-09-13 12:36     ` Joseph Myers
2018-09-18  6:22       ` Mao Han
2018-09-18  7:18         ` Mao Han
2018-09-18 11:43           ` Joseph Myers

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=20180912070735.GA3771@vmh-VirtualBox \
    --to=han_mao@c-sky.com \
    --cc=c-sky_gcc_upstream@c-sky.com \
    --cc=gnu-csky@mentor.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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).