* C6X: Keep OS/ABI when running strip
@ 2011-06-27 14:42 Bernd Schmidt
2011-06-27 15:54 ` Joseph S. Myers
0 siblings, 1 reply; 5+ messages in thread
From: Bernd Schmidt @ 2011-06-27 14:42 UTC (permalink / raw)
To: binutils, Joseph S. Myers
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
This is a fixlet for a problem introduced with the patch that made us
set OS/ABI to C6X-specific values. strip and objcopy changed the value
back to the default. Ok?
Bernd
[-- Attachment #2: osabi2.diff --]
[-- Type: text/plain, Size: 873 bytes --]
* bfd/elf32-tic6x.c (elf32_tic6x_set_osabi): Also set it if
link_info is NULL.
Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.26
diff -c -p -r1.26 elf32-tic6x.c
*** bfd/elf32-tic6x.c 14 Jun 2011 02:45:12 -0000 1.26
--- bfd/elf32-tic6x.c 27 Jun 2011 14:36:07 -0000
*************** elf32_tic6x_write_section (bfd *output_b
*** 4473,4479 ****
static void
elf32_tic6x_set_osabi (bfd *abfd, struct bfd_link_info *link_info)
{
! if (link_info == NULL || link_info->relocatable)
return;
_bfd_elf_set_osabi (abfd, link_info);
}
--- 4473,4479 ----
static void
elf32_tic6x_set_osabi (bfd *abfd, struct bfd_link_info *link_info)
{
! if (link_info != NULL && link_info->relocatable)
return;
_bfd_elf_set_osabi (abfd, link_info);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: C6X: Keep OS/ABI when running strip
2011-06-27 14:42 C6X: Keep OS/ABI when running strip Bernd Schmidt
@ 2011-06-27 15:54 ` Joseph S. Myers
2011-06-27 16:50 ` Bernd Schmidt
0 siblings, 1 reply; 5+ messages in thread
From: Joseph S. Myers @ 2011-06-27 15:54 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: binutils
On Mon, 27 Jun 2011, Bernd Schmidt wrote:
> This is a fixlet for a problem introduced with the patch that made us
> set OS/ABI to C6X-specific values. strip and objcopy changed the value
> back to the default. Ok?
What happens if you strip a .o file (--strip-debug, say, is a useful case
of stripping .o files) with this patch?
That shouldn't add an OSABI. It would be good to have testcases that
verify that strip preserves the OSABI for executables and shared libraries
and leaves it unset of .o files - maybe make the existing OSABI tests
strip the objects after first testing their OSABI and report the results
of testing OSABI after strip as well (with a different test name after
PASS or FAIL, of course).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: C6X: Keep OS/ABI when running strip
2011-06-27 15:54 ` Joseph S. Myers
@ 2011-06-27 16:50 ` Bernd Schmidt
2011-06-27 17:01 ` Joseph S. Myers
2011-06-30 9:43 ` Nick Clifton
0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schmidt @ 2011-06-27 16:50 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
On 06/27/11 17:53, Joseph S. Myers wrote:
> On Mon, 27 Jun 2011, Bernd Schmidt wrote:
>
>> This is a fixlet for a problem introduced with the patch that made us
>> set OS/ABI to C6X-specific values. strip and objcopy changed the value
>> back to the default. Ok?
>
> What happens if you strip a .o file (--strip-debug, say, is a useful case
> of stripping .o files) with this patch? That shouldn't add an OSABI.
It doesn't. As far as I can tell the input OS/ABI field is used to
select a BFD target vector, so we then preserve it since we use the same
one for the output.
> It would be good to have testcases that
> verify that strip preserves the OSABI for executables and shared libraries
> and leaves it unset of .o files - maybe make the existing OSABI tests
> strip the objects after first testing their OSABI and report the results
> of testing OSABI after strip as well (with a different test name after
> PASS or FAIL, of course).
There are some objcopy tests of that sort already in binutils/testsuite;
one of them (the plain objcopy one) would have caught the problem if it
was run for tic6x-uclinux. (Remember our discussion of -uclinux vs
-linux-uclibc? This is one more instance where "-uclinux" is interpreted
to mean "uses crummy flat binaries".)
The patch below enables the extra tests on tic6x-uclinux, and adds some
code to test OS/ABI fields before/after strip.
Bernd
[-- Attachment #2: bu-osabi.diff --]
[-- Type: text/plain, Size: 4964 bytes --]
* binutils-all/objcopy.exp (strip_test, strip_executable):
On ELF targets, test that OS/ABI is preserved.
(copy_setup): Do test on tic6x-*-uclinux.
Index: binutils/testsuite/binutils-all/objcopy.exp
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/objcopy.exp,v
retrieving revision 1.73
diff -c -p -r1.73 objcopy.exp
*** binutils/testsuite/binutils-all/objcopy.exp 13 May 2011 04:14:51 -0000 1.73
--- binutils/testsuite/binutils-all/objcopy.exp 27 Jun 2011 16:44:42 -0000
*************** proc strip_test { } {
*** 406,411 ****
--- 406,412 ----
global NMFLAGS
global srcdir
global subdir
+ global READELF
set test "strip"
*************** proc strip_test { } {
*** 414,419 ****
--- 415,433 ----
return
}
+ set osabi_fail "false"
+ if [is_elf_format] {
+ verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.in"
+ set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.in"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "$test preserving OS/ABI"
+ set osabi_fail "true"
+ } else {
+ verbose -log "grep OS/ABI tmpdir/osabi.in"
+ catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
+ }
+ }
+
if [is_remote host] {
set archive libstrip.a
set objfile [remote_download host tmpdir/testprog.o]
*************** proc strip_test { } {
*** 428,448 ****
--- 442,481 ----
set exec_output [binutils_run $AR "rc $archive ${objfile}"]
if ![string match "" $exec_output] {
fail $test
+ unresolved "$test preserving OS/ABI"
return
}
set exec_output [binutils_run $STRIP "-g $archive"]
if ![string match "" $exec_output] {
fail $test
+ unresolved "$test preserving OS/ABI"
return
}
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
if ![string match "" $exec_output] {
fail $test
+ unresolved "$test preserving OS/ABI"
return
}
+ if { $osabi_fail != "true" && [is_elf_format] } {
+ verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.out"
+ set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.out"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "$test preserving OS/ABI"
+ } else {
+ verbose -log "grep OS/ABI tmpdir/osabi.out"
+ catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
+ if { "$osabi_in" == "$osabi_out" } {
+ pass "$test preserving OS/ABI"
+ } else {
+ fail "$test preserving OS/ABI"
+ }
+ }
+ }
+
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
untested $test
return
*************** proc copy_setup { } {
*** 531,537 ****
set res [build_wrapper testglue.o]
set flags { debug }
! if { [istarget *-*-uclinux*] } {
return 1
}
--- 564,570 ----
set res [build_wrapper testglue.o]
set flags { debug }
! if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] } {
return 1
}
*************** proc copy_executable { prog flags test1
*** 649,654 ****
--- 682,688 ----
proc strip_executable { prog flags test } {
global NM
global NMFLAGS
+ global READELF
global host_triplet
remote_file build delete tmpdir/striprog
*************** proc strip_executable { prog flags test
*** 659,664 ****
--- 693,711 ----
set copyfile tmpdir/striprog
}
+ set osabi_fail "false"
+ if [is_elf_format] {
+ verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in"
+ set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "$test preserving OS/ABI"
+ set osabi_fail "true"
+ } else {
+ verbose -log "grep OS/ABI tmpdir/osabi.in"
+ catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
+ }
+ }
+
set exec_output [binutils_run $prog "$flags ${copyfile}"]
if ![string match "" $exec_output] {
fail $test
*************** proc strip_executable { prog flags test
*** 679,684 ****
--- 726,747 ----
return
}
+ if { $osabi_fail != "true" && [is_elf_format] } {
+ verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out"
+ set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "$test preserving OS/ABI"
+ } else {
+ verbose -log "grep OS/ABI tmpdir/osabi.out"
+ catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
+ if { "$osabi_in" == "$osabi_out" } {
+ pass "$test preserving OS/ABI"
+ } else {
+ fail "$test preserving OS/ABI"
+ }
+ }
+ }
+
set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
if ![string match "*: no symbols*" $exec_output] {
fail $test
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: C6X: Keep OS/ABI when running strip
2011-06-27 16:50 ` Bernd Schmidt
@ 2011-06-27 17:01 ` Joseph S. Myers
2011-06-30 9:43 ` Nick Clifton
1 sibling, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2011-06-27 17:01 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: binutils
On Mon, 27 Jun 2011, Bernd Schmidt wrote:
> The patch below enables the extra tests on tic6x-uclinux, and adds some
> code to test OS/ABI fields before/after strip.
Thanks. The original patch is OK given these tests (which someone else
will need to approve).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: C6X: Keep OS/ABI when running strip
2011-06-27 16:50 ` Bernd Schmidt
2011-06-27 17:01 ` Joseph S. Myers
@ 2011-06-30 9:43 ` Nick Clifton
1 sibling, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2011-06-30 9:43 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: Joseph S. Myers, binutils
Hi Bernd,
> * binutils-all/objcopy.exp (strip_test, strip_executable):
> On ELF targets, test that OS/ABI is preserved.
> (copy_setup): Do test on tic6x-*-uclinux.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-30 9:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-27 14:42 C6X: Keep OS/ABI when running strip Bernd Schmidt
2011-06-27 15:54 ` Joseph S. Myers
2011-06-27 16:50 ` Bernd Schmidt
2011-06-27 17:01 ` Joseph S. Myers
2011-06-30 9:43 ` Nick Clifton
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).