nds32_elf_get_relocated_section_contents

nds32_elf_get_relocated_section_contents uses nds32_get_section_contents
to read sections contents, but nds32_get_section_contents has the wrong
behaviour as it calls bfd_malloc_and_get_section.  That function always
mallocs its output buffer, whereas get_relocated_section_contents must
support an already allocated buffer.

bfd/
	* elf32-nds32.c (nds32_get_section_contents): Replace
	bfd_malloc_and_get_section with bfd_get_full_section_contents.
	(nds32_elf_relax_delete_blanks): Init contents.
	(nds32_elf_relax_section, nds32_relax_fp_as_gp): Likewise.
binutils/
	* testsuite/binutils-all/compress.exp: Remove nds32 xfails.
	* testsuite/binutils-all/objdump.exp: Likewise.
This commit is contained in:
Alan Modra
2021-02-15 09:48:50 +10:30
parent 8b78cbec31
commit 1781a9d0f3
5 changed files with 17 additions and 6 deletions

View File

@@ -162,7 +162,6 @@ if ![string match "" $got] then {
}
}
setup_xfail "nds32*-*-*"
set testname "objdump compress debug sections"
set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
@@ -175,7 +174,6 @@ if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
pass "$testname"
}
setup_xfail "nds32*-*-*"
set testname "objdump compress debug sections 3"
set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
@@ -546,7 +544,6 @@ if ![string match "" $got] then {
}
}
setup_xfail "nds32*-*-*"
set testname "objcopy compress debug sections in archive with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"]
if ![string match "" $got] then {
@@ -567,7 +564,6 @@ if ![string match "" $got] then {
}
}
setup_xfail "nds32*-*-*"
set testname "objdump compress debug sections 3 with zlib-gabi"
set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {

View File

@@ -503,7 +503,7 @@ if { ![is_elf_format] } then {
send_log "\n"
}
setup_xfail "msp430-*-*" "nds32*-*-*"
setup_xfail "msp430-*-*"
if { [regexp_diff objdump.out $srcdir/$subdir/dw2-ranges.W] } then {
fail "objdump -W for debug_ranges"
} else {