From 3b83ea38cfbc408da9c4a85a8db9a836fa098e93 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 24 Feb 2017 23:58:50 +1030 Subject: [PATCH] Fixes for new dw5 test On some targets, .string does not add a NUL string terminator. * testsuite/binutils-all/dw5.S: Replace .string with .asciz. Support hpux .comm variant. * testsuite/binutils-all/readelf.exp: Define HPUX when assembling dw5 test for hppa64-hpux. --- binutils/ChangeLog | 7 +++ binutils/testsuite/binutils-all/dw5.S | 65 +++++++++++---------- binutils/testsuite/binutils-all/readelf.exp | 6 +- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 200490283ba..a615361f1b3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2017-02-25 Alan Modra + + * testsuite/binutils-all/dw5.S: Replace .string with .asciz. + Support hpux .comm variant. + * testsuite/binutils-all/readelf.exp: Define HPUX when assembling + dw5 test for hppa64-hpux. + 2017-02-24 Nick Clifton * readelf.c (show_name, do_dynamic, do_syms, do_dyn_syms, diff --git a/binutils/testsuite/binutils-all/dw5.S b/binutils/testsuite/binutils-all/dw5.S index 83bb6396412..2f754618f16 100644 --- a/binutils/testsuite/binutils-all/dw5.S +++ b/binutils/testsuite/binutils-all/dw5.S @@ -55,8 +55,13 @@ main: .dc.b 0 .LFE1: .size main, .-main + .ifdef HPUX +pvar .comm 8 +yvar .comm 4 + .else .comm pvar,8,8 .comm yvar,4,4 + .endif .globl xvar .data .align 4 @@ -615,65 +620,65 @@ xvar: .LELT0: .section .debug_str,"MS",%progbits,1 .LASF4: - .string "unsigned int" + .asciz "unsigned int" .LASF15: - .string "optopt" + .asciz "optopt" .LASF22: - .string "main" + .asciz "main" .LASF6: - .string "signed char" + .asciz "signed char" .LASF16: - .string "xvar" + .asciz "xvar" .LASF5: - .string "long unsigned int" + .asciz "long unsigned int" .LASF14: - .string "opterr" + .asciz "opterr" .LASF21: - .string "GNU C11 7.0.1 20170218 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -O2" + .asciz "GNU C11 7.0.1 20170218 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -O2" .LASF2: - .string "unsigned char" + .asciz "unsigned char" .LASF10: - .string "char" + .asciz "char" .LASF13: - .string "optind" + .asciz "optind" .LASF8: - .string "long int" + .asciz "long int" .LASF19: - .string "argc" + .asciz "argc" .LASF3: - .string "short unsigned int" + .asciz "short unsigned int" .LASF17: - .string "yvar" + .asciz "yvar" .LASF18: - .string "pvar" + .asciz "pvar" .LASF11: - .string "__environ" + .asciz "__environ" .LASF23: - .string "func" + .asciz "func" .LASF12: - .string "optarg" + .asciz "optarg" .LASF7: - .string "short int" + .asciz "short int" .LASF24: - .string "alarm" + .asciz "alarm" .LASF9: - .string "sizetype" + .asciz "sizetype" .LASF20: - .string "argv" + .asciz "argv" .section .debug_line_str,"MS",%progbits,1 .LASF1: - .string "" + .asciz "" .LASF25: - .string "" + .asciz "" .LASF29: - .string "getopt.h" + .asciz "getopt.h" .LASF28: - .string "unistd.h" + .asciz "unistd.h" .LASF0: - .string "main.c" + .asciz "main.c" .LASF27: - .string "main.c" + .asciz "main.c" .LASF26: - .string "/usr/include" + .asciz "/usr/include" .ident "GCC: (GNU) 7.0.1 20170218 (experimental)" .section .note.GNU-stack,"",%progbits diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 10f2b7a1b62..d9e437d9677 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -399,8 +399,12 @@ if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then { # support .ULEB128 pseudo-ops with non-constant values. if ![istarget "riscv*-*-*"] then { + set hpux "" + if [istarget "hppa*64*-*-hpux*"] { + set hpux "--defsym HPUX=1" + } # Assemble the DWARF-5 test file. - if {![binutils_assemble $srcdir/$subdir/dw5.S tmpdir/dw5.o]} then { + if {![binutils_assemble_flags $srcdir/$subdir/dw5.S tmpdir/dw5.o $hpux]} then { perror "could not assemble dw5 test file" unresolved "readelf - failed to assemble dw5" return -- 2.30.2