This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: differences in generated ldscripts for native and cross builds
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>, Matthias Klose <doko at debian dot org>, binutils <binutils at sourceware dot org>
- Date: Sun, 11 Oct 2015 12:30:51 -0700
- Subject: Re: differences in generated ldscripts for native and cross builds
- Authentication-results: sourceware.org; auth=none
- References: <5617620A dot 1000207 at debian dot org> <20151009121555 dot GD4434 at bubble dot grove dot modra dot org> <20151011185623 dot GB5535 at vapier dot lan>
On Sun, Oct 11, 2015 at 11:56 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 09 Oct 2015 22:45, Alan Modra wrote:
>> On Fri, Oct 09, 2015 at 08:43:22AM +0200, Matthias Klose wrote:
>> > --- debian/tmp/usr/lib/ldscripts/aarch64elf.x
>> > +++ debian/binutils-aarch64-linux-gnu/usr/lib/ldscripts/aarch64elf.x
>> > @@ -93,15 +93,15 @@
>> > .init_array :
>> > {
>> > PROVIDE_HIDDEN (__init_array_start = .);
>> > - KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
>> > - KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o
>> > *crtend?.o ) .ctors))
>> > + KEEP (*(SORT(.init_array.*)))
>> > + KEEP (*(.init_array ))
>> > PROVIDE_HIDDEN (__init_array_end = .);
>> > }
>> > .fini_array :
>> > {
>> > PROVIDE_HIDDEN (__fini_array_start = .);
>> > - KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
>> > - KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o
>> > *crtend?.o ) .dtors))
>> > + KEEP (*(SORT(.fini_array.*)))
>> > + KEEP (*(.fini_array ))
>> > PROVIDE_HIDDEN (__fini_array_end = .);
>> > }
>> > .ctors :
>>
>> Try adding --enable-initfini-array to the cross configuration. The
>> autoconf test for this option uses AC_RUN_IFELSE so only works on
>> native builds.
>
> can't we make this smarter ? this feature has been around for quite
> a long time now. seems crazy that the default is to disable these
> when cross-compiling.
Yes, the default should be ON for Linux targets.
--
H.J.