Re: ELF section in segment

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: ELF section in segment

Ulrich Weigand
Alan Modra wrote:

> include/elf/
> * internal.h (ELF_IS_SECTION_IN_SEGMENT): Check both file offset
> and vma for appropriate sections.
> bfd/
> * elf.c (assign_file_positions_for_load_sections): Set sh_offset
> here.  Set sh_type to SHT_NOBITS if we won't be allocating
> file space.  Don't bump p_memsz for non-alloc sections.  Adjust
> section-in-segment check.
> (assign_file_positions_for_non_load_sections): Don't set sh_offset
> here for sections that have already been handled above.

It looks like this patch broke GDB's generate-core-file capability:

(gdb) gcore /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: Failed to write corefile contents (Bad value).^M
BFD: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test: section `note0' can't be allocated in segment 0^M
warning: writing note section (Bad value)^M
Saved corefile /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/gcore.test^M

Reverting the patch makes the error go away ...

Bye,
Ulrich

--
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  [hidden email]