public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Does objcopy --add-section .rsrc work for pei-i386?
@ 2012-02-03 13:21 Vladimir Simonov
  2012-02-04  5:32 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Simonov @ 2012-02-03 13:21 UTC (permalink / raw)
  To: binutils

Hi all,

Trying to add .rsrc section to pei-i386 dll (created by VS)
via "objcopy --add-section .rsrc=win32.res a.dll b.dll"
I get absolutely broken b.dll. According PEDUMP - .rsrc section
is on the head of sections list, EXPORTS and DEBUG entries are
empty, Resources are broken. "file win32.res" reports: MSVC .res.
I've tried to use win32.o in coff format - the same result.

So questions:
Should objcopy work in such mode?
Does somebody know how to add win32 resources directly to PE
executable without link step?

As I see, standard way to add win32 resources to executable is
1. Creare rc file
2. Compile it to obj(mingw) or res(VS) file
3. Link the obj/res with other objs/libs by linker.
I'd like to avoid link step because the executable is language
neutral but res files are language-dependent. So multi-language
won't require re-link every executable.

Regards
Vladimir Simonov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does objcopy --add-section .rsrc work for pei-i386?
  2012-02-03 13:21 Does objcopy --add-section .rsrc work for pei-i386? Vladimir Simonov
@ 2012-02-04  5:32 ` Alan Modra
  2012-02-04 15:18   ` Vladimir Simonov
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2012-02-04  5:32 UTC (permalink / raw)
  To: Vladimir Simonov; +Cc: binutils

On Fri, Feb 03, 2012 at 05:18:03PM +0300, Vladimir Simonov wrote:
> Should objcopy work in such mode?

No.  Resizing executables or shared libraries difficult.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does objcopy --add-section .rsrc work for pei-i386?
  2012-02-04  5:32 ` Alan Modra
@ 2012-02-04 15:18   ` Vladimir Simonov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Simonov @ 2012-02-04 15:18 UTC (permalink / raw)
  To: binutils; +Cc: Alan Modra

On 02/04/2012 08:31 AM, Alan Modra wrote:
> On Fri, Feb 03, 2012 at 05:18:03PM +0300, Vladimir Simonov wrote:
>> Should objcopy work in such mode?
>
> No.  Resizing executables or shared libraries difficult.
>
Alan, thank you for replay.

Can somebody understanding PE format and its status(state, goals) in
binutils better than Alan and me answer the following questions?

May it be that replace .rsrc section will be easier then its addition?
I mean the case when I create a.dll with English resources and will
replace them with other language resources if necessary.
Probably it is better to implement it in windres, not in objcopy.

 From the first glance on PE dumps it looks not too difficult.
We need just replace one .rsrc section with another one,
shift .reloc section appropriately(change VirtAddr),
recalculate file checksum(if necessary).

Am I missing something which is difficult?

Sorry in advance if my questions are stupid - I'm not PE format guru:)

Regards
Vladimir Simonov

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-04 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-03 13:21 Does objcopy --add-section .rsrc work for pei-i386? Vladimir Simonov
2012-02-04  5:32 ` Alan Modra
2012-02-04 15:18   ` Vladimir Simonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).