This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.0.1 PATCH: Allow building shared libobjc on Solaris 2
- To: gcc-patches at gcc dot gnu dot org
- Subject: 3.0.1 PATCH: Allow building shared libobjc on Solaris 2
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- Date: Thu, 28 Jun 2001 22:18:24 +0200 (MEST)
As already reported in
http://gcc.gnu.org/ml/gcc-patches/2001-03/msg00125.html
and several PRs, GCC 3.0 on Solaris 2 (both SPARC and Intel) fails to
bootstrap when configured with --enable-shared (which only changes the way
libobjc is built which has AC_DISABLE_SHARED in configure.in; all other
libraries supporting shared libs are already built shared by default).
A very conservative patch to fix this only for HP-UX went into 3.0, but
this fix is needed for Solaris 2 as well.
Here's what I've done to validate it is safe on a couple of platforms:
* apply the patch below
* configure --enable-shared --enable-languages=c,objc; make bootstrap
* cd gcc; make check-objc (this is sufficient since only objc files are
touched by the patch)
The platforms involved are
* sparc-sun-solaris2.5.1
* sparc-sun-solaris2.8 (bi-arch 32x64 configuration)
* mips-sgi-irix6.2 (bi-arch n32, n64 setup)
* alpha-dec-osf4.0f
* alpha-dec-osf5.1
The patch allows libobjc to build shared on Solaris 2, where bootstrap
failed before, and bootstrap continues to complete on the other platforms.
check-objc differences between static and shared results are as follows:
* sparc-sun-solaris2.5.1:
-PASS: objc/execute/class-13.m execution, -O
+FAIL: objc/execute/class-13.m execution, -O
-FAIL: objc/execute/class-3.m execution, -O
+PASS: objc/execute/class-3.m execution, -O
-PASS: objc/execute/class-5.m execution, -O
+FAIL: objc/execute/class-5.m execution, -O
-PASS: objc/execute/class-6.m execution, -O
+FAIL: objc/execute/class-6.m execution, -O
-PASS: objc/execute/class-8.m execution, -O
+FAIL: objc/execute/class-8.m execution, -O
-PASS: objc/execute/class-9.m execution, -O
+FAIL: objc/execute/class-9.m execution, -O
-# of expected passes 148
-# of unexpected failures 1
+# of expected passes 144
+# of unexpected failures 5
# of expected failures 1
All of the new failures abort with
test_instances failed
Still it's much better than before when the bootstrap would fail (and we
receive lots of bug reports about this).
* sparc-sun-solaris2.8:
-m32 (default):
-PASS: objc/execute/class-10.m execution, -O
+FAIL: objc/execute/class-10.m execution, -O
-PASS: objc/execute/class-11.m execution, -O
+FAIL: objc/execute/class-11.m execution, -O
-PASS: objc/execute/class-14.m execution, -O
+FAIL: objc/execute/class-14.m execution, -O
-# of expected passes 149
+# of expected passes 146
+# of unexpected failures 3
# of expected failures 1
Same error as on Solaris 2.5.1 above.
-m64:
unchanged:
FAIL: objc/execute/bycopy-3.m execution, -O
FAIL: objc/execute/formal_protocol-5.m execution, -O
Bus Error in both cases.
dbx gives
signal BUS (invalid address alignment) in objc_msg_lookup at 0xffffffff7f2144d0
0xffffffff7f2144d0: objc_msg_lookup+0x0034: ldx [%o5 + 0x40], %o2
(/opt/SUNWspro/bin/../WS6U1/bin/sparcv9/dbx) where
=>[1] objc_msg_lookup(0x1001016d8, 0x1001016a0, 0xffffffff7efb34e8, 0x100000b6c, 0x0, 0xffffffff7f600000), at 0xffffffff7f2144d0
[2] main(0x1, 0xffffffff7ffff3a8, 0xffffffff7ffff3b8, 0x100101798, 0x100000000, 0x0), at 0x100000d70
Since Solaris 2/SPARC V9 gdb doesn't exist yet, I'll have to dig into
gcc's assembler code to find what's wrong here, but I'll defer this since
this is no regression introduced by this patch.
# of expected passes 147
# of unexpected failures 2
# of expected failures 1
* mips-sgi-irix6.2:
-mabi=n32 (default):
-PASS: objc/execute/class-2.m execution, -O
+FAIL: objc/execute/class-2.m execution, -O
Same error (test_instances failed) as Solaris 2.5.1 above.
-# of expected passes 149
+# of expected passes 148
+# of unexpected failures 1
# of expected failures 1
-mabi=64:
unchanged:
FAIL: objc/execute/bycopy-3.m execution, -O
FAIL: objc/execute/formal_protocol-5.m execution, -O
These are the same two failures as on 64-bit Solaris 8 above, so they
probably happen for all/most 64-bit big-endian targets. Again, no
regression compared to the static libobjc case.
# of expected passes 147
# of unexpected failures 2
# of expected failures 1
* alpha-dec-osf4.0f, alpha-dec-osf5.1:
no differences:
# of expected passes 149
# of expected failures 1
Ok for branch (the mainline already has a cleaner version of handle_class_ref)?
There are a couple of issues on how to proceed from here:
* As explained in
http://gcc.gnu.org/ml/gcc-patches/2001-05/msg00635.html
a shared libobjc is close to unusable if installed into $libsubdir. It
needs to go into $libdir instead. I can provide a separate patch for
this, if it's agreed that this is the way to go.
* Once we have tested more platforms to make sure the shared libobjc works
on all of them, we could remove the AC_DISABLE_SHARED from configure.in
and instead add logic to respect --enable-shared, with and without
explicitly specified libraries. This is most likely a mainline-only
change.
Comments?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
Thu Jun 28 00:47:23 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* objc/objc-act.c (handle_class_ref): Always place decl in
variable section.
Fixes PRs libobjc/917, libobjc/3237, bootstrap/3251.
testsuite:
* lib/objc.exp (objc_target_compile): Declare rootme. Append to
ld_library_path.
===================================================================
RCS file: gcc/objc/RCS/objc-act.c,v
retrieving revision 1.1
diff -up -r1.1 gcc/objc/objc-act.c
--- gcc/objc/objc-act.c 2001/06/15 01:08:40 1.1
+++ gcc/objc/objc-act.c 2001/06/14 23:08:40
@@ -8362,13 +8362,8 @@ handle_class_ref (chain)
pushdecl (decl);
rest_of_decl_compilation (decl, 0, 0, 0);
-#ifdef __hpux__
/* Put the decl in the variable section. It may need relocation. */
variable_section (decl, 1);
-#else
- /* Make following constant read-only (why not)? */
- readonly_data_section ();
-#endif
exp = build1 (ADDR_EXPR, string_type_node, decl);
Index: gcc/testsuite/lib/objc.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.5.6.4
diff -u -p -r1.5.6.4 objc.exp
--- objc.exp 2001/06/28 12:53:48 1.5.6.4
+++ objc.exp 2001/06/28 17:43:59
@@ -113,13 +113,14 @@ proc objc_init { args } {
}
proc objc_target_compile { source dest type options } {
+ global rootme;
global tmpdir;
global gluefile wrap_flags;
global OBJC_UNDER_TEST
global TOOL_OPTIONS
global ld_library_path
- set ld_library_path "."
+ set ld_library_path ".:${rootme}"
lappend options "libs=-lobjc"
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {