gcc-4.4.x bug in ARM-EABI code generator/optimizer for Objective-C?

Dr. H. Nikolaus Schaller hns@goldelico.com
Mon Apr 9 10:03:00 GMT 2012


Dear help,
I have built three cross-toolchains that run on Mac OS X and
cross-compile to i486, arm-eabi, mipsel. The goal is to make
them compatible to Debian Squeeze.

Therefore I have gcc-4.4.5, binutils-2.20.1, glibc-2.11.3, linux-headers-2.6.32

Everything works fine and I was even able to cross-compile
ARM-Linux-kernels (2.6.32 and 3.2).

Only one remaining issue is with Objective C.

As soon as I use the [super method] construct in a method, I
get this message from the assembler for each class using such
a super call in any method:

/var/folders/Q-/Q-r6LiEpG+S3E54UanorqU+++TM/-Tmp-//ccG6BCbh.s: Assembler messages:
/var/folders/Q-/Q-r6LiEpG+S3E54UanorqU+++TM/-Tmp-//ccG6BCbh.s:164: Error: symbol `_OBJC_CLASS_Test' is already defined

The really strange thing is that it is
* only on arm-linux-gnueabi target
* only for -O1 -O2 -O3 -Os but NOT for -O0
* by trying all -f options to control the optimizer I could not find a
   single one that is responsible

The test code is very simple:

#define BUG 1

#include <objc/objc.h>
#include <objc/Object.h>

@interface Test : Object
@end

@implementation Test

- (id) init
{
#if BUG
	[super init];
#endif
	return nil;
}

@end

Compiling with -S option gives me the assembler sources. The i486 and the
mipsel code looks quite similar (except architecture specific codes and
variations), but the arm code is quite different.

It has indeed a second definition of _OBJC_CLASS_Test: and does define
additional symbols like .LANCHOR1 which is not seen in the unoptimized
-O0 code.

I had also built gcc-4.4.7 and there is no difference.

So is this a known bug in the ARM-EABI code generator/optimizer?
Is there a workaround by giving some compiler options?
How can I further debug the issue to find a fix?

Thanks,
Nikolaus Schaller

arm for -O0:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test-arm-linux-gnueabi--O0.s
Type: application/octet-stream
Size: 3672 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120409/b7653cc3/attachment.obj>
-------------- next part --------------


generated assembler code (for -O1):
arm:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test-arm-linux-gnueabi--O1.s
Type: application/octet-stream
Size: 3490 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120409/b7653cc3/attachment-0001.obj>
-------------- next part --------------


i486:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test-i486-linux-gnu--O1.s
Type: application/octet-stream
Size: 2915 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120409/b7653cc3/attachment-0002.obj>
-------------- next part --------------


mipsel:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test-mipsel-linux-gnu--O1.s
Type: application/octet-stream
Size: 3977 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120409/b7653cc3/attachment-0003.obj>
-------------- next part --------------




More information about the Gcc-help mailing list