Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

QNX - GNUstep and Objective C

70 views
Skip to first unread message

bbceler

unread,
Oct 25, 2009, 7:48:14 AM10/25/09
to Discuss...@gnu.org

Hi everyone.
I work in QNX.
QNX supports officially only gcc4.3 and languages c and c ++ and has own GUI
- QNX Photon.
I compile gcc4.4 / gcc4.5 in QNX.
That is why I have the working on QNX compiler objc. I use to tests objc
from gcc4.5.0.
I made the test of writing the program in objc to working in the environment
Photon. We practically use only language c to the programming in Photon,
then the transfer on the language objc turned out very simple.
I porting and compiled on QNX 6.4.1 gnustep-make-2.2.0 and
gnustep-base-1.19.3.
Simple test program work correctly.
Because I have small knowledge in objc and GNUstep I have the question:
when I using objc from gcc4.4 / gcc4.5 to use for GNUstep I should use
gnustep-objc-1.6.0 ?
and what from http://svn.gna.org/viewcvs/gnustep/libs/libobjc2/ ?
or the better use libobjc from gcc ?

--
View this message in context: http://www.nabble.com/QNX---GNUstep-and-Objective-C-tp26047107p26047107.html
Sent from the GNUstep - General mailing list archive at Nabble.com.

David Chisnall

unread,
Oct 25, 2009, 5:47:52 PM10/25/09
to bbceler, Discuss...@gnu.org
On 25 Oct 2009, at 11:48, bbceler wrote:

>
> Hi everyone.
> I work in QNX.
> QNX supports officially only gcc4.3 and languages c and c ++ and has
> own GUI
> - QNX Photon.
> I compile gcc4.4 / gcc4.5 in QNX.
> That is why I have the working on QNX compiler objc. I use to tests
> objc
> from gcc4.5.0.
> I made the test of writing the program in objc to working in the
> environment
> Photon. We practically use only language c to the programming in
> Photon,
> then the transfer on the language objc turned out very simple.
> I porting and compiled on QNX 6.4.1 gnustep-make-2.2.0 and
> gnustep-base-1.19.3.

That's really great - I was wondering if anyone was running GNUstep on
QNX. Would it be possible for you to try a recent svn version and
make sure that the changes to the threading support work with QNX's
version of pthreads?

> Simple test program work correctly.
> Because I have small knowledge in objc and GNUstep I have the
> question:
> when I using objc from gcc4.4 / gcc4.5 to use for GNUstep I should use
> gnustep-objc-1.6.0 ?
> and what from http://svn.gna.org/viewcvs/gnustep/libs/libobjc2/ ?
> or the better use libobjc from gcc ?

I should really write something on the web site about this.
Basically, at the moment, you should use libobjc from GCC if it's
relatively modern.

The 1.6.0 libobjc in GNUstep is a really old version of GCC libobjc,
for use with platforms that only support an even older GCC (things
that Riccardo runs, which only support GCC 2.95). This should only be
used if your GCC comes with a broken libobjc.

The libobjc2 is an experimental fork of a recent GCC libobjc, with
support for a new ABI and a load of other stuff. I've made some very
invasive changes in this and they haven't been adequately tested. I'm
currently running it, and as of today I can run all of the GNUstep
apps I have installed with it, but I wouldn't recommend that anyone
else runs it yet unless you are interested in fixing bugs that you
encounter, or testing experimental features in clang.

David

-- Sent from my brain

bbceler

unread,
Nov 1, 2009, 6:25:23 AM11/1/09
to Discuss...@gnu.org

