objc/4582: All objc tests fail on cygwin with gcc-3.1 (regression from 3.0)
Billinghurst, David (CRTS)
David.Billinghurst@riotinto.com
Sun Jan 13 04:23:00 GMT 2002
Most objc tests have failed on cygwin since late June 2001. I think the
cause is:
2001-06-27 Stan Shebs <shebs@apple.com>
* objc/objc-act.c (handle_impent): Rewrite to be more portable
and to use ASM_DECLARE_CLASS_REFERENCE.
* config/darwin.h (ASM_DECLARE_CLASS_REFERENCE): Rename from
undocumented DECLARE_CLASS_REFERENCE, add file argument.
* doc/tm.texi (ASM_DECLARE_CLASS_REFERENCE): Document.
The symptoms of the failure are:
/usr/local/obj/gcc/i686-pc-cygwin/libobjc/.libs/libobjc.a(linking.o): In
function `__objc_linking':
/usr/local/src/gcc/libobjc/linking.m:37: undefined reference to
`___objc_class_name_Object'
/usr/local/src/gcc/libobjc/linking.m:37: undefined reference to
`___objc_class_name_NXConstantString'
collect2: ld returned 1 exit status
In gcc-3.0, where the tests pass, these symbols are in NXConstStr.o and
Object.o with three leading underscores.
$ nm NXConstStr.o | grep objc_class
00000034 T ___objc_class_name_NXConstantString
U ___objc_class_name_Object
$ nm Object.o | grep objc_class_name
00000d04 T ___objc_class_name_Object
$ nm linking.o | grep objc_class
U ___objc_class_name_NXConstantString
U ___objc_class_name_Object
In gcc-3.1 the symbols only have two leading underscores.
$ nm NXConstStr.o | grep objc_class_name
U ___objc_class_name_Object
00000036 T __objc_class_name_NXConstantString
$ nm Object.o | grep objc_class_name
00000f16 T __objc_class_name_Object
$ nm linking.o | grep objc_class_name
U ___objc_class_name_NXConstantString
U ___objc_class_name_Object
The symbols that (now) only have two leading underscores are emitted in
objc-act.c(handle_impent). Before this change, another leading
underscore was added by ASM_GLOBALIZE_LABEL, but this is not done now
since the name has a leading '*'.
The patch below removes the leading '*' from the name and fixes the
problem on cygwin. I have no idea what it does on other platforms.
With it I get the following test results
Running /usr/local/src/gcc/gcc/testsuite/objc/compile/compile.exp ...
Running /usr/local/src/gcc/gcc/testsuite/objc/execute/execute.exp ...
FAIL: objc/execute/formal_protocol-6.m execution, -O0
FAIL: objc/execute/formal_protocol-6.m execution, -O1
FAIL: objc/execute/formal_protocol-6.m execution, -O2
FAIL: objc/execute/formal_protocol-6.m execution, -O3
-fomit-frame-pointer
FAIL: objc/execute/formal_protocol-6.m execution, -O3 -g
FAIL: objc/execute/formal_protocol-6.m execution, -Os
Running /usr/local/src/gcc/gcc/testsuite/objc.dg/dg.exp ...
Running /usr/local/src/gcc/gcc/testsuite/objc.dg/special/special.exp ...
=== objc Summary ===
# of expected passes 1036
# of unexpected failures 6
/usr/local/obj/gcc/gcc/xgcc version 3.1 20020110 (experimental)
Index: objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.123
diff -u -p -r1.123 objc-act.c
--- objc-act.c 2002/01/08 18:03:11 1.123
+++ objc-act.c 2002/01/13 12:20:33
@@ -8330,7 +8330,7 @@ handle_impent (impent)
string = (char *) alloca (strlen (class_name) + 30);
- sprintf (string, "*%sobjc_class_name_%s",
+ sprintf (string, "%sobjc_class_name_%s",
(flag_next_runtime ? "." : "__"), class_name);
}
else if (TREE_CODE (impent->imp_context) ==
CATEGORY_IMPLEMENTATION_TYPE)
More information about the Gcc-bugs
mailing list