public inbox for prelink@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@codesourcery.com>
To: prelink@sourceware.org
Subject: [PATCH] Fix MIPS debug info prelinking
Date: Fri, 07 May 2010 15:39:00 -0000	[thread overview]
Message-ID: <4BE4340A.5050004@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Hi all,

Prelink currently fails to relocate the debug info in MIPS libraries 
because they use a custom section type.

Here is an example section from PPC:

   [29] .debug_frame      PROGBITS        00000000 0021b0 00002c 00 
  0   0  4

The type is "PROGBITS", which is what prelink likes, so it works correctly.

Now, here is an example from an equivalent MIPS binary:

   [28] .debug_frame      MIPS_DWARF      00000000 000ee8 00002c 00 
  0   0  4

Here the type is "MIPS_DWARF", a type not handled by prelink.

Please accept the attached patch to fix this.

Thanks

Andrew


[-- Attachment #2: prelink-mips-debug.patch --]
[-- Type: text/x-diff, Size: 932 bytes --]

2010-05-06  Andrew Stubbs  <ams@codesourcery.com>

	* src/dso.c (adjust_dso): Support MIPS debug sections.
	* src/prelink.h (SHT_MIPS_DWARF): New define.

Index: src/prelink.h
===================================================================
--- src/prelink.h	(revision 184)
+++ src/prelink.h	(working copy)
@@ -79,6 +79,10 @@
 #define R_MIPS_GLOB_DAT		51
 #endif
 
+#ifndef SHT_MIPS_DWARF
+#define SHT_MIPS_DWARF		0x7000001e
+#endif
+
 #ifndef R_ARM_TLS_DTPMOD32
 #define R_ARM_TLS_DTPMOD32	17
 #define R_ARM_TLS_DTPOFF32	18
Index: src/dso.c
===================================================================
--- src/dso.c	(revision 184)
+++ src/dso.c	(working copy)
@@ -1381,6 +1381,7 @@
       switch (dso->shdr[i].sh_type)
 	{
 	case SHT_PROGBITS:
+	case SHT_MIPS_DWARF:
 	  name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name);
 	  if (strcmp (name, ".stab") == 0
 	      && adjust_stabs (dso, i, start, adjust))

             reply	other threads:[~2010-05-07 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 15:39 Andrew Stubbs [this message]
2010-05-17  7:53 ` Andrew Stubbs

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=4BE4340A.5050004@codesourcery.com \
    --to=ams@codesourcery.com \
    --cc=prelink@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).