Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com> List-Archive: <http://sources.redhat.com/ml/cygwin/> List-Post: <mailto:cygwin AT sources DOT redhat DOT com> List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sun, 26 Aug 2001 12:43:01 -0400 Message-Id: <200108261643.MAA06855@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f From: DJ Delorie <dj AT delorie DOT com> To: cwilson AT ece DOT gatech DOT edu CC: binutils AT sources DOT redhat DOT com, cygwin AT cygwin DOT com In-reply-to: <3B891E23.9090407@ece.gatech.edu> (message from Charles Wilson on Sun, 26 Aug 2001 12:04:51 -0400) Subject: Re: [aida_s AT mx12 DOT freecom DOT ne DOT jp: A serious bug of "ld --enable-auto-import"] References: <3B8884F6 DOT 80708 AT ece DOT gatech DOT edu> <200108260530 DOT BAA28221 AT envy DOT delorie DOT com> <3B888D76 DOT 6090102 AT ece DOT gatech DOT edu> <200108260613 DOT CAA28557 AT envy DOT delorie DOT com> <3B891172 DOT 9000207 AT ece DOT gatech DOT edu> <200108261543 DOT LAA06415 AT envy DOT delorie DOT com> <3B891E23 DOT 9090407 AT ece DOT gatech DOT edu> > 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 program. 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 Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/