From: Brian D. <br...@de...> - 2007-03-29 08:26:26
|
> Olsson Lars-Erik wrote: > I am building a DLL and I want to make the .rdata segment writable to > be able to change the variable values in this segment during an > automatic testing process. After spent some days searching for a > solution I now ask this forum how to do this. I think this sounds like an extremely bad idea. You could probably do it by modifying the stock linker script (lib/ldscripts/i386pe.x) to put .rdata in the .data output section instead of in .rdata. If that doesn't work you'd probably have to edit the source (emultempl/pe.em). Even then there's a good chance the read-only-ness of any section named rdata is enforced by the operating system, so it wouldn't work just to remove the SEC_READONLY flag, although that's pure speculation on my part. Again, this sounds like an absolutely awful way to accomplish whatever it is that you're trying to do -- a hammer is not a screw driver, use your tools as they were designed, etc. Wouldn't it be a whole lot easier to just remove "const" from the variable's declaration? Brian |