This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] [pei-386] prevent ld (auto-import) from generating broken code

DJ Delorie wrote:

> I wouldn't recommend using volatile, because it won't always work. 

so you're saying that in some cases, gcc will ignore the 'volatile' 
marker, and replace the variable with a constant?  Why?  Isn't 
preventing that "optimization" exactly what the volatile modifier is for?

> If
> they need to adjust their sources anyway, they should use the
> dllimport syntax.

Ugh.  As I said earlier, that's almost as bad as the original situation. 
  Now you need special compile time flags to match your link time flags, 
depending on whether you will link to a static lib or dynamic lib, or 
whether you have dynamic libs installed or only static ones...

But only if your client code does some esoteric thing; these #defines 
aren't necessary for most client code...


Are you *sure*

{ volatile type t=extern_array; t[1] = ... }
{ volatile int t=constant_index; extern_array[t] = ... }
{ volatile struct s * t = &extern_struct; t->field = ... }

won't always work (given auto-import support and thunking symbols in the 
DLL)?  Why not?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]