Craig Small wrote:
reopen 460331
tags 460331 help
thankyou
And thanks to you for the rapid response. That's service!
On a i386:
...
On an Armel (agricola):
...
I had this information last Friday courtesy of strace and didn't realise it!
open("/proc/stat", O_RDONLY) = 3
...
read(3, "cpu 892 0 1477 18830 1336 54 1 0"..., 1024) = 564
...
open("/proc/uptime", O_RDONLY) = 3
...
read(3, "225.92 201.84\n"..., 1023) = 14
open("/proc/stat", O_RDONLY) = 4
...
read(4, "cpu 892 0 1478 18830 1336 54 1 0"..., 1023) = 564
...
write(2, "Unknown HZ value! (93) Assume 100"..., 35Unknown HZ value!
...
open("/proc/version", O_RDONLY) = 5
...
read(5, "Linux version 2.6.27.10.colibri32"..., 1024) = 155
So! the million dollar question, is the code wrong or
> is GCC on an Armel wrong?
Or is it the famous "undefined behaviour"?
Is there supposed to be an order here? It seems to be
consistently correct for the i386.
Possible getting lucky with a linker or compiler hash table.
Setting the priority will fix it,
Where can that be set? Is this something in the Makefile or are there
extra parameters to the attribute macro?
I'm just not sure if the real problem
is a GCC bug on the Armel.
I think the REAL problem is that objects "initialized/constructed" with
those attributes are assumed to be INDEPENDENT. If different parts are
dependent (as these two are) then the programmer is meant to handle this.
Maybe a library is only meant to have one constructor (that calls the
other initialisation functions in the right order)?
That would be the easiest way to fix this one, at the "expense" of
making init_Linux_version() non-static and exposing it in a header file.
The simplest fix I can think of would probably be a correct variation on:
- static void init_Linux_version(void) __attribute__((constructor));
static void init_libproc(void) __attribute__((constructor));
static void init_libproc(void){
have_privs = check_for_privs();
+ init_Linux_version();
init_signal_list() is also a "constructor". It is independent of the
other two and so is OK (but could probably be replaced with an assert of
some sort).
I wish the GCC documentation was written
a little clearer.
Could you please give me a pointer to which GCC docs cover dynamic
libraries?
--
===
Tom Evans tom.ev...@ceos.com.au
CEOS Pty Ltd www.ceos.com.au
3/17 Burgundy St, Heidelberg,
Victoria 3084, Australia
Phone (+61 3) 9458 4955
Direct Unsupported
FAX (+61 3) 9458 4966
Mobile 0405 776 431
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org