Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <dan@codesourcery.com>
Subject: Re: RFC: Verify AT_ENTRY before using it
Date: Fri, 12 Mar 2010 15:28:00 -0000	[thread overview]
Message-ID: <20100312152830.GA13120@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100310211138.GA11271@host0.dyn.jankratochvil.net>

On Wed, 10 Mar 2010 22:11:38 +0100, Jan Kratochvil wrote:
> It has been checked-in without the warning() calls.
[...]
> http://sourceware.org/ml/gdb-cvs/2010-03/msg00096.html
> 
> --- src/gdb/ChangeLog	2010/03/10 18:41:37	1.11466
> +++ src/gdb/ChangeLog	2010/03/10 20:50:48	1.11467
> @@ -1,3 +1,16 @@
> +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
> +	all program headers.
> +	(read_program_headers_from_bfd): New function.
> +	(svr4_static_exec_displacement): Remove and move the comment ...
> +	(svr4_exec_displacement): ... here.  Remove variable found.  New
> +	variable displacement.  Check also DYNAMIC.  Verify DISPLACEMENT
> +	alignment for ELF targets.  Compare target vs. exec_bfd PHDRs for ELF
> +	targets using read_program_headers_from_bfd.  Remove the call of
> +	svr4_static_exec_displacement.

Is it OK also for gdb_7_1-branch?

Otherwise the minimized attached patch also works for me.  Still I would
prefer the full patch from the master branch.

No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.


Thanks,
Jan


gdb/
2010-03-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* solib-svr4.c (svr4_relocate_main_executable): Delay the
	svr4_exec_displacement call.  Return on non-DYNAMIC exec_bfd.

--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1719,7 +1719,15 @@ svr4_exec_displacement (void)
 static void
 svr4_relocate_main_executable (void)
 {
-  CORE_ADDR displacement = svr4_exec_displacement ();
+  CORE_ADDR displacement;
+
+  /* Therefore for ELF it is ET_EXEC and not ET_DYN.  Both shared libraries
+     being executed themselves and PIE (Position Independent Executable)
+     executables are ET_DYN.  */
+  if (exec_bfd && (bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0)
+    return;
+
+  displacement = svr4_exec_displacement ();
 
   /* 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


  parent reply	other threads:[~2010-03-12 15:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 22:49 Daniel Jacobowitz
2010-02-25 22:16 ` Jan Kratochvil
2010-02-26 21:12   ` Daniel Jacobowitz
2010-03-01 20:04     ` Jan Kratochvil
2010-03-01 21:22       ` [patch-testcase] " Jan Kratochvil
2010-03-08 22:13         ` Daniel Jacobowitz
2010-03-11 21:54           ` Jan Kratochvil
2010-03-11 21:57             ` Daniel Jacobowitz
2010-03-11 22:07               ` Jan Kratochvil
2010-03-08 22:06       ` Daniel Jacobowitz
2010-03-10 21:11         ` Jan Kratochvil
2010-03-10 21:55           ` Daniel Jacobowitz
2010-03-12 15:28           ` Jan Kratochvil [this message]
2010-03-12 15:39             ` Daniel Jacobowitz
2010-03-14  9:00               ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100312152830.GA13120@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox