Hi, 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_I +nterface_Standards_Manual.pdf CSKY architecture user guide: https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.p +df 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=e4ac93323c0 +287d8d3d8191d51260983490fcac1;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