bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext patches for cygwin #4: accessing fields of exported structs/


From: Charles Wilson
Subject: Re: gettext patches for cygwin #4: accessing fields of exported structs/arrays
Date: Sun, 27 Nov 2005 01:48:35 -0500
User-agent: Thunderbird 1.5 (Windows/20051025)

Charles Wilson wrote:

Plus, if you're going to modify how gcc figures out which section to put variables into, you might as well go all the way: marking .text writable was a shortcut. Why not put all variables holding values that must be updated by relocation machinery, and are currently placed in .text, into .data instead? Ditto vars in .rdata meeting that specification? Then both .text and .rdata can stay non-writable.

<begin state-the-obvious>

D'oh. Major thinko. .text === program text. That is, code, not variables. The auto-import support infrastructure needs to update the actual code *at loadtime*. So every program gets its own copy of the DLL's code.

</end>

Yeah, that's a bummer -- there are thus *NO* memory advantages to DLLs. The only advantages you get are (1) synchronization, and (2) dynamic updates: (1) every app will(*) use the currently installed version of foo.dll, not whatever version of foo.a it was compiled with. (2) each up will automatically pick up the newly-installed DLL, possibly benefiting from bugfixes, etc.

(*) assuming you haven't done something stupid with $PATH and multiple DLLs...

It'd still be nice if gcc was smarter regarding the .rdata/const problem, tho: e.g. "if 'const var foo' contains reference to data imported from DLL, put in .data not .rdata"

--
Chuck




reply via email to

[Prev in Thread] Current Thread [Next in Thread]