public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: dllfixdbg: don't overwrite input DLL
@ 2022-02-03 15:31 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-02-03 15:31 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7ae91f3b560a365193142191627214b3a734b0f5

commit 7ae91f3b560a365193142191627214b3a734b0f5
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Feb 3 16:19:54 2022 +0100

    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>

Diff:
---
 winsup/cygwin/Makefile.am |  7 ++-----
 winsup/cygwin/dllfixdbg   | 14 ++++++++------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index 28c143434..265b6bf69 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -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@
diff --git a/winsup/cygwin/dllfixdbg b/winsup/cygwin/dllfixdbg
index 1ae64a1ef..e9e35aed1 100755
--- a/winsup/cygwin/dllfixdbg
+++ b/winsup/cygwin/dllfixdbg
@@ -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];


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-03 15:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 15:31 [newlib-cygwin] Cygwin: dllfixdbg: don't overwrite input DLL Corinna Vinschen

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).