This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [aida_s@mx12.freecom.ne.jp: A serious bug of "ld --enable-auto-import"]
DJ Delorie wrote:
>>Here's what hello.o looks like when hello.c uses
>>__declspec(dllimport) (and hwstr.c uses __declspec(dllexport)).
>>Recall that this configuration works as expected.
>>
>
> Right, because we're effectively telling gcc that hwstr1 is a pointer,
> not an array. That changes how gcc generates code. Pointers must be
> indexed at runtime, arrays may be indexed at compile time.
Well, that's interesting. Since arrays ARE pointers(*), then perhaps
it's enough to change gcc's behavior from
"arrays may be indexed at compile time" -- and currently, ARE indexed at
compile time
to
arrays indexed at runtime. (for pe-i386 targets)
That leaves two questions:
a) will it fix the observed problem
b) will gcc accept it
(Is there a gcc option to force runtime indexing of arrays?)
--Chuck
(*) okay, I'm C-biased. I'm not sure how a change of the type proposed
here would affect C++, Fortran, Ada, Java, .... but turning OFF this
optimization shouldn't break anything, should it?