This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Solaris 8] libobjc and objc test patches


I've just been able to successfully run most Objective C tests on Solaris 8,
based on the patches included below.  Before those changes, libobjc
wouldn't build and thus all tests failed.

Here are the testsuite results from make check-objc:

WARNING: Couldn't find the global config file.
Test Run By ro on Sat Mar  3 00:15:26 2001
Native configuration is sparc-sun-solaris2.8

		=== objc tests ===

Schedule of variations:
    unix

Running target unix
Using /vol/gcc/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /vol/gcc/share/dejagnu/config/unix.exp as generic interface file for target.
Using /vol/gnu/src/gcc/gcc-3.0-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /vol/gnu/src/gcc/gcc-3.0-branch/gcc/testsuite/objc/execute/execute.exp ...
FAIL: objc/execute/bycopy-1.m compilation,  -O 
FAIL: objc/execute/bycopy-2.m compilation,  -O 
FAIL: objc/execute/np-1.m compilation,  -O 
FAIL: objc/execute/np-2.m compilation,  -O 
FAIL: objc/execute/protocol.m compilation,  -O 

		=== objc Summary ===

# of expected passes		48
# of unexpected failures	5
# of untested testcases		5
/tmp/gcc/gcc/xgcc version 3.0 20010221 (prerelease)

