This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS and -msym32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]