I compiled the newest version gnustep - base from svn.
Compilation passed without problems and to tests I chose program
diningPhilosophers from Examples.
To comparison I used analogous program compiled by compiler ada - gnat4.2.2
and the compiler of language the Vala.
CPU: Intel Core2 Quad 2.40GHz OS: QNX 6.4.1
diningPhilosophers:
pid name sid start time utime stime
9420869 diningPhilosophers 495654 Oct 31 22:49 25.125 5.004
In Instance methods
- (void)sitAtChair:(NSNumber *)
I exchanged expression: for { and = 0;and < 10000 on expression usleep(
100000 );
pid name sid start time utime
stime
10621002 diningPhilosophers_2 495654 Oct 31 22:54 26.600 0.001
when
* start time the time and date that the process was started
* utime the number of CPU seconds consumed by the process
* stime the number of CPU seconds consumed by the kernel on behalf
of the process

And now program compiled using the compiler of the language Vala.
pid name sid start time utime stime
14803031 ./philosofers 495654 Oct 31 23:15 0.004 0.000

and Ada - gnat4.2.2
pid name sid start time utime stime
24789088 ./diners 495654 Oct 31 23:30 0.014 0.004

This looks from the point of the sight of threads:

Show thread times.
pid tid name STATE start time thread
start sutime
11956301 1 diningPhilosophers RUNNING Oct 31 23:00 Oct 31 23:00 7.958
11956301 2 diningPhilosophers MUTEX Oct 31 23:00 Oct 31 23:00 2.221
11956301 3 diningPhilosophers READY Oct 31 23:00 Oct 31 23:00
2.127
11956301 4 diningPhilosophers MUTEX Oct 31 23:00 Oct 31 23:00 2.220
11956301 5 diningPhilosophers READY Oct 31 23:00 Oct 31 23:00 2.015
11956301 6 diningPhilosophers MUTEX Oct 31 23:00 Oct 31 23:00 2.075
..............................
pid tid name STATE start time
thread start sutime
11620427 1 diningPhilosophers_2 RUNNING Oct 31 22:58 Oct 31 22:58
8.277
11620427 2 diningPhilosophers_2 MUTEX Oct 31 22:58 Oct 31 22:58
0.000
11620427 3 diningPhilosophers_2 NANOSLEEP Oct 31 22:58 Oct 31 22:58
0.000
11620427 4 diningPhilosophers_2 MUTEX Oct 31 22:58 Oct 31 22:58
0.000
11620427 5 diningPhilosophers_2 MUTEX Oct 31 22:58 Oct 31 22:58
0.000
11620427 6 diningPhilosophers_2 NANOSLEEP Oct 31 22:58 Oct 31 22:58
0.000
start_time The thread's starting time, in nanoseconds..
sutime The thread's system plus user running time, in nanoseconds.
diningPhilosophers:
stack tid pid-tid STATE cpu prio kernel call
12K(516K)* 1 12689488-0 RUNNING 3 10r
4096(132K) 2 12689488-0 RUNNING 1 10r
4096(132K) 3 12689488-0 MUTEX 2 10r sync_mutex_lock
4096(132K) 4 12689488-0 READY 2 10r
4096(132K) 5 12689488-0 MUTEX 3 10r sync_mutex_lock
4096(132K) 6 12689488-0 MUTEX 0 10r sync_mutex_lock
diningPhilosophers_2:
stack tid pid-tid STATE cpu prio kernel call
16K(516K)* 1 13897811-0 RUNNING 3 10r
4096(132K) 2 13897811-0 MUTEX 1 10r sync_mutex_lock
4096(132K) 3 13897811-0 NANOSLEEP 1 10r timer_timeout
4096(132K) 4 13897811-0 MUTEX 0 10r sync_mutex_lock
4096(132K) 5 13897811-0 MUTEX 0 10r sync_mutex_lock
4096(132K) 6 13897811-0 MUTEX 2 10r sync_mutex_lock

Vala
pid tid name STATE start time thread
start sutime
17399899 1 ./philosofers SIGWAITINFO Oct 31 23:19 Oct 31 23:19 0.002
17399899 2 ./philosofers NANOSLEEP Oct 31 23:19 Oct 31 23:19
0.000
17399899 3 ./philosofers NANOSLEEP Oct 31 23:19 Oct 31 23:19
0.000
17399899 4 ./philosofers CONDVAR Oct 31 23:19 Oct 31 23:19
0.000
17399899 5 ./philosofers CONDVAR Oct 31 23:19 Oct 31 23:19
0.000
17399899 6 ./philosofers NANOSLEEP Oct 31 23:19 Oct 31 23:19
0.000

stack tid pid-tid STATE cpu prio kernel call
12K(516K)* 1 14442581-0 SIGWAITINFO 2 10r signal_waitinfo
4096(132K) 2 14442581-0 NANOSLEEP 2 10r timer_timeout
4096(132K) 3 14442581-0 NANOSLEEP 3 10r timer_timeout
4096(132K) 4 14442581-0 CONDVAR 0 10r sync_condvar_wa
4096(132K) 5 14442581-0 CONDVAR 0 10r sync_condvar_wa
4096(132K) 6 14442581-0 NANOSLEEP 3 10r timer_timeout

Ada - gnat4.2.2
pid tid name STATE start time thread
start sutime
25940065 1 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.006
25940065 2 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.015
25940065 3 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.000
25940065 4 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.000
25940065 5 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.000
25940065 6 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.000
25940065 7 ./diners CONDVAR Oct 31 23:32 Oct 31 23:32 0.000

stack tid pid-tid STATE cpu prio kernel call
12K(516K)* 1 20852829-0 CONDVAR 2 31o sync_condvar_wa
4096(2052K) 2 20852829-0 CONDVAR 2 31o sync_condvar_wa
4096(2052K) 3 20852829-0 CONDVAR 1 31o sync_condvar_wa
4096(2052K) 4 20852829-0 CONDVAR 3 31o sync_condvar_wa
4096(2052K) 5 20852829-0 CONDVAR 1 31o sync_condvar_wa
4096(2052K) 6 20852829-0 CONDVAR 0 31o sync_condvar_wa
4096(2052K) 7 20852829-0 CONDVAR 2 31o sync_condvar_wa

diningPhilosophers.m
..............
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
int i;
..............
for (i = 0;i < 5; ++i)
[forks[i] unlockWithCondition:FOOD_SERVED];

while (1);
[arp release];
}

