discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Topics about GNUstep/libobjc2


From: Dr. Rolf Jansen
Subject: Topics about GNUstep/libobjc2
Date: Mon, 24 Oct 2016 14:52:02 -0200

Would it be OK to discuss on this list topics about Objective-C development 
involving clang + GNUstep/libobjc2, but almost nothing else from GNUstep?

I constructed my own root class having only the bare basic methods that are 
needed by a quite old project, that I revamped for inclusion into a new plain C 
project. My class/code is working well on FreeBSD 11.0 RELEASE-p1 (amd64) when 
compiled with clang 3.8 (system) with -O0 or -Os and linked against libobjc2 
1.8.1 (ports). Once compiled with any other optimization mode, it crashes (Bus 
Error) when accessing a certain instance variable struct.

It is working well on Mac OS X 11.12 when compiled in any -O mode with my root 
class and linked against the native ObjC runtime. It is almost always working 
on FreeBSD 11 in any -O mode when using NSObject as the root class and linked 
against libobjc2 1.8.1 and gnustep-base (ports), although, I saw 2 random 
crashes.

After some debugging I found a workaround. Once I add a #pragma pack(8) 
directive at the top of the headers that declare my class hierarchy + all the C 
structs that are used throughout, the code with my root class works well on 
FreeBSD 11 when compiled in any -O mode -- a pack(4) does work as well.

It is still possible that something is wrong with my code. However, after these 
many experiments, I tend to assume that the Objective-C runtime and the 
compiler sometimes disagree on correct packing/alignment of instance variables 
in instantiated objects. I can't tell, though, if the runtime or the compiler 
is responsible for this.

In the case that it is appropriate to discuss this further on this list, I am 
ready to send more information. If this is not the appropriate list, then 
please may I ask for advise on which location this topic may be discussed.

The #pragma pack(8) does neither cost anything nor is it a very ugly hack, so 
perhaps, it isn't even worth to discuss this issue furthermore, given that 
clang 4.0 may be out soon.

Best regards

Rolf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]