public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix .init_array/.fini_array testcase (PR target/50166)
@ 2011-08-26 14:52 Rainer Orth
  2011-08-26 15:04 ` H.J. Lu
  2011-08-26 15:43 ` Jakub Jelinek
  0 siblings, 2 replies; 6+ messages in thread
From: Rainer Orth @ 2011-08-26 14:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

As detailed in the PR, H.J.'s .init_array/.fini_array patch

2011-08-20  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/46770
	* config.gcc (tm_file): Add initfini-array.h if
	.init_arrary/.fini_array are supported.

broke Solaris bootstrap since the testcase incorrectly succeeds on
Solaris, failing to notice that none of the constructors and destructors
were ever run.

The following patch fixes that, allows i386-pc-solaris2.11 bootstrap to
succeed and was also bootstrapped on x86_64-unknown-linux-gnu (CentOS
5.5 with gas/gld 2.21).  The testcase still fails on my Linux system, so
I'm uncertain if the fix is right.

Ok for mainline?

	Rainer


2011-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/50166
	* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
	* configure: Regenerate.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-no-init_fini_array.patch --]
[-- Type: text/x-patch, Size: 1061 bytes --]

# HG changeset patch
# Parent f622b6f398b4f552dcc1450c8caf6368a5937748
Disable .init_array/.fini_array support on Solaris (PR target/50166)

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -477,6 +477,8 @@ void (*const dtors65535[]) ()
 int
 main ()
 {
+  if (count != 65535)
+    abort ();
   return 0;
 }
 #endif
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -10888,6 +10888,8 @@ void (*const dtors65535) ()
 int
 main ()
 {
+  if (count != 65535)
+    abort ();
   return 0;
 }
 #endif
@@ -17913,7 +17915,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17916 "configure"
+#line 17918 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18019,7 +18021,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18022 "configure"
+#line 18024 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix .init_array/.fini_array testcase (PR target/50166)
  2011-08-26 14:52 Fix .init_array/.fini_array testcase (PR target/50166) Rainer Orth
@ 2011-08-26 15:04 ` H.J. Lu
  2011-08-26 15:09   ` Rainer Orth
  2011-08-26 15:43 ` Jakub Jelinek
  1 sibling, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-08-26 15:04 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Jakub Jelinek, H.J. Lu

On Fri, Aug 26, 2011 at 7:35 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> As detailed in the PR, H.J.'s .init_array/.fini_array patch
>
> 2011-08-20  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR other/46770
>        * config.gcc (tm_file): Add initfini-array.h if
>        .init_arrary/.fini_array are supported.
>
> broke Solaris bootstrap since the testcase incorrectly succeeds on
> Solaris, failing to notice that none of the constructors and destructors
> were ever run.
>
> The following patch fixes that, allows i386-pc-solaris2.11 bootstrap to
> succeed and was also bootstrapped on x86_64-unknown-linux-gnu (CentOS
> 5.5 with gas/gld 2.21).  The testcase still fails on my Linux system, so
> I'm uncertain if the fix is right.
>
> Ok for mainline?
>
>        Rainer
>
>
> 2011-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>        PR target/50166
>        * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
>        * configure: Regenerate.
>
>

That explains why init_array was enabled on AIX.  It looks good to me and
still works on Fedora 15.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix .init_array/.fini_array testcase (PR target/50166)
  2011-08-26 15:04 ` H.J. Lu
@ 2011-08-26 15:09   ` Rainer Orth
  2011-08-26 15:18     ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Rainer Orth @ 2011-08-26 15:09 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches, Jakub Jelinek, H.J. Lu

"H.J. Lu" <hjl.tools@gmail.com> writes:

>> 2011-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>        PR target/50166
>>        * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
>>        * configure: Regenerate.
>
> That explains why init_array was enabled on AIX.  It looks good to me and
> still works on Fedora 15.

What support do you need on the Linux side for .init_array/.fini_array
to work?  I'd have expected that gld 2.21 is enough, or is ld-linux.so.2
support required, too?

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix .init_array/.fini_array testcase (PR target/50166)
  2011-08-26 15:09   ` Rainer Orth
@ 2011-08-26 15:18     ` H.J. Lu
  2011-08-26 15:31       ` Rainer Orth
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-08-26 15:18 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Jakub Jelinek

On Fri, Aug 26, 2011 at 7:45 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>>> 2011-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>>
>>>        PR target/50166
>>>        * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
>>>        * configure: Regenerate.
>>
>> That explains why init_array was enabled on AIX.  It looks good to me and
>> still works on Fedora 15.
>
> What support do you need on the Linux side for .init_array/.fini_array
> to work?  I'd have expected that gld 2.21 is enough, or is ld-linux.so.2
> support required, too?

You need the latest Linux binutils. Mixing init_array/,ctors sections support
was added after binutils 2.21 was released:

http://sourceware.org/git/?p=binutils.git;a=commit;h=30dfd0308a8551174634494822e194fcf24a7ddb


-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix .init_array/.fini_array testcase (PR target/50166)
  2011-08-26 15:18     ` H.J. Lu
@ 2011-08-26 15:31       ` Rainer Orth
  0 siblings, 0 replies; 6+ messages in thread
From: Rainer Orth @ 2011-08-26 15:31 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches, Jakub Jelinek

"H.J. Lu" <hjl.tools@gmail.com> writes:

>> What support do you need on the Linux side for .init_array/.fini_array
>> to work?  I'd have expected that gld 2.21 is enough, or is ld-linux.so.2
>> support required, too?
>
> You need the latest Linux binutils. Mixing init_array/,ctors sections support
> was added after binutils 2.21 was released:
>
> http://sourceware.org/git/?p=binutils.git;a=commit;h=30dfd0308a8551174634494822e194fcf24a7ddb

I see, thanks.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix .init_array/.fini_array testcase (PR target/50166)
  2011-08-26 14:52 Fix .init_array/.fini_array testcase (PR target/50166) Rainer Orth
  2011-08-26 15:04 ` H.J. Lu
@ 2011-08-26 15:43 ` Jakub Jelinek
  1 sibling, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2011-08-26 15:43 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, H.J. Lu

On Fri, Aug 26, 2011 at 04:35:18PM +0200, Rainer Orth wrote:
> Ok for mainline?

Yes.
> 
> 2011-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	PR target/50166
> 	* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
> 	* configure: Regenerate.
> 

	Jakub

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-26 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 14:52 Fix .init_array/.fini_array testcase (PR target/50166) Rainer Orth
2011-08-26 15:04 ` H.J. Lu
2011-08-26 15:09   ` Rainer Orth
2011-08-26 15:18     ` H.J. Lu
2011-08-26 15:31       ` Rainer Orth
2011-08-26 15:43 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).