Executing the statement while(1); in the main thread of the program
diningPhilosophers makes
the loop of the expectation and such large time sutime results from here.
In Vala this looks as follows:

static int main (string[] args) {

if (!Thread.supported ()) {
error ("Cannot run without thread support.");
}
..................
new MainLoop (null, true).run ();

return 0;
}

In ada/gnat this realized using the mechanism of tasks.
Someone could me maybe prompt as realize the loop of the expectation in
GNUstep better.

And as you can see Vala and gnat they use the mechanism condvare to the
synchronisation of threads.
GNUstep uses mutex. Is to use however condvare not better ?
===============================
Javier Miranda explains in "A Detailed Description of the GNU Ada Run Time"
why gnat uses condvare and not mutex
for the synchronisation of threads.

Low-Level Locks

The GNAT run-time uses Lock/Unlock operations in order to maintain data
consistency under concurrent
read/update operations by multiple threads of control.
.................
Mutual exclusion is provided through POSIX mutexes. When a thread wants
exclusive access to some shared resource,
it locks the associated mutex, via pthread_mutex_lock(); if some other
thread has already locked that mutex,
the requesting thread is suspended until the thread holding the mutex
unlocks it, via pthread_mutex_unlock().
Any number of tasks can be suspended on the same mutex; one of them is
granted the mutex and permitted to continue
execution when the holder unlocks the mutex. Mutexes are similar to binary
semaphores; the principal difference
is that the thread which holds the mutex must be the one to unlock it. This
makes mutexes difficult to use for
general communication between threads; an arbitrary thread cannot signal to
other threads that something has
occurred by unlocking a locked mutex. For this kind of synchronization,
condition variables are used.

A thread waits for a condition to become true by calling pthread_cond_wait()
on a condition variable.
Another thread can signal that the condition has become true by signaling
the condition variable, via
pthread_cond_signal() (this is not to be confused with operations on POSIX
signals). A mutex is associated with
the condition variable by the pthread_cond_wait() call. This mutex must be
locked before the call;
it is unlocked (atomically) by the call and locked again before the call
returns. This is to protect the
condition for which the thread is waiting. A pthread_cond_signal() call is
guaranteed to wake up at least one
waiting thread, but it turns out to be more efficient (particularly on
multiprocessors) to allow more than one
waiting thread to return. Since the first thread to reacquire the associated
mutex might make the condition false
again, each thread needs to check that the condition is true when
pthread_cond_wait() returns.
This is usually done in a while loop.


--
View this message in context: http://old.nabble.com/QNX---GNUstep-and-Objective-C-tp26047107p26148884.html

David Chisnall

unread,
Nov 1, 2009, 10:41:57 AM11/1/09
to bbceler, Discuss...@gnu.org
On 1 Nov 2009, at 11:25, bbceler wrote:

> And as you can see Vala and gnat they use the mechanism condvare to
> the
> synchronisation of threads.
> GNUstep uses mutex. Is to use however condvare not better ?


I'm not sure what the point you are trying to make is. GNUstep
provides mutexes via NSLock and NSRecursiveLock and condition
variables via NSCondition and NSConditionLock.

In future it would help if you can state your questions succinctly.
It took me quite a while to wade through the output dumps and quotes
in your email to find something that looked a bit like a question...

David

-- Sent from my Apple II

bbceler

unread,
Jan 3, 2010, 2:33:08 PM1/3/10
to Discuss...@gnu.org

