This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: elision-conf.c "__pthread_init_array causes a section type conflict"
- From: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 23 Jul 2013 15:41:40 +0200
- Subject: Re: elision-conf.c "__pthread_init_array causes a section type conflict"
- References: <20130722130138 dot GA12945 at linux dot vnet dot ibm dot com> <20130722215905 dot DD2FC2C06F at topped-with-meat dot com>
- Reply-to: libc-alpha at sourceware dot org
On Mon, Jul 22, 2013 at 02:59:05PM -0700, Roland McGrath wrote:
> Use -save-temps and check the .i file for any other declarations using the
> same section attribute. I suspect there are none and it's just that your
> compiler configuration uses .init_array directly, so it's internally
> generated a use of the section.
I get some error message when compiling with -save-temps. Some
gawk script generates input for gcc on stdin (input file name '-'),
and then at a later place in the makefiles a filename -.i is
generated from that and put on a gcc command line. Gcc then fails
to interpret that as an option. If you're interested in the error
message, I can try to reproduce it.
> Trunk GCC makes .init_array writable, which it really should be only in PIC
> code, where really it should be RELRO. Probably the problem goes away if
> you drop the const in the SHARED case. But really the compiler is just
> wrong and it should be happy with that declaration, possibly requiring you
> to add attribute_relro.
>
> So, first just add attribute_relro and see if that works. If so, then all
> is well. If not, then you can try it with and without const and/or
> attribute_relro and see if you get a winner. But if you can't declare it
> const attribute_relro and win then we should file a GCC bug.
Okay, removing const seems to work (I'm not sure the path with
SHARED undefined is ever taken, though):
#ifdef SHARED
# define INIT_SECTION ".init_array"
# define MAYBE_CONST
#else
# define INIT_SECTION ".preinit_array"
# define MAYBE_CONST const
#endif
void (*MAYBE_CONST __pthread_init_array []) (int, char **, char **)
__attribute__ ((section (INIT_SECTION), aligned (sizeof (void *)))) =
{
&elision_init
};
However I'm not sure where you wanted me to put attribute_relro;
should it _replace_ the section attribute?
Ciao
Dominik ^_^ ^_^
P.S.: There's no need to explicitly cc me; the Reply-To in my
messages is set appropriately.
--
Dominik Vogt
IBM Germany