From 610bcd4a903c562bf1e4b6fc9f4978907909bc08 Mon Sep 17 00:00:00 2001 From: drow Date: Tue, 3 Nov 2009 02:16:14 +0000 Subject: [PATCH 1/1] * elfread.c (elf_symfile_segments): Do not warn about uninitialized sections outside of load segments. --- gdb/ChangeLog | 5 +++++ gdb/elfread.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ec24e9fa10..8fc59bb524 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-11-02 Daniel Jacobowitz + + * elfread.c (elf_symfile_segments): Do not warn about + uninitialized sections outside of load segments. + 2009-11-02 Jan Kratochvil * symfile.c (build_id_to_debug_filename): New variable debugdir. Move diff --git a/gdb/elfread.c b/gdb/elfread.c index 767dfe6b21..131d7d2a9d 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -114,7 +114,17 @@ elf_symfile_segments (bfd *abfd) break; } - if (bfd_get_section_size (sect) > 0 && j == num_segments) + /* We should have found a segment for every non-empty section. + If we haven't, we will not relocate this section by any + offsets we apply to the segments. As an exception, do not + warn about SHT_NOBITS sections; in normal ELF execution + environments, SHT_NOBITS means zero-initialized and belongs + in a segment, but in no-OS environments some tools (e.g. ARM + RealView) use SHT_NOBITS for uninitialized data. Since it is + uninitialized, it doesn't need a program header. Such + binaries are not relocatable. */ + if (bfd_get_section_size (sect) > 0 && j == num_segments + && (bfd_get_section_flags (abfd, sect) & SEC_LOAD) != 0) warning (_("Loadable segment \"%s\" outside of ELF segments"), bfd_section_name (abfd, sect)); } -- 2.11.0