This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Define __start/__stop symbols when there is only a dynamic def
- From: Michael Matz <matz at suse dot de>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Alan Modra <amodra at gmail dot com>, Nick Clifton <nickc at redhat dot com>, Binutils <binutils at sourceware dot org>
- Date: Mon, 5 Feb 2018 22:26:12 +0000 (UTC)
- Subject: Re: Define __start/__stop symbols when there is only a dynamic def
- Authentication-results: sourceware.org; auth=none
- References: <alpine.LSU.2.21.1801292256000.18549@wotan.suse.de> <CAMe9rOrHBHHUKfRcx=m2iWuN04shu0EzhY28sr5Ljcf_82yxxw@mail.gmail.com> <alpine.LSU.2.21.1801292317140.18549@wotan.suse.de> <CAMe9rOqz2DvYNDB37LMZxpyDeBsLxsWezMJj3V6RC27xxFxN5A@mail.gmail.com> <20180129235335.GO20622@bubble.grove.modra.org> <alpine.LSU.2.21.1801301347420.18549@wotan.suse.de> <CAMe9rOpdhVJiA_gM=AJqr8-o0SmuJao+nYnvQ1+82fo8xjbeCw@mail.gmail.com> <CAMe9rOqeVu40iDHwy_EtdZgs-rm1_mWAQ++S+LmskjD9DY3pTQ@mail.gmail.com> <20180131034843.GY20622@bubble.grove.modra.org> <CAMe9rOqiLQ4t4XW_tRN7tufiZ=NSmaqcXho0xGji=Xnp8waP8Q@mail.gmail.com> <20180131054829.GZ20622@bubble.grove.modra.org> <alpine.LSU.2.21.1801311259460.18549@wotan.suse.de> <CAMe9rOqNjhhYbtC6dH_5OVyoVP+b4G1vExe=F0K8Rmx9RAmJnw@mail.gmail.com> <alpine.LSU.2.21.1801311316150.18549@wotan.suse.de> <CAMe9rOot+k5qTS8VWJ_tV7e3Eadf-QSuTPfFoOoL7A-JVKgQJg@mail.gmail.com> <CAJimCsFD4CersjtXvdwwRE8NPP6fHfRSK98HnV=_uKWo9G5tKw@mail.gmail.com>
Hi,
On Mon, 5 Feb 2018, Cary Coutant wrote:
> > Great. I hope we finally nailed it :-).
>
> And now can we have a summary of the new rules, please? I'm afraid to
> ask what I need to change in gold.
It still might not be the final rules ;-/ We might still go away from
protected back to global but symbolically bound symbols, for somewhat
esoteric reasons. (And also see one report at
https://sourceware.org/ml/binutils/2018-02/msg00038.html which has noted a
still different use-case that worked before 2.29, gnah!).
The rules _as of right now_: if section XXX exists and XXX is a
C-representable name, then:
* if there's a regular definition of __start_XXX, do nothing
* else,
- if 1) there's a regular reference to __start_XXX,
- or, 2) there's a dynamic definition of __start_XXX,
- or, 3) there's a dynamic reference to __start_XXX,
- or, 4) you pass -u __start_XXX (which is not a regular ref),
then
a) create a symbol __start_XXX with value startof(XXX).
b) When it isn't overridden by options, make that symbol protected.
c) Make that symbol dynamic in cases 2 and 3, otherwise make the
symbol dynamic only when other normal symbols would have been made
dynamic (creating shared lib, or -E, or other such options).
Same for __stop_XXX. Do similar for .startof.XXX and .sizeof.XXX, except
for not doing b) and c), these symbols are local, not dynamic.
Ciao,
Michael.