[Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section

2019-07-10 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24795

--- Comment #3 from Mark Wielaard  ---
(In reply to Tom de Vries from comment #2)
> I tried elfutils-latest.tar.bz2 instead, and ran into the use of
> aligned_alloc, which is supported starting glibc v2.16, while debian 7 has
> glibc v2.13.

BTW. Unrelated to the MIPS issue, but this has indeed been fixed in git:

commit 6bd060a23f43a842fbc37dd1bb8d6d7964eda36e
Author: Mark Wielaard 
Date:   Thu Mar 7 17:31:53 2019 +0100

libelf: Use posix_memalign instead of aligned_alloc.

Older glibc might not have aligned_alloc (it is C11).
Use posix_memalign instead. posix_memalign requires the alignment to
be a multiple of sizeof (void *). So use malloc for smaller alignments.

Signed-off-by: Mark Wielaard 

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug backends/23902] MIPS varlocs dwarf_cfi_addrframe: unknown error (missing ebl abi_cfi hook)

2019-07-10 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=23902

Mark Wielaard  changed:

   What|Removed |Added

 Blocks||24795


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=24795
[Bug 24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section
-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section

2019-07-10 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24795

Mark Wielaard  changed:

   What|Removed |Added

 Depends on||23902

--- Comment #4 from Mark Wielaard  ---
See also https://sourceware.org/bugzilla/show_bug.cgi?id=23902 for a reference
to a partial MIPS backend.


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=23902
[Bug 23902] MIPS varlocs dwarf_cfi_addrframe: unknown error (missing ebl
abi_cfi hook)
-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [PATCH] libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.

2019-07-10 Thread Mark Wielaard
On Fri, 2019-06-28 at 23:07 +0200, Mark Wielaard wrote:
> To print eh human readable description of the ELF e_machine header field
> we used the ebl name. But this is not set for most EM constants. Introduce
> a new function dwelf_elf_e_machine_string that does work for all known
> EM values. Use that in eu-readelf to print a string representation of the
> e_machine value.
> 
> Since this was the only usage of ebl->name, remove that from struct ebl.
> 
> Also add a testcase that makes sure dwelf_elf_e_machine_string works for
> all EM values in the libelf/elf.h header so we will immediately notice
> when a new value appears.

I pushed this to master now.


[Bug tools/24799] New: dwarflint could check .debug_names

2019-07-10 Thread tromey at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24799

Bug ID: 24799
   Summary: dwarflint could check .debug_names
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: tromey at sourceware dot org
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

It would be handy if dwarflint checked that .debug_names was
complete and correct according to the rules in the DWARF
standard; though perhaps augmented with enumeration constants,
see this thread:
http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2018-April/004433.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [[RESEND & PING]PATCH V3 0/1] Add C-SKY support

2019-07-10 Thread Mark Wielaard
Hi Mao Han,

On Mon, 2019-06-03 at 16:16 +0800, Mao Han wrote:
> test binary:
> https://github.com/c-sky/test-result/blob/master/elfutils/divzero
> https://github.com/c-sky/test-result/blob/master/elfutils/core

I was looking at these, but they seem to have a wrong e_machine value
of EM_RCE, not EM_CSKY? Is that deliberate?

Thanks,

Mark


Re: [[RESEND & PING]PATCH V3 1/1] Add backend support for C-SKY

2019-07-10 Thread Mark Wielaard
Hi Mao Han,

On Mon, 2019-06-03 at 16:16 +0800, Mao Han wrote:
> +const char *
> +csky_section_type_name (int type,
> +  char *buf __attribute__ ((unused)),
> +  size_t len __attribute__ ((unused)))
> +{
> +  if (type == SHT_CSKY_ATTRIBUTES)
> +return "CSKY_ATTRIBUTES";
> +
> +  return NULL;
> +}

As far as I can see this is like a SHT_GNU_ATTRIBUTES or
SHT_ARM_ATTRIBUTES section. If so, you will also want something like:

diff --git a/src/readelf.c b/src/readelf.c
index cda7c93..8017dc4 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3571,7 +3571,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr
*ehdr)
 
   if (shdr == NULL || (shdr->sh_type != SHT_GNU_ATTRIBUTES
   && (shdr->sh_type != SHT_ARM_ATTRIBUTES
-  || ehdr->e_machine != EM_ARM)))
+  || ehdr->e_machine != EM_ARM)
+  && (shdr->sh_type != SHT_CSKY_ATTRIBUTES
+  || ehdr->e_machine != EM_CSKY)))
continue;
 
   printf (gettext ("\

And then hook check_object_attribute to display any CSKY specific
attribute names/values.

Cheers,

Mark


Re: [[RESEND & PING]PATCH V3 0/1] Add C-SKY support

2019-07-10 Thread Mao Han
On Wed, Jul 10, 2019 at 11:33:23PM +0200, Mark Wielaard wrote:
> Hi Mao Han,
> 
> On Mon, 2019-06-03 at 16:16 +0800, Mao Han wrote:
> > test binary:
> > https://github.com/c-sky/test-result/blob/master/elfutils/divzero
> > https://github.com/c-sky/test-result/blob/master/elfutils/core
> 
> I was looking at these, but they seem to have a wrong e_machine value
> of EM_RCE, not EM_CSKY? Is that deliberate?
>

I used an no upstream toolchain to verify coredump backtrace, which use
the EM_CSKY_OLD equals to 39. We have changed the EM number to 252 in
our newly released toolchain with compatibility to EM_CSKY_OLD.
See binutils/include/elf/common.h:
/* C-SKY historically used 39, the same value as MCORE, from which the
   architecture was derived.  */
#define EM_CSKY_OLD EM_MCORE

Thanks,
Mao Han 


Re: [[RESEND & PING]PATCH V3 1/1] Add backend support for C-SKY

2019-07-10 Thread Mao Han
Hi, Mark

On Thu, Jul 11, 2019 at 12:11:17AM +0200, Mark Wielaard wrote:
> As far as I can see this is like a SHT_GNU_ATTRIBUTES or
> SHT_ARM_ATTRIBUTES section. If so, you will also want something like:
> 
> diff --git a/src/readelf.c b/src/readelf.c
> index cda7c93..8017dc4 100644
> --- a/src/readelf.c
> +++ b/src/readelf.c
> @@ -3571,7 +3571,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr
> *ehdr)
>  
>if (shdr == NULL || (shdr->sh_type != SHT_GNU_ATTRIBUTES
>&& (shdr->sh_type != SHT_ARM_ATTRIBUTES
> -  || ehdr->e_machine != EM_ARM)))
> +  || ehdr->e_machine != EM_ARM)
> +  && (shdr->sh_type != SHT_CSKY_ATTRIBUTES
> +  || ehdr->e_machine != EM_CSKY)))
> continue;
>  
>printf (gettext ("\
> 
> And then hook check_object_attribute to display any CSKY specific
> attribute names/values.

Ok, I'll add check for C-SKY here.

Thanks,
Mao Han