public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: Andreas Schwab <schwab@suse.de>,
	 "libc-alpha\@sourceware.org" <libc-alpha@sourceware.org>,
	 arcml <linux-snps-arc@lists.infradead.org>,
	 Alistair Francis <alistair.francis@wdc.com>
Subject: Re: ELF_INITFINI for ARC (was Re: [PATCH] Introduce <elf-initfini.h> and ELF_INITFINI for all architectures)
Date: Wed, 26 Feb 2020 19:27:00 -0000	[thread overview]
Message-ID: <87y2sp174p.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <cc69bcb6-526a-469d-f78a-035208645ae9@synopsys.com> (Vineet Gupta's message of "Wed, 26 Feb 2020 19:10:16 +0000")

* Vineet Gupta:

> It seems that commit also removed init_array from
> sysdeps/{riscv,csky}/Implies - so newer arches. I suppose I need to do
> that for ARC as well - but could you please explain (or point to
> documentation) which explains how this the Implies stuff works.

You are very lucky.  The mechanism is explained in the section Porting
the GNU C Library in the manual:

  <https://www.gnu.org/software/libc/manual/html_node/Porting.html>

It's one of the few aspects of our build systems that's documented.

However, in commit f4349837d93b4dfe9ba09791e280ee2d6c99919f ("Introduce
<elf-initfini.h> and ELF_INITFINI for all architectures") I replaced the
use of the implies mechanism with a new header file, <elf-initfini.h>.
This allows us to control the default for new targets in a more explicit
way.  Previously, new ports had to include initarray explicitly, and we
know from past experience (the lack of removal of the sysctl function
comes to my mind) that this does not work.

>> But I'm no longer sure if RISC-V is actually an !ELF_INITFINI
>> architecture.
>
> And an arch is !ELF_INITFINI if it supports initarray ?

Not necessarily.  glibc always supports DT_INITARRAY for all targets,
but on some targets, it is necessary to honor DT_INIT/DT_FINI for legacy
binaries at least.  (I hope no targets are left where binutils produces
DT_INIT for regular ELF constructors, but I haven't checked.)

> I did switch ARC gcc [1] / binutils [2]to initarray last year
>
> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-January/005318.html
> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2019-February/005388.html

I haven't followed the ARC contribution process closely, sorry.  Do you
plan to contribute the port with a GLIBC_2.32 ABI baseline, or do you
want to support older binaries for an earlier non-upstream port,
backdating the baseline?

This matters because in the GLIBC_2.32 case, old binaries will not work
anyway, so we may as well require that they are rebuilt without
DT_INIT/DT_FINI.  In this case, the glibc master defaults should work.

If you want to support old binaries (which use older symbol versions
such as GLIBC_2.17), it may make sense to keep DT_INIT/DT_FINI support
as well.  To achieve this, you need to add an <elf-initifini.h> header
file with

/* Enable DT_INIT/DT_FINI support.  */
#define ELF_INITFINI 1

and keep the crti.S and crtn.S files you already have.

Thanks,
Florian

  reply	other threads:[~2020-02-26 19:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 14:23 [PATCH] Introduce <elf-initfini.h> and ELF_INITFINI for all architectures Florian Weimer
2020-02-05 16:50 ` Adhemerval Zanella
2020-02-09  9:03   ` Florian Weimer
2020-02-18 14:13   ` Florian Weimer
2020-02-20 16:37 ` Andreas Schwab
2020-02-20 16:40   ` Florian Weimer
2020-02-20 16:56     ` Andreas Schwab
2020-02-20 17:11     ` Andreas Schwab
2020-02-20 18:53       ` Florian Weimer
2020-02-20 22:49         ` Jim Wilson
2020-02-21 12:41           ` Florian Weimer
2020-02-21 18:34             ` Florian Weimer
2020-02-21 21:11               ` Jim Wilson
2020-02-21 21:21             ` David Abdurachmanov
2020-02-24  9:13             ` Andreas Schwab
2020-02-24 12:31               ` Florian Weimer
2020-02-24  9:12         ` Andreas Schwab
2020-02-24 10:21           ` Florian Weimer
2020-02-26 19:10         ` ELF_INITFINI for ARC (was Re: [PATCH] Introduce <elf-initfini.h> and ELF_INITFINI for all architectures) Vineet Gupta
2020-02-26 19:27           ` Florian Weimer [this message]
2020-02-26 20:05             ` Vineet Gupta

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=87y2sp174p.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=alistair.francis@wdc.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=schwab@suse.de \
    /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).