This is the mail archive of the
mailing list for the binutils project.
Re: gold patch committed: Reverse .ctors in .init_array
- From: Cary Coutant <ccoutant at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 27 Jun 2011 12:00:06 -0700
- Subject: Re: gold patch committed: Reverse .ctors in .init_array
- References: <email@example.com>
> Alan pointed out that when a .ctors sections which has multiple words is
> mapped to a .init_array section, we need to reverse the order of the
> entries in the .ctors section. ?This is because .ctors and .init_array
> are executed in reverse order, and we don't want the linker to change
> the order in which the constructors are executed. ?The same applies to
> .dtors mapped to .fini_array. ?This patch implements that in gold.
> Committed to mainline.
I asked about this in the comment string for PR 46770, about HJ's
patch for ld. The answer there was that the compiler generates a
single function that calls the constructors in the right order, so it
wasn't necessary to reverse the contents of the .ctors section. What's
different here? Will gold and gnu ld give different behavior now?