From: Nick Clifton Date: Fri, 3 Nov 2000 01:59:12 +0000 (+0000) Subject: Fix readelf -S and readelf -s tests for MIPS and v850 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ade0b24fe1ed4c384adb12fff3b1bcf2d7a29454;p=binutils-gdb.git Fix readelf -S and readelf -s tests for MIPS and v850 --- diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 9ddc7686838..5067dc19fd5 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2000-11-02 Chris Demetriou + + * binutils-all/readelf.exp (regexp_diff): Add code + from gas testsuite to treat "#..." at beginning of line + as an indicator to skip extra non-matching lines at that + location. + (readelf_test): Add support for using a machine-specific + regexp comparison file. + (readelf -S test, readelf -s test): Remove v850*-*-* and + mips*-*-* from list of expected failures. + * binutils-all/readelf.s: Accomodate changes due to + additional sections (and therefore section numbering + differences) on v850*-*-* and mips*-*-* targets. + * binutils-all/readelf.ss: Likewise. + * binutils-all/readelf.ss-mips: New file, which matches + expected output of readelf -s test for mips*-*-*. + 2000-10-25 Hans-Peter Nilsson * binutils-all/readelf.exp (-wi test): Add cris-*-* to xfails. diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 246139180cf..f93e2f5803c 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -76,6 +76,20 @@ proc regexp_diff { file_1 file_2 } { set end_2 1 set diff_pass 1 break + } elseif [ string match "#..." $line_b ] { + if { [gets $file_b line_b] == $eof } { + set end_2 1 + break + } + verbose "looking for \"^$line_b$\"" 3 + while { ![regexp "^$line_b$" "$line_a"] } { + verbose "skipping \"$line_a\"" 3 + if { [gets $file_a line_a] == $eof } { + set end_1 1 + break + } + } + break } if { [gets $file_b line_b] == $eof } { set end_2 1 @@ -176,7 +190,16 @@ proc readelf_test { options binary_file regexp_file xfails } { return } - if { [file exists $srcdir/$subdir/$regexp_file-$readelf_size] } then { + set target_machine "" + if [istarget "mips*-*-*"] then { + set target_machine mips + } + + if { $target_machine != "" && [file exists $srcdir/$subdir/$regexp_file-$readelf_size-$target_machine] } then { + set regexp_file $regexp_file-$readelf_size-$target_machine + } elseif { $target_machine != "" && [file exists $srcdir/$subdir/$regexp_file-$target_machine] } then { + set regexp_file $regexp_file-$target_machine + } elseif { [file exists $srcdir/$subdir/$regexp_file-$readelf_size] } then { set regexp_file $regexp_file-$readelf_size } @@ -227,15 +250,8 @@ readelf_find_size $tempfile # Run the tests. readelf_test -h $tempfile readelf.h {} - -# The v850 fails the next two tests because it creates two special -# sections of its own: .call_table_data and .call_table_text -# The regexp scripts are not expecting these sections... -# MIPS targets fail because they add .rela.txt (empty), .mdebug, -# and .reginfo sections. - -readelf_test -S $tempfile readelf.s {v850*-*-* mips*-*-*} -readelf_test -s $tempfile readelf.ss {v850*-*-* mips*-*-*} +readelf_test -S $tempfile readelf.s {} +readelf_test -s $tempfile readelf.ss {} readelf_test -r $tempfile readelf.r {} diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s index 89ae0fca49a..f15e29b8aec 100644 --- a/binutils/testsuite/binutils-all/readelf.s +++ b/binutils/testsuite/binutils-all/readelf.s @@ -5,11 +5,16 @@ Section Headers: \[ 0\] NULL 00000000 000000 000000 00 0 0 0 \[ 1\] .text PROGBITS 00000000 000034 000008 00 AX 0 0 . \[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0. . 1 4 - \[ 3\] .data PROGBITS 00000000 00003c 000004 00 WA 0 0 . - \[ 4\] .bss NOBITS 00000000 000040 000000 00 WA 0 0 . - \[ .\] .shstrtab STRTAB 00000000 000040 0000.* 00 0 0 . - \[ .\] .symtab SYMTAB 00000000 0+.* 0+.* 10 7 6 4 - \[ .\] .strtab STRTAB 00000000 0+.* 0+.* 00 0 0 1 +# MIPS targets put .rela.text here. +#... + \[ .\] .data PROGBITS 00000000 00003c 000004 00 WA 0 0 . + \[ .\] .bss NOBITS 00000000 000040 000000 00 WA 0 0 . +# MIPS targets put .reginfo and .mdebug here. +# v850 targets put .call_table_data and .call_table_text here. +#... + \[ .\] .shstrtab STRTAB 00000000 0+.* 0+.* 00 0 0 . + \[ .\] .symtab SYMTAB 00000000 0+.* 0+.* 10 .. . 4 + \[..\] .strtab STRTAB 00000000 0+.* 0+.* 00 0 0 1 Key to Flags: W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\) I \(info\), L \(link order\), O \(extra OS processing required\) o \(os specific\), p \(processor specific\) x \(unknown\) diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss index 926612d4bec..4c8bf8c874d 100644 --- a/binutils/testsuite/binutils-all/readelf.ss +++ b/binutils/testsuite/binutils-all/readelf.ss @@ -7,7 +7,10 @@ Symbol table '.symtab' contains .* entries: 3: 00000000 0 SECTION LOCAL DEFAULT 4 4: 00000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol 5: 00000000 0 NOTYPE LOCAL DEFAULT 3 static_data_symbol +# v850 targets include extra SECTION symbols here for the .call_table_data +# and .call_table_text sections. +#... .* .: 00000000 0 NOTYPE GLOBAL DEFAULT 1 text_symbol .: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol - .: 00000000 0 NOTYPE GLOBAL DEFAULT 3 data_symbol - .: 00000004 4 OBJECT GLOBAL DEFAULT COM common_symbol + ..: 00000000 0 NOTYPE GLOBAL DEFAULT 3 data_symbol + ..: 00000004 4 OBJECT GLOBAL DEFAULT COM common_symbol diff --git a/binutils/testsuite/binutils-all/readelf.ss-mips b/binutils/testsuite/binutils-all/readelf.ss-mips new file mode 100644 index 00000000000..37dbcf66aa2 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss-mips @@ -0,0 +1,15 @@ + +Symbol table '.symtab' contains 12 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 00000000 0 NOTYPE LOCAL DEFAULT UND + 1: 00000000 0 SECTION LOCAL DEFAULT 1 + 2: 00000000 0 SECTION LOCAL DEFAULT 4 + 3: 00000000 0 SECTION LOCAL DEFAULT 5 + 4: 00000000 0 SECTION LOCAL DEFAULT 6 + 5: 00000000 0 SECTION LOCAL DEFAULT 7 + 6: 00000000 0 OBJECT GLOBAL DEFAULT 1 text_symbol + 7: 00000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol + 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol + 9: 00000000 0 OBJECT GLOBAL DEFAULT 4 data_symbol + 10: 00000000 0 NOTYPE LOCAL DEFAULT 4 static_data_symbol + 11: 00000004 4 OBJECT GLOBAL DEFAULT PRC common_symbol