I finished works on porting LLVM and clang on QNX recently. I also compiled
libobjc2 from GNUstep. clang compiles without problems programs in C. I make
the tests of the compilation of programs in objc 2.0. That programs do not
use GNUstep one compiles and they work without problems.
I have however the problem with compiling programs using GNUstep. Programs
compiles but while starting the mistake appears:
./autogsdoc
Error: Instance variables in GSAttrDictionary overlap superclass
NSObjectThis probably means that you are subclassing a class from a library,
which has changed in a binary-incompatible way.
Abort (core dumped)
Because I compiled gnustep-base use gcc runtime I thought that should this
gnustep-base compile also with the use of clang. I compiled the library
gnustep-base using clang and libobjc2.
The effect is the same unfortunately. I did not have problems with programs
in objc 1.0 and GNUstep.
Can the problem come into being because of the conflicts gcc libobjc with
the library libobjc2 from GNUstep ?


--
View this message in context: http://old.nabble.com/QNX---GNUstep-and-Objective-C-tp26047107p27004526.html

David Chisnall

unread,
Jan 4, 2010, 10:04:12 AM1/4/10
to bbceler, Discuss...@gnu.org
Hi,

This error will appear if the first instance variable in a class
appears before the end of the last instance variable in the
superclass. In this case, the first instance variable is a 'struct
stat' and it is (apparently) overlapping with the isa pointer.

It's not clear from your post. Are you linking against both libobjc2
(which installs itself as libobjc.so.4) and against GCC libobjc
(libobjc.so.3 or libobjc.so.2)? If so, then you can expect things to
break quite badly, because both export the same symbols. Please use
one or the other, not both. If this is not the problem then...

Both NSObject and GSAttrDictionary are part of -base, so you will have
compiled them with the same compiler. The problem is therefore not an
issue of mismatched compilers, but it may well be something related to
the ABI handling in clang. The ivar offset calculation code is not
yet particularly well tested beyond x86 *NIX platforms. It is
possible that there is a bug.

I've just added a bit more debugging code to libobjc2, so it will tell
you what the name and offsets of the offending ivars are. Please can
you run the new version and see what the message is? Please can you
also let me know what architecture you are using, so I can check that
clang is generating the correct IR?

You can also comment out line 787 in libobjc2's init.c. This will
revert to the behaviour of the older versions of libobjc and see if
things actually break.

David

> _______________________________________________
> Discuss-gnustep mailing list
> Discuss...@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep

-- Send from my Jacquard Loom

bbceler

unread,
Jan 5, 2010, 5:31:10 AM1/5/10
to Discuss...@gnu.org

Hi,
I compiled libobjc2 revision 29205 and test simple program.
bash-4.0# make clean
bash-4.0# make messages=yes CC=clang 2>&1 | tee CC.log
This is gnustep-make 2.2.0. Type 'make print-gnustep-make-help' for help.
Making all for tool LogTest...
cd .; \
/usr/pkg/share/GNUstep/Makefiles/mkinstalldirs ./obj
make -f GNUmakefile --no-print-directory --no-keep-going \
internal-tool-compile \
GNUSTEP_TYPE=tool \
GNUSTEP_INSTANCE=LogTest \
GNUSTEP_OPERATION=compile \
GNUSTEP_BUILD_DIR="." \
_GNUSTEP_MAKE_PARALLEL=yes
clang source.m -c \
-MMD -MP -I/usr/pkg/include -I/usr/pkg/share/GNUstep/include
-I/usr/include -g -D__QNXNTO__ -D__ X86__ -D__LITTLEENDIAN__
-D_FILE_OFFSET_BITS=64 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1
-DGNUSTEP_BASE_LIBRARY=1 -fPIC -shared
-DGSWARN -DGSDIAGNOSE -Wno-import -O2 -I/usr/pkg/include
-I/usr/pkg/share/GNUstep/include
-Wno-import -I/usr/include -fno-strict-aliasing -fgnu-runtime
-fconstant-string-class=NSConstantString
-I. -I/root/GNUstep/Library/Headers -I/usr/pkg/include \
-o obj/source.m.o
clang -Wl,--export-dynamic -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
-Wl,-R/usr/pkg/share/GNUstep/lib
-L/usr/lib -Wl,-R/usr/lib -fgnu-runtime -o obj/LogTest \
./obj/source.m.o \
-L/root/GNUstep/Library/Libraries -L/usr/pkg/lib -lobjc
-lgnustep-base -lobjc -lm
bash-4.0# cd obj
bash-4.0# ./LogTest

