* [PATCH cygport 0/2] Avoid misbehaviour with llvm-objdump
@ 2022-02-01 17:25 Jon Turney
2022-02-01 17:25 ` [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink Jon Turney
2022-02-01 17:25 ` [PATCH cygport 2/2] Don't use llvm-objdump Jon Turney
0 siblings, 2 replies; 5+ messages in thread
From: Jon Turney @ 2022-02-01 17:25 UTC (permalink / raw)
To: cygwin-apps; +Cc: Jon Turney
Jon Turney (2):
postinst: Never remove an existing .gnu_debuglink
Don't use llvm-objdump
lib/pkg_info.cygpart | 8 --------
lib/src_postinst.cygpart | 35 +++++++++++++++++++----------------
2 files changed, 19 insertions(+), 24 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink
2022-02-01 17:25 [PATCH cygport 0/2] Avoid misbehaviour with llvm-objdump Jon Turney
@ 2022-02-01 17:25 ` Jon Turney
2022-02-01 19:22 ` Corinna Vinschen
2022-02-01 17:25 ` [PATCH cygport 2/2] Don't use llvm-objdump Jon Turney
1 sibling, 1 reply; 5+ messages in thread
From: Jon Turney @ 2022-02-01 17:25 UTC (permalink / raw)
To: cygwin-apps; +Cc: Jon Turney
Be more careful not to remove an existing .gnu_debuglink, even if we
think this package has no useful debug symbols.
(Some versions of 'llvm-objdump -l' fail to find line number info even
though it's there. Don't break a package which manages it's own debug
symbols (e.g. cygwin) when that happens.)
---
lib/src_postinst.cygpart | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index d8bb226..e29b2cb 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -1051,23 +1051,31 @@ __prepstrip() {
lines=$(${objdump} -d -l "${exe}" 2>/dev/null | sed -ne "s|.*\(/usr/src/debug/${PF}/.*\):[0-9]*$|\1|gp" | sort -u | tee -a ${T}/.dbgsrc.out | wc -l);
- if (( lines == 0 ))
+ # we expect --add-gnu-debuglink to fail if a
+ # .gnu_debuglink section already exists (e.g. binutils,
+ # which uses hardlinks, or cygwin which creates a custom
+ # .dbg file), but leave it alone to make sure we don't
+ # mess it up.
+ if ${objdump} -h "${exe}" | grep -q '\.gnu_deb'
then
- ${objcopy} --strip-all "${exe}";
continue;
fi
- # --add-gnu-debuglink will fail if .gnu_debuglink section
- # already exists, e.g. binutils, which uses hardlinks,
- # or cygwin which creates a custom .dbg file
- if ! ${objdump} -h "${exe}" | grep -q '\.gnu_deb'
+ # only create split debuginfo if it's going to contain
+ # some symbols for which this package has the
+ # corresponding source files
+ if (( lines == 0 ))
then
- dodir "${dbg%/*}";
- ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}";
- chmod 0644 "${D}${dbg}";
${objcopy} --strip-all "${exe}";
- ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null;
+ continue;
fi
+
+ dodir "${dbg%/*}";
+ ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}";
+ chmod 0644 "${D}${dbg}";
+ ${objcopy} --strip-all "${exe}";
+ ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null;
+
fi
done
}
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH cygport 2/2] Don't use llvm-objdump
2022-02-01 17:25 [PATCH cygport 0/2] Avoid misbehaviour with llvm-objdump Jon Turney
2022-02-01 17:25 ` [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink Jon Turney
@ 2022-02-01 17:25 ` Jon Turney
1 sibling, 0 replies; 5+ messages in thread
From: Jon Turney @ 2022-02-01 17:25 UTC (permalink / raw)
To: cygwin-apps; +Cc: Jon Turney
This partially reverts commit e06359bca705624b9712fd16f4ec9945935fd608
This partially reverts commit 6f788165848084d2fb1597689b31faba7d4c483e
The polynomially bad runtime of 'objdump' (which made 'llvm-objdump' the
only practically usable tool on larger binaries) has been fixed since
[1]. Meanwhile, 'llvm-objdump' now appears to have bugs which interfere
with the correct operation of cygport.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=18025#c16
---
lib/pkg_info.cygpart | 8 --------
lib/src_postinst.cygpart | 7 +------
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/lib/pkg_info.cygpart b/lib/pkg_info.cygpart
index 4b18993..08ddd69 100644
--- a/lib/pkg_info.cygpart
+++ b/lib/pkg_info.cygpart
@@ -95,14 +95,6 @@ __list_deps() {
dlltool="${CTARGET}-dlltool"
fi
- case ${CHOST} in
- i?86-*|x86_64-*)
- if check_prog llvm-objdump
- then
- objdump="llvm-objdump"
- fi ;;
- esac
-
pushd ${D}
#****v* Information/DEPS_PATH
diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index e29b2cb..4b51325 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -951,12 +951,7 @@ __prepstrip() {
continue
fi
- if check_prog llvm-objdump && llvm-size "${exe}" &>/dev/null
- then
- objdump="llvm-objdump"
- else
- objdump=${objcopy/copy/dump}
- fi
+ objdump=${objcopy/copy/dump}
# Static libraries should not be fully stripped, but we can
# still provide split debuginfo if desired
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink
2022-02-01 17:25 ` [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink Jon Turney
@ 2022-02-01 19:22 ` Corinna Vinschen
[not found] ` <eef4ada5-0ace-d828-c163-988390aa35e0@dronecode.org.uk>
0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2022-02-01 19:22 UTC (permalink / raw)
To: cygwin-apps
Hi Jon,
On Feb 1 17:25, Jon Turney wrote:
> Be more careful not to remove an existing .gnu_debuglink, even if we
> think this package has no useful debug symbols.
>
> (Some versions of 'llvm-objdump -l' fail to find line number info even
> though it's there. Don't break a package which manages it's own debug
> symbols (e.g. cygwin) when that happens.)
> ---
> lib/src_postinst.cygpart | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
> index d8bb226..e29b2cb 100644
> --- a/lib/src_postinst.cygpart
> +++ b/lib/src_postinst.cygpart
> @@ -1051,23 +1051,31 @@ __prepstrip() {
>
> lines=$(${objdump} -d -l "${exe}" 2>/dev/null | sed -ne "s|.*\(/usr/src/debug/${PF}/.*\):[0-9]*$|\1|gp" | sort -u | tee -a ${T}/.dbgsrc.out | wc -l);
Shouldn't lines be computed *after* the new check for .gnu_deb? After
all, it's still pretty time-consuming and if the .gnu_deb check kicks in
it's never tested...
>
> - if (( lines == 0 ))
> + # we expect --add-gnu-debuglink to fail if a
> + # .gnu_debuglink section already exists (e.g. binutils,
> + # which uses hardlinks, or cygwin which creates a custom
> + # .dbg file), but leave it alone to make sure we don't
> + # mess it up.
> + if ${objdump} -h "${exe}" | grep -q '\.gnu_deb'
> then
> - ${objcopy} --strip-all "${exe}";
> continue;
> fi
>
> - # --add-gnu-debuglink will fail if .gnu_debuglink section
> - # already exists, e.g. binutils, which uses hardlinks,
> - # or cygwin which creates a custom .dbg file
> - if ! ${objdump} -h "${exe}" | grep -q '\.gnu_deb'
> + # only create split debuginfo if it's going to contain
> + # some symbols for which this package has the
> + # corresponding source files
> + if (( lines == 0 ))
> then
> - dodir "${dbg%/*}";
> - ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}";
> - chmod 0644 "${D}${dbg}";
> ${objcopy} --strip-all "${exe}";
> - ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null;
> + continue;
> fi
> +
> + dodir "${dbg%/*}";
> + ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}";
> + chmod 0644 "${D}${dbg}";
> + ${objcopy} --strip-all "${exe}";
> + ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null;
> +
> fi
> done
> }
> --
> 2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink
[not found] ` <eef4ada5-0ace-d828-c163-988390aa35e0@dronecode.org.uk>
@ 2022-02-02 9:31 ` Corinna Vinschen
0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2022-02-02 9:31 UTC (permalink / raw)
To: cygwin-apps
On Feb 1 20:33, Jon Turney wrote:
> On 01/02/2022 19:22, Corinna Vinschen wrote:
> > Hi Jon,
> >
> > On Feb 1 17:25, Jon Turney wrote:
> > > Be more careful not to remove an existing .gnu_debuglink, even if we
> > > think this package has no useful debug symbols.
> > >
> > > (Some versions of 'llvm-objdump -l' fail to find line number info even
> > > though it's there. Don't break a package which manages it's own debug
> > > symbols (e.g. cygwin) when that happens.)
> > > ---
> > > lib/src_postinst.cygpart | 28 ++++++++++++++++++----------
> > > 1 file changed, 18 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
> > > index d8bb226..e29b2cb 100644
> > > --- a/lib/src_postinst.cygpart
> > > +++ b/lib/src_postinst.cygpart
> > > @@ -1051,23 +1051,31 @@ __prepstrip() {
> > > lines=$(${objdump} -d -l "${exe}" 2>/dev/null | sed -ne "s|.*\(/usr/src/debug/${PF}/.*\):[0-9]*$|\1|gp" | sort -u | tee -a ${T}/.dbgsrc.out | wc -l);
> >
> > Shouldn't lines be computed *after* the new check for .gnu_deb? After
> > all, it's still pretty time-consuming and if the .gnu_deb check kicks in
> > it's never tested...
>
> The objdump invocation has the side effect of creating ${T}/.dbgsrc.out,
> which is later used to determine what source files to put into the debuginfo
> package.
Ah, that explains it☝️
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-02 9:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 17:25 [PATCH cygport 0/2] Avoid misbehaviour with llvm-objdump Jon Turney
2022-02-01 17:25 ` [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink Jon Turney
2022-02-01 19:22 ` Corinna Vinschen
[not found] ` <eef4ada5-0ace-d828-c163-988390aa35e0@dronecode.org.uk>
2022-02-02 9:31 ` Corinna Vinschen
2022-02-01 17:25 ` [PATCH cygport 2/2] Don't use llvm-objdump Jon Turney
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).