[PATCH] Fix unresolved test in binutils for pdp11.

H.J. Lu hjl.tools@gmail.com
Sat Jun 6 01:25:00 GMT 2020


On Fri, Jun 5, 2020 at 5:52 PM Stephen Casner <casner@acm.org> wrote:
>
> Commit 8eca5c7d9f2855a4af7dc3d213abb5760cca31cb done yesterday.
>
> After this commit the binutils testsuite runs clean for the pdp11-aout
> target.
>
>                                                         -- Steve
>
> * binutils/testsuite/binutils-all/pr25662-pdp11.s: Alternate source file
> for test using section pseudo-ops compatible with pdp11.
> * binutils/testsuite/binutils-all/objcopy.exp: Select alternate source.
> ---
>  binutils/ChangeLog                            |  6 ++++
>  binutils/testsuite/binutils-all/objcopy.exp   |  8 ++++-
>  .../testsuite/binutils-all/pr25662-pdp11.s    | 36 +++++++++++++++++++
>  3 files changed, 49 insertions(+), 1 deletion(-)
>  create mode 100644 binutils/testsuite/binutils-all/pr25662-pdp11.s
>
> diff --git a/binutils/ChangeLog b/binutils/ChangeLog
> index 10806a9353..9bbebf5619 100644
> --- a/binutils/ChangeLog
> +++ b/binutils/ChangeLog
> @@ -1,3 +1,9 @@
> +2020-06-04  Stephen Casner  <casner@acm.org>
> +
> +       * testsuite/binutils-all/pr25662-pdp11.s: Alternate source file
> +       for test using section pseudo-ops compatible with pdp11.
> +       * testsuite/binutils-all/objcopy.exp: Select alternate source.
> +
>  2020-06-04  Jose E. Marchesi  <jose.marchesi@oracle.com>
>
>         * objdump.c (disassemble_data): Set disasm_info.endian_code to
> diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
> index 56a7db8199..dd74860f9e 100644
> --- a/binutils/testsuite/binutils-all/objcopy.exp
> +++ b/binutils/testsuite/binutils-all/objcopy.exp
> @@ -1348,4 +1348,10 @@ setup_xfail "sh-*-coff*"
>  setup_xfail "spu-*-*"
>  clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
>  clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "hppa*-*-*elf*"
> -objcopy_test "pr25662" pr25662.s executable "" "-T$srcdir/$subdir/pr25662.ld"
> +if { [istarget pdp11-*-*] } {
> +    set src "pr25662-pdp11.s"
> +} else {
> +    set src "pr25662.s"
> +}
> +
> +objcopy_test "pr25662" $src executable "" "-T$srcdir/$subdir/pr25662.ld"
> diff --git a/binutils/testsuite/binutils-all/pr25662-pdp11.s b/binutils/testsuite/binutils-all/pr25662-pdp11.s
> new file mode 100644
> index 0000000000..0b2481ea40
> --- /dev/null
> +++ b/binutils/testsuite/binutils-all/pr25662-pdp11.s
> @@ -0,0 +1,36 @@
> +/* PR 25662: objcopy sets invalid sh_offset for the first section in a
> +   no_contents segment containing program headers.
> +
> +   Several conditions are required for the bug to manifest:
> +   - The first loadable segment (which contains the program headers) must only
> +     contain SHT_NOBITS sections. .bss is the SHT_NOBITS section in this test.
> +   - The next loadable segment must have a !SHT_NOBITS loadable section. .data
> +     is the !SHT_NOBITS section in this test.
> +   - .bss must be positioned after .data in the executable file itself.
> +   - The size of .data must be such that the calculated VMA of the .bss
> +     section that follows it is not congruent with the file offset of .bss,
> +     modulo the p_align of its segment, i.e.:
> +       (VMA(.data) + sizeof(.data)) % (.bss_segment.p_align) != 0
> +     This will force the sh_offset of .bss to be aligned so it appears within
> +     .data.
> +   - The size of .data must be larger than the program headers in the first
> +     loadable segment, so that the file offset of .bss is immediately
> +     after .data, and not padded to a valid alignment by the program headers.
> +
> +   The bug originally only manifested for ELF targets, but there's no reason not
> +   to run this testcase for other file formats.  This variant source for pdp11
> +   uses .text rather than .section text, etc., because the latter are not
> +   supported,  */
> +

Can't you just replace ".section .text" with .text?


-- 
H.J.


More information about the Binutils mailing list