public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mao Han <han_mao@c-sky.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org, ren_guo@c-sky.com
Subject: Re: [PATCH 0/2] Add C-SKY support
Date: Thu, 04 Apr 2019 06:27:00 -0000	[thread overview]
Message-ID: <20190404061048.GA1050@vmh-VirtualBox> (raw)
In-Reply-To: <20190404060156.GA1011@vmh-VirtualBox>

Hi,

FIX NEWLINE IN LAST EMAIL

On Wed, Apr 03, 2019 at 10:54:11PM +0200, Mark Wielaard wrote:
> Hi,
>
> On Mon, Apr 01, 2019 at 10:31:55AM +0800, Mao Han wrote:
> > This patch add backend support for C-SKY architecture.
>
> Thanks. I don't know anything about the C-SKY architecture.  Do you
> have an URL to the ELF/DWARF supplemental spec that describes the ELF
> structures and DWARF register numbers C-SKY uses? It would be good to
> have that in the commit message and/or in a comment in the backend.

ELF structures can be found inside the ABI manual.
CSKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
CSKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf

The DWARF part of the document is out of date. GCC source code can
be used as reference:

const int csky_dbx_regno[FIRST_PSEUDO_REGISTER] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23,
  24, 25, 26, 27, 28, 29, 30, 31,
  -1, -1, 36, 37, 35, 38, 39, 40,
  41, 42, 43, 44, 45, 46, 47, 48,
  49, 50, 51, 52, 53, 54, 55, 56,
  57, 58, 59, 60, 61, 62, 63, 64,
  65, 66, 67, 68, -1, -1, 72
};

The number in the array is the DWARF register numbers, the corresponding
register can be found in the corresponding below.

#define FIXED_REGISTERS                                                 \
 /*  r0    r1    r2    r3    r4    r5    r6    r7  */                   \
{    0,    0,    0,    0,    0,    0,    0,    0,                       \
 /*  r8    r9    r10   r11   r12   r13   r14   r15 */                   \
     0,    0,    0,    0,    0,    0,    1,    0,                       \
 /*  r16   r17   r18   r19   r20   r21   r22   r23 */                   \
     0,    0,    0,    0,    0,    0,    0,    0,                       \
 /*  r24   r25   r26   r27   r28   r29   r30   tls */                   \
     0,    0,    1,    1,    1,    1,    1,    1,                       \
 /*  reserve     c     hi    lo  */                                     \
     1,          1,    0,    0,                                         \
 /* reserved */                                                         \
     1,    1,    1,    1,    1,    1,    1,    1,                       \
     1,    1,    1,    1,    1,    1,    1,    1,                       \
 /* vr0   vr1   vr2   vr3   vr4   vr5   vr6   vr7  */                   \
     0,    0,    0,    0,    0,    0,    0,    0,                       \
 /* vr8   vr9   vr10  vr11  vr12  vr13  vr14  vr15 */                   \
     0,    0,    0,    0,    0,    0,    0,    0 ,                      \
 /* reserved */                                                         \
     1,    1,                                                           \
 /* epc */                                                              \
     1                                                                  \
}

These code come from gcc/config/csky/csky.c and gcc/config/csky/csky.h:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/csky/csky.c;h=e4ac93323c0287d8d3d8191d51260983490fcac1;hb=73c7feb34d49e52ca5b6c2342cda882a9b06a036

> In general please read the CONTRIBUTING file and add a Signed-off-by
> line if you agree with and can contribute the patch under the
> appropriate licenses. Please also add a copyright line to the new
> files.
>
Ok, I'll add the Signed-off-by line and the copyright.

> Does qemu support full system or user-mode only C-SKY?
>

Yes, we have support for both system-mode and user-mode.

Our linux system is available at:
https://gitlab.com/c-sky/buildroot
Our linux ci enviroment:
https://gitlab.com/c-sky/buildroot/-/jobs/187862406

> > FAIL: run-exprlocs-self.sh
> > ==========================
> >
> > /home/vmh/elfutilswk/tests/varlocs: dwarf_getlocation_attr for addr: .debug_addr section missing
> > *** failure in /home/vmh/elfutilswk/tests/varlocs --exprlocs -e /home/vmh/elfutilswk/src/readelf
> > FAIL run-exprlocs-self.sh (exit status: 1)
>
> This is somewhat surprising. Do you build with -gdwarf-5?  If you
> could make the /home/vmh/elfutilswk/src/readelf binary available
> somewhere we could investigate what goes on.
>

The default compile option is dwarf 4. I'v upload the binary to
https://github.com/c-sky/test-result/blob/master/elfutils/readelf
As I used the non-upstream version gcc to do the test, the machine
code is 39(EM_RCE) not 252(EM_CSKY).

> >
> > biarch testing disabled
> > SKIP run-backtrace-native-core-biarch.sh (exit status: 77)
>
> I haven't looked at the code yet, so maybe none of the backtrace tests
> would work even if you could run in "full system mode". If you do have
> a way to generate a C-SKY core file it would be interesting to see if
> you can get a backtrace from it using eu-stack.
>
Ok, I'll try if I can get a backtrace with C-SKY core file.

Thanks,
Mao Han

      reply	other threads:[~2019-04-04  6:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01  2:33 Mao Han
2019-04-01  2:33 ` [PATCH 2/2] Add backend support for C-SKY Mao Han
2019-04-01  2:33 ` [PATCH 1/2] libelf: Sync elf.h from glibc Mao Han
2019-04-03 20:54 ` [PATCH 0/2] Add C-SKY support Mark Wielaard
2019-04-04  6:19   ` Mao Han
2019-04-04  6:27     ` Mao Han [this message]

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=20190404061048.GA1050@vmh-VirtualBox \
    --to=han_mao@c-sky.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    --cc=ren_guo@c-sky.com \
    /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).