This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ELF: Resolve referenced __start_XXX/__stop_XXX symbols


On Fri, Jun 9, 2017 at 3:05 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Normally, linker will define __start_XXX/__stop_XXX symbols only for
> orphaned sections.   However, during garbage collection, ELF linker
> marks all sections with references to __start_XXX/__stop_XXX symbols
> as used.  When section XXX isn't an orphaned section, __start_XXX and
> __stop_XXX symbols are left undefined even if section XXX does exist.
> This patch adds SEC_ELF_NEED_START_STOP to section flags to indicate
> that __start_XXX and/or __stop_XXX symbols should be defined and avoid
> defining them as orphaned section.  Instead, ELF linker resolves
> references to __start_XXX/__stop_XXX symbols together with .startof.
> symbol.
>
> OK for master?
>
>
> H.J.
> ---
> bfd/
>
>         PR ld/21562
>         * elflink.c (_bfd_elf_gc_mark_rsec): Set SEC_ELF_NEED_START_STOP
>         if a section references __start_XXX/__stop_XXX symbols.
>         * section (SEC_ELF_NEED_START_STOP): New.
>         * bfd-in2.h: Regenerated.
>
> ld/
>
>         PR ld/21562
>         * ldlang.c (lang_insert_orphan): Don't define __start_XXX nor
>         __stop_XXX symbols for ELF linker if SEC_ELF_NEED_START_STOP is
>         set.
>         (lang_set_startof): Resolve references to __start_XXX and
>         __stop_XXX symbols for ELF linker if SEC_ELF_NEED_START_STOP is
>         set.
>         * testsuite/ld-elf/pr21557.t: New test.
>         * testsuite/ld-elf/pr21557a.d: Likewise.
>         * testsuite/ld-elf/pr21557a.s: Likewise.
>         * testsuite/ld-elf/pr21557b.d: Likewise.
>         * testsuite/ld-elf/pr21557b.s: Likewise.
>         * testsuite/ld-elf/pr21557c.d: Likewise.
>         * testsuite/ld-elf/pr21557d.d: Likewise.
>

Please ignore this patch.  There are more issues:

https://sourceware.org/bugzilla/show_bug.cgi?id=20022
https://sourceware.org/bugzilla/show_bug.cgi?id=19167

H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]