public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: dllfixdbg: don't overwrite input DLL Date: Thu, 3 Feb 2022 15:31:18 +0000 (GMT) [thread overview] Message-ID: <20220203153118.CDD843858D37@sourceware.org> (raw) 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];
reply other threads:[~2022-02-03 15:31 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220203153118.CDD843858D37@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).