aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-07-28 12:44:17 +0930
committerAlan Modra <amodra@gmail.com>2023-07-28 14:11:27 +0930
commit41c8b9f097ecabeb17b605ee6e0ceffac9a6243a (patch)
tree18d602794d56959e9b04717c3781213c516deedc /bfd
parent6551c119bf788b6b9e3475e5bacf21d589ba9405 (diff)
downloadgdb-41c8b9f097ecabeb17b605ee6e0ceffac9a6243a.zip
gdb-41c8b9f097ecabeb17b605ee6e0ceffac9a6243a.tar.gz
gdb-41c8b9f097ecabeb17b605ee6e0ceffac9a6243a.tar.bz2
coff/pe/xcoff and --extract-symbols
This fixes failure of the "extract symbols" test for rs6000, where --extract-symbols generates a non-zero sized .text. By the look of coffcode.h the same problem might occur for coff/pe too, but doesn't happen to trigger a test failure. bfd/ * coffcode.h (coff_compute_section_file_positions): Don't adjust size of !SEC_LOAD sections. binutils/ * objcopy.c (setup_section): Clear SEC_LOAD for --extract-symbol.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/coffcode.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f37d029..6c8080c 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3176,8 +3176,9 @@ coff_compute_section_file_positions (bfd * abfd)
created and not just improve performances with gdb.
*/
- if ((!strcmp (current->name, _TEXT)
- || !strcmp (current->name, _DATA))
+ if ((current->flags & SEC_LOAD) != 0
+ && (!strcmp (current->name, _TEXT)
+ || !strcmp (current->name, _DATA))
&& (previous == NULL || strcmp(previous->name, _TDATA)))
{
bfd_vma align = 4096;
@@ -3190,7 +3191,8 @@ coff_compute_section_file_positions (bfd * abfd)
sofar += align + vma_off - sofar_off;
}
#endif
- if (previous != NULL)
+ if (previous != NULL
+ && (previous->flags & SEC_LOAD) != 0)
previous->size += sofar - old_sofar;
}