Error: Instance variables in GSAttrDictionary overlap superclass NSObject
Offset of first instance variable, statbuf, is 8
Last instance variable in superclass, isa, ends at offset 4

This probably means that you are subclassing a class from a library, which
has changed in a
binary-incompatible way.
abort (core dumped)
bash-4.0#
bash-4.0# ldd LogTest
./LogTest:
libobjc.so.4 => /usr/pkg/lib/libobjc.so.4 (0xb8200000)
libgnustep-base.so.1.19 => /usr/pkg/lib/libgnustep-base.so.1.19
(0xb8220000)
libm.so.2 => /lib/libm.so.2 (0xb85be000)
libgmp.so.3 => /usr/pkg/lib/libgmp.so.3 (0xb85f1000)
libgnutls.so.26 => /usr/pkg/lib/libgnutls.so.26 (0xb8653000)
libgcrypt.so.11 => /usr/pkg/lib/libgcrypt.so.11 (0xb86e3000)
libgpg-error.so.0 => /usr/pkg/lib/libgpg-error.so.0 (0xb874f000)
libsocket.so.2 => /lib/libsocket.so.2 (0xb8752000)
libxslt.so.1 => /usr/pkg/lib/libxslt.so.1 (0xb8781000)
libxml2.so.2 => /usr/pkg/lib/libxml2.so.2 (0xb87b1000)
libz.so.1 => /usr/pkg/lib/libz.so.1 (0xb88c4000)
libiconv.so.2 => /usr/pkg/lib/libiconv.so.2 (0xb88d5000)
libffi.so.5 => /usr/pkg/lib/libffi.so.5 (0xb89b4000)
libtasn1.so.3 => /usr/pkg/lib/libtasn1.so.3 (0xb89b7000)
libintl.so.3 => /usr/pkg/lib/libintl.so.3 (0xb89c6000)
libc.so.3 => /usr/lib/ldqnx.so.2 (0xb0300000)
bash-4.0#

1. -fgnu-runtime => this is correct ?
2. I work on x86 PC , QNX 6.4.1 (32 bit), CPU Intel Core2 Quad Q6600 2.40
GHz
3. and this is not the mistake:

[gnustep]/libs/base/trunk/Source/NSObject.m
@interface NSZombie
{
Class isa;
}
- (Class) class;
.................
@end
but
@implementation NSZombie
- (Class) originalClass => is it correct ?
{
return NSMapGet(zombieMap, (void*)self);
}
.................

--
View this message in context: http://old.nabble.com/QNX---GNUstep-and-Objective-C-tp26047107p27026421.html

David Chisnall

unread,
Jan 5, 2010, 8:11:25 AM1/5/10
to bbceler, Discuss...@gnu.org
On 5 Jan 2010, at 10:31, bbceler wrote:

> Error: Instance variables in GSAttrDictionary overlap superclass
> NSObject
> Offset of first instance variable, statbuf, is 8
> Last instance variable in superclass, isa, ends at offset 4
> This probably means that you are subclassing a class from a library,
> which
> has changed in a
> binary-incompatible way.


Ah, this is indeed my fault. I was not allowing for alignment in the
checking. I think I've fixed that now, let me know if it still breaks
for you.

David

-- Sent from my Cray X1

bogdan

unread,
Jan 6, 2010, 1:57:09 AM1/6/10
to bce...@op.pl, David Chisnall, Discuss...@gnu.org
David,
I have compiled new version libobjc2 but error is the same
I compile libobjc2 and gnustep-base using gcc. But when I linking gnustep program with gcc
library is all right. Error appears when I linking program with libobjc2
And everything one if I use gcc or clang.

"David Chisnall" <ther...@sucs.org> napisaƂ(a):

bbceler

unread,
Jan 8, 2010, 1:59:26 PM1/8/10
to Discuss...@gnu.org

I use as test program:
source.m
=========
#import <Foundation/Foundation.h>

int
main (void)
{
NSLog (@"Executing");
return 0;
}
=========
make CC=clang and use libobjc2

Error appears in when library function be called out:
static void __objc_compute_ivar_offsets (Class class); from init.c
which be called out by:
static void
__objc_create_classes_tree (Module_t module)
{
...................
objc_tree_insert_class (class);
__objc_compute_ivar_offsets (class);
...................
}