At first, libobjc.so failed to link as already described in a thread
starting at http://gcc.gnu.org/ml/gcc/2000-11/msg00936.html and PR
libobjc/917.  Based on a suggestion by H. J. Lu
(http://gcc.gnu.org/ml/gcc/2000-08/msg00153.html), I tried to remove the
references to __objc_class_name_NXConstantString and
__objc_class_name_Object in the object files ld complained about.  The
patch to objc-act.c does this, and the comment a few lines above suggests
this might really be the right thing.

With this change, I'm able to successfully create libobjc.so.

Even with this change, make check-objc fails all compilations: libobjc.so
references sched_get_priority_max and sched_get_priority_min, but fails to
depend on -lrt (Solaris 7, 8, Tru64 UNIX V4.0F, V5.1) or -lposix4 (Solaris
2.5.1, 2.6), so I check for the existence of these functions and which
library to use.  libobjc is now linked with any library found during this
process.  While those functions exist in Solaris 2.5.1, they always return
-1 and set errno to ENOSYS.  I don't currently check for this condition.
Only when sched_get_priority_max is found somewhere, I use those
functions in libobjc/thr-posix.c (currently unused) and gcc/gthr-posix.h.

What confuses me is that none of the *objc_thread_set_priority functions in
libobjc seems to be used right now.

One caveat: the patch mentions libobjc/config.h.in as regenerated (since
I've generated it using autoheader), but the file seems to have been
created manually before, so I've included the patch below.

With this change, many compile tests succeed, but execution still fails
since libgcc_s.so is not found at runtime.  The patch to
gcc/testsuite/lib/objc.exp extends ld_library_path as necessary.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE



Sat Mar  3 00:08:48 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	gcc/testsuite:
	* lib/objc.exp (objc_target_compile): Append ${rootme} to
	ld_library_path for libgcc_s.

	gcc:
	* objc/objc-act.c (finish_objc): Don't call handle_class_ref().

	* gthr-posix.h (__gthread_objc_thread_set_priority): Use
	sched_get_priority_max() only if available.

	libobjc:
	* thr-posix.c (__objc_thread_set_priority): Use
	sched_get_priority_max() only if available.

	* Makefile.in (LIBS): Define.
	(libobjc.la, libobjc_gc.la): Link with $(LIBS).

	* configure.in: Check for sched_get_priority_max.
	* configure, config.h.in: Regenerate.

Index: gcc/gthr-posix.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gthr-posix.h,v
retrieving revision 1.11
diff -u -p -r1.11 gthr-posix.h
--- gthr-posix.h	2000/08/15 07:36:33	1.11
+++ gthr-posix.h	2001/03/02 23:08:18
@@ -174,6 +174,7 @@ __gthread_objc_thread_set_priority(int p
 
     if (pthread_getschedparam(thread_id, &policy, &params) == 0)
       {
+#ifdef HAVE_SCHED_GET_PRIORITY_MAX
         if ((priority_max = sched_get_priority_max(policy)) != 0)
           return -1;
 
@@ -184,6 +185,7 @@ __gthread_objc_thread_set_priority(int p
           priority = priority_max;
         else if (priority < priority_min)
           priority = priority_min;
+#endif /* HAVE_SCHED_GET_PRIORITY_MAX */
         params.sched_priority = priority;
 
         /*
Index: gcc/objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/objc/objc-act.c,v
retrieving revision 1.66.2.1
diff -u -p -r1.66.2.1 objc-act.c
--- objc-act.c	2001/02/16 09:19:08	1.66.2.1
+++ objc-act.c	2001/03/02 23:08:30
@@ -8237,7 +8237,9 @@ finish_objc ()
 
   for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
     {
+#if 0
       handle_class_ref (chain);
+#endif
       if (TREE_PURPOSE (chain))
 	generate_classref_translation_entry (chain);
     }
Index: gcc/testsuite/lib/objc.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.5
diff -u -p -r1.5 objc.exp
--- objc.exp	2000/08/06 18:41:49	1.5
+++ objc.exp	2001/03/02 23:08:36
@@ -113,6 +113,7 @@ proc objc_init { args } {
 }
 
 proc objc_target_compile { source dest type options } {
+    global rootme;
     global tmpdir;
     global gluefile wrap_flags;
     global OBJC_UNDER_TEST
@@ -150,6 +151,7 @@ proc objc_target_compile { source dest t
 	lappend options "additional_flags=${objc_link_flags}"
 	append ld_library_path ":${libobjc_dir}"
     }
+    append ld_library_path ":${rootme}"
     lappend options "compiler=$OBJC_UNDER_TEST"
     return [target_compile $source $dest $type $options]
 }
Index: libobjc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libobjc/Makefile.in,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile.in
--- Makefile.in	2000/07/29 19:19:43	1.16
+++ Makefile.in	2001/03/02 23:08:36
@@ -64,6 +64,8 @@ GTHREAD_FLAGS=@GTHREAD_FLAGS@
 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) \
 	$(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS
 
+LIBS = @LIBS@
+
 # Libtool
 # The following strings describe the version of the obj-C library 
 # begin compiled and compatibility issues.
@@ -254,11 +256,11 @@ doc: info dvi html
 
 libobjc.la: $(OBJS)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) -rpath $(libsubdir) \
-		-version-info $(LIBOBJC_VERSION)
+		-version-info $(LIBOBJC_VERSION) $(LIBS)
 
 libobjc_gc.la: $(OBJS_GC)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) -rpath $(libsubdir) \
-		-version-info $(LIBOBJC_GC_VERSION)
+		-version-info $(LIBOBJC_GC_VERSION) $(LIBS)
 
 #
 # FIXME -- The following part does not fit in the libtool context. 
Index: libobjc/config.h.in
===================================================================
RCS file: /cvs/gcc/egcs/libobjc/config.h.in,v
retrieving revision 1.1
diff -u -p -r1.1 config.h.in
--- config.h.in	2000/08/15 07:38:54	1.1
+++ config.h.in	2001/03/02 23:08:36
@@ -1,2 +1,13 @@
-/* Define this if you have the <sched.h> header file */
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you have the sched_get_priority_max function.  */
+#undef HAVE_SCHED_GET_PRIORITY_MAX
+
+/* Define if you have the <sched.h> header file.  */
 #undef HAVE_SCHED_H
+
+/* Define if you have the rt library (-lrt).  */
+#undef HAVE_LIBRT
Index: libobjc/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/libobjc/configure.in,v
retrieving revision 1.14
diff -u -p -r1.14 configure.in
--- configure.in	2001/02/09 07:14:34	1.14
+++ configure.in	2001/03/02 23:08:37
@@ -109,6 +109,13 @@ AC_HEADER_STDC
 
 AC_CHECK_HEADERS(sched.h)
 
+dnl Digital UNIX V4/V5 and Solaris 7/8 have POSIX.1c functions in -lrt
+dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
+dnl so only use one of them
+AC_CHECK_LIB(rt, sched_get_priority_max,, AC_CHECK_LIB(posix4, sched_get_priority_max))
+
+AC_CHECK_FUNCS(sched_get_priority_max)
+
 # Determine CFLAGS for gthread.
 
 AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
Index: libobjc/thr-posix.c
===================================================================
RCS file: /cvs/gcc/egcs/libobjc/thr-posix.c,v
retrieving revision 1.4
diff -u -p -r1.4 thr-posix.c
--- thr-posix.c	2000/08/07 05:51:14	1.4
+++ thr-posix.c	2001/03/02 23:08:38
@@ -103,6 +103,7 @@ __objc_thread_set_priority(int priority)
 
   if (pthread_getschedparam(thread_id, &policy, &params) == 0)
     {
+#ifdef HAVE_SCHED_GET_PRIORITY_MAX
       if ((priority_max = sched_get_priority_max(policy)) != 0)
         return -1;
 
@@ -113,6 +114,7 @@ __objc_thread_set_priority(int priority)
         priority = priority_max;
       else if (priority < priority_min)
         priority = priority_min;
+#endif /* HAVE_SCHED_GET_PRIORITY_MAX */
       params.sched_priority = priority;
 
       /*


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]