Add bionutils support for DWARF v5's DW_OP_addrx.

This commit is contained in:
Natarajan, Kavitha
2022-05-25 16:10:38 +01:00
committed by Nick Clifton
parent cce0ae568c
commit 3ac9da4937
3 changed files with 76 additions and 6 deletions

View File

@ -513,6 +513,47 @@ if { ![is_elf_format] } then {
}
}
# Test objdump -Wi on a file containing dwarf-5 encodings information.
if { ![is_elf_format] } then {
unsupported "objdump DW_OP_* test"
} elseif { ![binutils_assemble $srcdir/$subdir/dw5-op.S tmpdir/dw5-op.${obj}] } then {
fail "objdump DW_OP_* test"
} else {
if [is_remote host] {
set op_testfile [remote_download host tmpdir/dw5-op.${obj}]
} else {
set op_testfile tmpdir/dw5-op.${obj}
}
set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wi $op_testfile" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "objdump -Wi (reason: unexpected output)"
send_log $got
send_log "\n"
}
set got [remote_exec host "tail -n +4 objdump.out" "" "/dev/null" "objdump.out"]
set output [remote_upload host objdump.out]
if ![file size $output] then {
# If the output file is empty, then this target does not
# generate dwarf2 output. This is not a failure.
verbose "No output from 'objdump -Wi'"
untested "objdump -Wi"
return
}
if { [regexp_diff objdump.out $srcdir/$subdir/dw5-op.W] } then {
fail "objdump -Wi for DW_OP_*"
} else {
pass "objdump -Wi for DW_OP_*"
}
file_on_host delete $output
}
proc test_build_id_debuglink {} {
global srcdir
global subdir
@ -817,7 +858,7 @@ proc test_objdump_S { } {
global OBJDUMP
global OBJDUMPFLAGS
global exe
set test "objdump -S"
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog${exe} executable debug] != "" } {

View File

@ -488,11 +488,12 @@ if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
readelf_test {--decompress --hex-dump .debug_loc} $tempfile readelf.z
}
set hpux ""
# Skip the next test for the RISCV architectures because they
# do not support .ULEB128 pseudo-ops with non-constant values.
if ![istarget "riscv*-*-*"] then {
set hpux ""
if [istarget "hppa*64*-*-hpux*"] {
set hpux "--defsym HPUX=1"
}
@ -596,3 +597,22 @@ if ![is_remote host] {
readelf_test {--debug-dump=macro -wN} $tempfile pr26112.r
}
}
# Check dwarf-5 support for DW_OP_addrx.
if {![binutils_assemble_flags $srcdir/$subdir/dw5-op.S tmpdir/dw5-op.o $hpux]} then {
unsupported "readelf -wi dw5-op (failed to assemble)"
} else {
# Download it.
if ![is_remote host] {
set tempfile tmpdir/dw5-op.o
} else {
set tempfile [remote_download host tmpdir/dw5-op.o]
}
# First, determine the size, so specific output matchers can be used.
readelf_find_size $tempfile 2
# Make sure that readelf can decode the contents.
readelf_test -wi $tempfile dw5-op.W
}