I made in function __objc_compute_ivar_offsets change:
1. I added on beginning fprintf( ..........)
static void
__objc_compute_ivar_offsets (Class class)
{
int i = 0;
/* If this class was compiled with support for late-bound ivars, the
* instance_size field will contain 0 - {the size of the instance
variables
* declared for just this class}. The individual instance variable offset
* fields will then be the offsets from the start of the class, and so
must
* have the size of the parent class prepended. */
fprintf(stderr, "class: %s ->instance_size %d \n",
class->name, class->instance_size);
if (class->instance_size <= 0)
{
super = class_superclass_of_class(class);
if (Nil == super) { return; }
.............................
and I comment abort() on end of function:
.............................
fprintf(stderr, "This probably means that you are subclassing a class
from a library, which has changed in a binary-incompatible way.\n");
// abort();
}
}

Result is following:
class: NXConstantString ->instance_size 12
class: Object ->instance_size 4
class: Protocol ->instance_size 20
class: GSInet6ServerStream ->instance_size 160
class: GSInetServerStream ->instance_size 160
class: GSInet6OutputStream ->instance_size 160
................................
class: NSException ->instance_size 16
class: NSFileHandle ->instance_size 4
class: GSAttrDictionaryEnumerator ->instance_size 12
class: GSAttrDictionary ->instance_size 80

Error: Instance variables in GSAttrDictionary overlap superclass NSObject
Offset of first instance variable, statbuf, is 8
Last instance variable in superclass, isa, ends at offset 4
This probably means that you are subclassing a class from a library, which
has changed in a binary-incompatible way.

class: NSDirectoryEnumerator ->instance_size 24
class: NSFileManager ->instance_size 8
..................................
class: GSRunLoopCtxt ->instance_size 76
class: GSLocalServerStream ->instance_size 264
Error: Instance variables in GSLocalServerStream overlap superclass
GSSocketServerStream
Offset of first instance variable, _serverAddr, is 158
Last instance variable in superclass, _address, ends at offset 160


This probably means that you are subclassing a class from a library, which
has changed in a binary-incompatible way.

class: NSOutputStream ->instance_size 4
class: NSInputStream ->instance_size 4
class: NSStream ->instance_size 4
..................................
class: Protocol2 ->instance_size 36
class: Protocol ->instance_size 20
class: Object ->instance_size 4
class: NXConstantString ->instance_size 12
2010-01-08 12:39:27.031 LogTest[40984635] Executing

Function __objc_compute_ivar_offsets() be called out 379 times. For two
classes GSAttrDictionary and GSLocalServerStream appeared mistake.
It can from this was infer, that mistake however appears in different place
?

--
View this message in context: http://old.nabble.com/QNX---GNUstep-and-Objective-C-tp26047107p27080734.html

David Chisnall

unread,
Jan 8, 2010, 2:21:23 PM1/8/10
to bbceler, Discuss...@gnu.org
On 8 Jan 2010, at 18:59, bbceler wrote:

> Error: Instance variables in GSAttrDictionary overlap superclass
> NSObject
> Offset of first instance variable, statbuf, is 8
> Last instance variable in superclass, isa, ends at offset 4
> This probably means that you are subclassing a class from a library,
> which
> has changed in a binary-incompatible way.

This one should have been fixed - I'm now allowing for alignment. If
statbuf only requires alignment of 4 but is being aligned on an 8-byte
boundary, then this is a bug in clang. If statbuf really requires
alignment of 8 then it's a bug in libobjc2.

I don't think clang has a QNX target, so this may be the issue, but
usually alignment is per-CPU, not per-target.

> Error: Instance variables in GSLocalServerStream overlap superclass
> GSSocketServerStream
> Offset of first instance variable, _serverAddr, is 158
> Last instance variable in superclass, _address, ends at offset 160
> This probably means that you are subclassing a class from a library,
> which
> has changed in a binary-incompatible way.

This one is more concerning. The sockaddr ivar from
GSSocketServerStream
appears to end two bytes after the first ivar declared in
GSLocalServerStream.


> Function __objc_compute_ivar_offsets() be called out 379 times.

Yes, it's called once per class.

> For two
> classes GSAttrDictionary and GSLocalServerStream appeared mistake.
> It can from this was infer, that mistake however appears in
> different place
> ?

In both cases, the first instance variable is a structure, but I'm not
sure that this makes a difference. Unfortunately, they're both
structures from system headers, so I can't reproduce the same
situation on other platforms...

Do you get different behaviour if you compile these two classes with
GCC? I note that you're using the GCC ABI with clang, so you should
get equivalent code from both compilers; if you don't then it's a bug.

David

0 new messages