mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 00:07:36 +08:00
Cygwin: dllfixdbg: don't overwrite input DLL
Change dllfixdbg to keep the input DLL intact and just generate a new DLL matching the debug file. Fix Makefile rule accordingly. The result is, cygwin0.dll is the original DLL created with full debug sections and stays that way throughout the build process. Only new-cygwin1.dll will become the stripped DLL matching with the file containing the debug sections cygwin1.dbg. This is ok, because commit ba02fef995ac ("Cygwin: Makefile.am: fix DLL build rule") made new-cygwin1.dll the DLL to be installed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
96646006a7
commit
7ae91f3b56
@ -639,11 +639,8 @@ $(PRE_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)\
|
||||
$(newlib_build)/libc/libc.a \
|
||||
-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
|
||||
|
||||
$(DBG_DLL_NAME): $(PRE_DLL_NAME)
|
||||
$(AM_V_GEN)$(srcdir)/dllfixdbg $(OBJDUMP) $(OBJCOPY) $(PRE_DLL_NAME) $(DBG_DLL_NAME)
|
||||
|
||||
$(NEW_DLL_NAME): $(PRE_DLL_NAME) $(DBG_DLL_NAME)
|
||||
$(AM_V_GEN)ln -f $(PRE_DLL_NAME) $@
|
||||
$(DBG_DLL_NAME) $(NEW_DLL_NAME): $(PRE_DLL_NAME)
|
||||
$(AM_V_GEN)$(srcdir)/dllfixdbg $(OBJDUMP) $(OBJCOPY) $(PRE_DLL_NAME) $(DBG_DLL_NAME) $(NEW_DLL_NAME)
|
||||
|
||||
# cygwin import library
|
||||
toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
|
||||
|
@ -13,11 +13,13 @@ my $strip = $ARGV[0] eq '-s';
|
||||
shift if $strip;
|
||||
my $objdump = shift;
|
||||
my @objcopy = ((shift));
|
||||
my $dll = shift;
|
||||
my $dbg = shift;
|
||||
xit 0, @objcopy, '-R', '.gnu_debuglink_overlay', '--add-gnu-debuglink=/dev/null', '--only-keep-debug', $dll, $dbg;
|
||||
xit 0, @objcopy, '-g', '--keep-section=.gnu_debuglink_overlay', '--add-gnu-debuglink=' . $dbg, $dll;
|
||||
open(OBJDUMP, '-|', "$objdump --headers $dll");
|
||||
my $pre_dll = shift;
|
||||
my $dbg_dll = shift;
|
||||
my $new_dll = shift;
|
||||
my $verbose = shift;
|
||||
xit 0, @objcopy, '-R', '.gnu_debuglink_overlay', '--add-gnu-debuglink=/dev/null', '--only-keep-debug', $pre_dll, $dbg_dll;
|
||||
xit 0, @objcopy, '-g', '--keep-section=.gnu_debuglink_overlay', '--add-gnu-debuglink=' . $dbg_dll, $pre_dll, $new_dll;
|
||||
open(OBJDUMP, '-|', "$objdump --headers $new_dll");
|
||||
my %section;
|
||||
while (<OBJDUMP>) {
|
||||
my ($idx, $name, $size, $vma, $lma, $fileoff, $algn) = /^\s*(\d+)\s+(\.\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*$/;
|
||||
@ -55,7 +57,7 @@ for my $k (sort {$section{$a}{-idx} <=> $section{$b}{-idx}} keys %section) {
|
||||
}
|
||||
|
||||
warn "$0: ERROR final VMA (" . sprintf("0x%08x", $vma) . ") not on 64K boundary\n" if $vma != align($vma, 64 * 1024);
|
||||
push(@objcopy, $dll, @ARGV);
|
||||
push(@objcopy, $new_dll, @ARGV);
|
||||
xit 1, @objcopy;
|
||||
sub align {
|
||||
my $n = $_[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user