diff options
author | Alan Modra <amodra@gmail.com> | 2024-07-05 22:41:49 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-07-06 10:41:29 +0930 |
commit | 428c21e99a3a8e6b2c7fd204664764d7724f6272 (patch) | |
tree | 1e6b769e32a6d96128dcb0b55755bbc0a6b5a2cb /binutils/testsuite | |
parent | 69c21b8a2296cda07050cc55de0400fea10a695d (diff) | |
download | fsf-binutils-gdb-428c21e99a3a8e6b2c7fd204664764d7724f6272.zip fsf-binutils-gdb-428c21e99a3a8e6b2c7fd204664764d7724f6272.tar.gz fsf-binutils-gdb-428c21e99a3a8e6b2c7fd204664764d7724f6272.tar.bz2 |
objcopy bfd_map_over_sections and global status
This patch started life as a relatively simple change to fix some
unimportant objcopy memory leaks, but expanded into a larger patch
when I was annoyed by the awkwardness of passing data when using
bfd_map_over_sections. A simple loop over sections is much more
convenient, and we really don't need the abstraction layer. Sections
in a list isn't going to disappear any time soon.
The patch also removes use of the global "status" variable by all but
the top-level functions called from main.
* objcopy.c (filter_symbols): Return success as a bool. Pass
symcount as a pointer, updated on return.
(merge_gnu_build_notes): Similarly return a bool and add newsize
param with updated smaller section size.
(setup_bfd_headers): Return bool success rather than setting
"status" on failure.
(setup_section): Likewise.
(copy_relocations_in_section, copy_section): Likewise, and adjust
params.
(mark_symbols_used_in_relocations): Likewise, and free memory
on failure path. Don't call bfd_fatal.
(get_sections): Delete function.
(copy_object): Don't use bfd_map_over_sections, instead use a
loop allowing easy detection of failure status. Free memory on
error paths.
(copy_archive): Return bool success rather than setting "status"
on failure.
(copy_file): Set "status" here.
* testsuite/binutils-all/strip-13.d: Adjust to suit.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/binutils-all/strip-13.d | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/binutils/testsuite/binutils-all/strip-13.d b/binutils/testsuite/binutils-all/strip-13.d index 73ab642..48a3124 100644 --- a/binutils/testsuite/binutils-all/strip-13.d +++ b/binutils/testsuite/binutils-all/strip-13.d @@ -1,7 +1,6 @@ #PROG: strip #strip: -g -#error: \A[^\n]*: unsupported relocation type 0x[0-9a-f]+\n -#error: [^\n]*: bad value\Z +#error: \A[^\n]*: unsupported relocation type 0x[0-9a-f]+\Z #notarget: rx-* # The RX targets do not complain about unrecognised relocs, unless they # are actually used |