public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: MIPS and -msym32
Date: Fri, 01 Aug 2014 12:59:58 +0200	[thread overview]
Message-ID: <20140801105957.GB28053@toonder.wildebeest.org> (raw)
In-Reply-To: 53CE78E0.1050905@gmail.com

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

Hi Leonard,

On Tue, Jul 22, 2014 at 05:44:48PM +0300, Crestez Dan Leonard wrote:
> I used the elfutils mips patch from debian:
> 	http://sources.debian.net/src/elfutils/0.159-4/debian/patches/mips_backend.diff

It would be convenient if the MIPS port was integrated upstream.
Do you happen to know whether the porters might want to contribute it?
The contribution policy for elfutils is documented at:
https://git.fedorahosted.org/cgit/elfutils.git/tree/CONTRIBUTING

> The generated dwarf files confuse systemtap is multiple ways. 

Do you happen to have one such DWARF file around? I like to better
understand which address size is set where.

> Here is a hack I used to get around this:
> --- a/libdw/dwarf_diecu.c
> +++ b/libdw/dwarf_diecu.c
> @@ -47,7 +47,22 @@ dwarf_diecu (die, result, address_sizep, offset_sizep)
>    *result = CUDIE (die->cu);
>  
>    if (address_sizep != NULL)
> +  {
>      *address_sizep = die->cu->address_size;
> +    /* Hack: */
> +    if (1)
> +    {
> +      struct Elf *elf = die->cu->dbg->elf;
> +      GElf_Ehdr ehdr_mem;
> +      GElf_Ehdr* ehdr = gelf_getehdr (elf, &ehdr_mem);
> +      if (ehdr &&
> +              ehdr->e_machine == EM_MIPS &&
> +              ehdr->e_ident[EI_CLASS] == ELFCLASS64)
> +      {
> +        *address_sizep = 8;
> +      }
> +    }
> +  }
>    if (offset_sizep != NULL)
>      *offset_sizep = die->cu->offset_size;
> 
> This is obviously evil.

Yes, it is :)
Assuming that address size used in the CU is correct, it seems the
above check should be in systemtap instead.

> Apparently the gcc folks decided that this -msym32 behavior was too
> confusing and changed it to generate dwarf with a pointer size of 8:
> https://gcc.gnu.org/ml/gcc/2009-01/msg00611.html

Hmmm. That helps, but is technically wrong IMHO.
It would be better to fix binutils instead.

Thanks,

Mark

             reply	other threads:[~2014-08-01 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 10:59 Mark Wielaard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-15 16:42 Kurt Roeckx
2014-08-15 15:24 Kurt Roeckx
2014-08-15 14:38 Mark Wielaard
2014-08-01 12:21 Crestez Dan Leonard
2014-07-22 14:44 Crestez Dan Leonard

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=20140801105957.GB28053@toonder.wildebeest.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@lists.fedorahosted.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).