This is the mail archive of the
mailing list for the Cygwin project.
Re: [email@example.com: A serious bug of "ld --enable-auto-import"]
> Well, that's interesting. Since arrays ARE pointers(*), then perhaps
> it's enough to change gcc's behavior from
Not from gcc's perspective. From C's perspective, array symbols and
pointer symbols are mostly interchangeable, but they are not the same.
For example, these two declarations:
extern char *foo;
extern char foo;
are *not* the same, and using the wrong one results in a broken
For our purposes, a pointer is a symbol referencing a four-byte range
of memory that holds the address of a range of memory that holds a
sequence of characters, and an array is a symbol referencing a range
of memory that holds a sequence of characters. Because a pointer
requires an extra indirection, gcc is limited in the optimizations it
can do on it, but dealing with imports becomes simpler because the
address occurs in exactly one place.
Since a symbol is always a constant (regardless of what it refers to),
offsetting it by a constant results in a sum that can always be
computed at compile time (well, link time) and gcc will always do it
that way. This is a fairly fundamental concept in gcc, and I doubt it
would be practical to tell gcc to do it otherwise.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html