* PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
@ 2012-05-24 14:01 H.J. Lu
2012-05-24 14:35 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2012-05-24 14:01 UTC (permalink / raw)
To: gcc-patches
Hi,
configure checks if contrib/compare-debug actually works for comparing a
debug and non-debug .o file before enabling bootstrap-debug. But some
compilers encode some command line options (among them -g) into a special
.comment section. This patch removes .comment section before comparing
debug and non-debug files. OK for trunk?
Thanks.
H.J.
----
2012-05-24 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/53472
* contrib/compare-debug: Also remove .comment section.
diff --git a/contrib/compare-debug b/contrib/compare-debug
index 010d17f..c3eb659 100755
--- a/contrib/compare-debug
+++ b/contrib/compare-debug
@@ -73,6 +73,12 @@ Darwin)
;;
esac
+# Also remove .comment section.
+if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null; then
+ objcopy --remove-section .comment "$1.$suf1"
+ objcopy --remove-section .comment "$2.$suf2"
+fi
+
if cmp "$1.$suf1" "$2.$suf2"; then
status=0
else
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 14:01 PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section H.J. Lu
@ 2012-05-24 14:35 ` Paolo Bonzini
2012-05-24 14:43 ` H.J. Lu
0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2012-05-24 14:35 UTC (permalink / raw)
To: H.J. Lu; +Cc: H.J. Lu, gcc-patches
Il 24/05/2012 16:01, H.J. Lu ha scritto:
> configure checks if contrib/compare-debug actually works for comparing a
> debug and non-debug .o file before enabling bootstrap-debug. But some
> compilers encode some command line options (among them -g) into a special
> .comment section. This patch removes .comment section before comparing
> debug and non-debug files. OK for trunk?
Ok.
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 14:35 ` Paolo Bonzini
@ 2012-05-24 14:43 ` H.J. Lu
2012-05-24 16:53 ` H.J. Lu
0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2012-05-24 14:43 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: gcc-patches, Richard Guenther
On Thu, May 24, 2012 at 7:35 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Il 24/05/2012 16:01, H.J. Lu ha scritto:
>> configure checks if contrib/compare-debug actually works for comparing a
>> debug and non-debug .o file before enabling bootstrap-debug. But some
>> compilers encode some command line options (among them -g) into a special
>> .comment section. This patch removes .comment section before comparing
>> debug and non-debug files. OK for trunk?
>
> Ok.
Hi Richard,
Before I check it in, can you verify it enables bootstrap-debug on SuSE?
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 14:43 ` H.J. Lu
@ 2012-05-24 16:53 ` H.J. Lu
2012-05-24 21:33 ` H.J. Lu
0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2012-05-24 16:53 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: gcc-patches, Richard Guenther
On Thu, May 24, 2012 at 7:43 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 24, 2012 at 7:35 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>> Il 24/05/2012 16:01, H.J. Lu ha scritto:
>>> configure checks if contrib/compare-debug actually works for comparing a
>>> debug and non-debug .o file before enabling bootstrap-debug. But some
>>> compilers encode some command line options (among them -g) into a special
>>> .comment section. This patch removes .comment section before comparing
>>> debug and non-debug files. OK for trunk?
>>
>> Ok.
>
> Hi Richard,
>
> Before I check it in, can you verify it enables bootstrap-debug on SuSE?
>
It doesn't work since the comment section name may be
.comment.SUSE.OPTs
--
H.J.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 16:53 ` H.J. Lu
@ 2012-05-24 21:33 ` H.J. Lu
2012-05-24 21:44 ` Jakub Jelinek
0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2012-05-24 21:33 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: gcc-patches, Richard Guenther
On Thu, May 24, 2012 at 9:53 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 24, 2012 at 7:43 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, May 24, 2012 at 7:35 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>>> Il 24/05/2012 16:01, H.J. Lu ha scritto:
>>>> configure checks if contrib/compare-debug actually works for comparing a
>>>> debug and non-debug .o file before enabling bootstrap-debug. But some
>>>> compilers encode some command line options (among them -g) into a special
>>>> .comment section. This patch removes .comment section before comparing
>>>> debug and non-debug files. OK for trunk?
>>>
>>> Ok.
>>
>> Hi Richard,
>>
>> Before I check it in, can you verify it enables bootstrap-debug on SuSE?
>>
>
> It doesn't work since the comment section name may be
> .comment.SUSE.OPTs
>
This patch works on openSUSE 12.1. OK to install?
Thanks.
--
H.J.
--
2012-05-24 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/53472
* contrib/compare-debug (remove_comment): New function.
Also remove any .comment sections.
diff --git a/contrib/compare-debug b/contrib/compare-debug
index 010d17f..2468899 100755
--- a/contrib/compare-debug
+++ b/contrib/compare-debug
@@ -73,6 +73,27 @@ Darwin)
;;
esac
+remove_comment ()
+{
+ file=$1
+ opts=
+ for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
+ case "$s" in
+ .comment*)
+ opts="$opts --remove-section $s"
+ ;;
+ esac
+ done
+ [ -n "$opts" ] && objcopy $opts $file
+}
+
+# Also remove any .comment sections.
+if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
+ && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' > /dev/null; then
+ remove_comment "$1.$suf1"
+ remove_comment "$2.$suf2"
+fi
+
if cmp "$1.$suf1" "$2.$suf2"; then
status=0
else
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 21:33 ` H.J. Lu
@ 2012-05-24 21:44 ` Jakub Jelinek
2012-05-24 22:03 ` H.J. Lu
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2012-05-24 21:44 UTC (permalink / raw)
To: H.J. Lu; +Cc: Paolo Bonzini, gcc-patches, Richard Guenther
On Thu, May 24, 2012 at 02:32:59PM -0700, H.J. Lu wrote:
> This patch works on openSUSE 12.1. OK to install?
Can't you do that only if the first cmp failed?
In that case strip and cmp again...
> 2012-05-24 H.J. Lu <hongjiu.lu@intel.com>
>
> PR bootstrap/53472
> * contrib/compare-debug (remove_comment): New function.
> Also remove any .comment sections.
>
> diff --git a/contrib/compare-debug b/contrib/compare-debug
> index 010d17f..2468899 100755
> --- a/contrib/compare-debug
> +++ b/contrib/compare-debug
> @@ -73,6 +73,27 @@ Darwin)
> ;;
> esac
>
> +remove_comment ()
> +{
> + file=$1
> + opts=
> + for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
> + case "$s" in
> + .comment*)
> + opts="$opts --remove-section $s"
> + ;;
> + esac
> + done
> + [ -n "$opts" ] && objcopy $opts $file
> +}
> +
> +# Also remove any .comment sections.
> +if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
> + && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' > /dev/null; then
> + remove_comment "$1.$suf1"
> + remove_comment "$2.$suf2"
> +fi
> +
> if cmp "$1.$suf1" "$2.$suf2"; then
> status=0
> else
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 21:44 ` Jakub Jelinek
@ 2012-05-24 22:03 ` H.J. Lu
2012-05-25 6:31 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2012-05-24 22:03 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Paolo Bonzini, gcc-patches, Richard Guenther
On Thu, May 24, 2012 at 2:43 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, May 24, 2012 at 02:32:59PM -0700, H.J. Lu wrote:
>> This patch works on openSUSE 12.1. OK to install?
>
> Can't you do that only if the first cmp failed?
> In that case strip and cmp again...
>
Like this? OK to install?
Thanks.
--
H.J.
---
2012-05-24 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/53472
* contrib/compare-debug (remove_comment): New function.
Remove any .comment sections if the first cmp failed.
diff --git a/contrib/compare-debug b/contrib/compare-debug
index 010d17f..fb8986d 100755
--- a/contrib/compare-debug
+++ b/contrib/compare-debug
@@ -73,11 +73,35 @@ Darwin)
;;
esac
+remove_comment ()
+{
+ file=$1
+ opts=
+ for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
+ case "$s" in
+ .comment*)
+ opts="$opts --remove-section $s"
+ ;;
+ esac
+ done
+ [ -n "$opts" ] && objcopy $opts $file
+}
+
if cmp "$1.$suf1" "$2.$suf2"; then
status=0
else
status=1
+ # Remove any .comment sections.
+ if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
+ && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' >
/dev/null; then
+ remove_comment "$1.$suf1"
+ remove_comment "$2.$suf2"
+ if cmp "$1.$suf1" "$2.$suf2"; then
+ status=0
+ fi
+ fi
+
# Assembler-generated CFI will add an .eh_frame section for -g not
# present in -g0. Try to cope with it by checking that an .eh_frame
# section is present in either object file, and then stripping it
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section
2012-05-24 22:03 ` H.J. Lu
@ 2012-05-25 6:31 ` Paolo Bonzini
0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2012-05-25 6:31 UTC (permalink / raw)
To: H.J. Lu; +Cc: Jakub Jelinek, gcc-patches, Richard Guenther
> 2012-05-24 H.J. Lu <hongjiu.lu@intel.com>
>
> PR bootstrap/53472
> * contrib/compare-debug (remove_comment): New function.
> Remove any .comment sections if the first cmp failed.
Ok.
Paolo
> diff --git a/contrib/compare-debug b/contrib/compare-debug
> index 010d17f..fb8986d 100755
> --- a/contrib/compare-debug
> +++ b/contrib/compare-debug
> @@ -73,11 +73,35 @@ Darwin)
> ;;
> esac
>
> +remove_comment ()
> +{
> + file=$1
> + opts=
> + for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
> + case "$s" in
> + .comment*)
> + opts="$opts --remove-section $s"
> + ;;
> + esac
> + done
> + [ -n "$opts" ] && objcopy $opts $file
> +}
> +
> if cmp "$1.$suf1" "$2.$suf2"; then
> status=0
> else
> status=1
>
> + # Remove any .comment sections.
> + if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
> + && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' >
> /dev/null; then
> + remove_comment "$1.$suf1"
> + remove_comment "$2.$suf2"
> + if cmp "$1.$suf1" "$2.$suf2"; then
> + status=0
> + fi
> + fi
> +
> # Assembler-generated CFI will add an .eh_frame section for -g not
> # present in -g0. Try to cope with it by checking that an .eh_frame
> # section is present in either object file, and then stripping it
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-05-25 6:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-24 14:01 PATCH: PR bootstrap/53472: contrib/compare-debug should strip out .comment section H.J. Lu
2012-05-24 14:35 ` Paolo Bonzini
2012-05-24 14:43 ` H.J. Lu
2012-05-24 16:53 ` H.J. Lu
2012-05-24 21:33 ` H.J. Lu
2012-05-24 21:44 ` Jakub Jelinek
2012-05-24 22:03 ` H.J. Lu
2012-05-25 6:31 ` Paolo Bonzini
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).