diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-03-10 20:55:44 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-03-10 20:55:44 +0000 |
commit | 01c30d6e99495434cdac28788da9a8e53f372aa3 (patch) | |
tree | f4e069ff98862b4bb423c8d1c3c70eb6355f5d70 /gdb | |
parent | 09919ac266e1b59a0a62b31fcc87edc7dd78b392 (diff) | |
download | gdb-01c30d6e99495434cdac28788da9a8e53f372aa3.zip gdb-01c30d6e99495434cdac28788da9a8e53f372aa3.tar.gz gdb-01c30d6e99495434cdac28788da9a8e53f372aa3.tar.bz2 |
gdb/
* solib-svr4.c (svr4_exec_displacement): Return now success, new
parameter displacementp. Update comment.
(svr4_relocate_main_executable): Return if non-zero SECTION_OFFSETS
element exists. Return if svr4_exec_displacement was not successful.
Update comment.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 34 |
2 files changed, 34 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9085bb4..8186727 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,12 @@ 2010-03-10 Jan Kratochvil <jan.kratochvil@redhat.com> + + * solib-svr4.c (svr4_exec_displacement): Return now success, new + parameter displacementp. Update comment. + (svr4_relocate_main_executable): Return if non-zero SECTION_OFFSETS + element exists. Return if svr4_exec_displacement was not successful. + Update comment. + +2010-03-10 Jan Kratochvil <jan.kratochvil@redhat.com> Daniel Jacobowitz <dan@codesourcery.com> * solib-svr4.c (read_program_header): Support type == -1 to read diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 2ae9b50..d10a209 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1659,7 +1659,10 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size) return buf; } -/* We relocate all of the sections by the same amount. This +/* Return 1 and fill *DISPLACEMENTP with detected PIE offset of inferior + exec_bfd. Otherwise return 0. + + We relocate all of the sections by the same amount. This behavior is mandated by recent editions of the System V ABI. According to the System V Application Binary Interface, Edition 4.1, page 5-5: @@ -1699,8 +1702,8 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size) should either be removed or modified to accomodate the new file type. - Kevin, Nov 2000. ] */ -static CORE_ADDR -svr4_exec_displacement (void) +static int +svr4_exec_displacement (CORE_ADDR *displacementp) { /* ENTRY_POINT is a possible function descriptor - before a call to gdbarch_convert_from_func_ptr_addr. */ @@ -1764,7 +1767,8 @@ svr4_exec_displacement (void) return 0; } - return displacement; + *displacementp = displacement; + return 1; } /* Relocate the main executable. This function should be called upon @@ -1775,11 +1779,25 @@ svr4_exec_displacement (void) static void svr4_relocate_main_executable (void) { - CORE_ADDR displacement = svr4_exec_displacement (); + CORE_ADDR displacement; + + if (symfile_objfile) + { + int i; + + /* Remote target may have already set specific offsets by `qOffsets' + which should be preferred. */ + + for (i = 0; i < symfile_objfile->num_sections; i++) + if (ANOFFSET (symfile_objfile->section_offsets, i) != 0) + return; + } + + if (! svr4_exec_displacement (&displacement)) + return; - /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new - difference of in-memory vs. in-file addresses and we could already - relocate the executable at this function to improper address before. */ + /* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file + addresses. */ if (symfile_objfile) { |