This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFA] [pei-386] prevent ld (auto-import) from generating broken code
- To: DJ Delorie <dj at delorie dot com>
- Subject: Re: [RFA] [pei-386] prevent ld (auto-import) from generating broken code
- From: Charles Wilson <cwilson at ece dot gatech dot edu>
- Date: Tue, 11 Sep 2001 14:27:57 -0400
- CC: binutils at sources dot redhat dot com, Paul dot Sokolovsky at technologist dot com
- References: <3B9D788B.2030403@ece.gatech.edu> <200109111812.OAA19209@envy.delorie.com>
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...
Blech.
Are you *sure*
{ volatile type t=extern_array; t[1] = ... }
and
{ volatile int t=constant_index; extern_array[t] = ... }
and
{ volatile struct s * t = &extern_struct; t->field = ... }
won't always work (given auto-import support and thunking symbols in the
DLL)? Why not?
--Chuck