function calls not working riscv-llvm

421 views
Skip to first unread message

Nitish Srivastava

unread,
Sep 14, 2017, 10:06:49 AM9/14/17
to RISC-V SW Dev

Hi everyone,

I am trying to compile a simple vector-vector add program using riscv-llvm compiler and run it on spike and I get the following error:

#include <stdio.h>                                                            

void __attribute__ ((noinline)) vvadd( int C[], int A[], int B[], int size )
{                                                                             
  for ( int i = 0; i < size; i++ ) {                                          
    C[i] = A[i] + B[i];                                                       
  }                                                                           
}                                                                             

int main() {                                                                  

  int A[10] = { 1,2,3,4,5,6,7,8,9,10 };                                       
  int B[10] = { 1,2,3,4,5,6,7,8,9,10 };                                       
  int C[10];                                                                  

  vvadd(C, A, B, 10);                                                  

  for ( int i = 0; i < 10; i++ ) {                                            
    if ( C[i] != 2*(i+1) ) {                                                  
      printf("\n[FAILED]\n");                                                 
      return 0;                                                               
    }                                                                         
  }                                                                           

  printf("\n[PASSED]\n");                                                     
  return 0;                                                                   

}

When I compile it like this:

% clang -g -O3  -MMD -MP -I. -target riscv64 -mriscv=RV64IAMFD -S  vvadd.c
% riscv64-unknown-elf-gcc vvadd.s -o vvadd
% spike pk vvadd

I get the following error:

z  0000000000000000 ra 00000000000102e8 sp 000000007f7e9ac0 gp 0000000000015bf8
tp 0000000000000000 t0 0000000000000014 t1 0000000000000009 t2 0000000000000002
s0 000000007f7e9ac0 s1 0000000000000000 a0 0000000000000001 a1 0000000000000018
a2 000000007f7e9b18 a3 0000000000000000 a4 0000000000000010 a5 0000000000000002
a6 000000000000001f a7 0000000000000000 s2 0000000000000000 s3 0000000000000000
s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000
s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000
t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000
pc 0000000000010304 va 0000000000000014 insn       ffffffff sr 8000000200046020
User load segfault @ 0x0000000000000014

When instead I try to break the code in two files:

main.c

#include <stdio.h>                                                            

void vvadd( int C[], int A[], int B[], int size );                     

int main() {                                                                  

  int A[10] = { 1,2,3,4,5,6,7,8,9,10 };                                       
  int B[10] = { 1,2,3,4,5,6,7,8,9,10 };                                       
  int C[10];                                                                  

  vvadd(C, A, B, 10);                                                  

  for ( int i = 0; i < 10; i++ ) {                                            
    if ( C[i] != 2*(i+1) ) {                                                  
      printf("\n[FAILED]\n");                                                 
      return 0;                                                               
    }                                                                         
  }                                                                           

  printf("\n[PASSED]\n");                                                     
  return 0;                                                                   

}

vvadd.c

void vvadd( int C[], int A[], int B[], int size )                      
{                                                                             
  for ( int i = 0; i < size; i++ ) {                                          
    C[i] = A[i] + B[i];                                                       
  }                                                                           
}

and compile them using

% clang -g -O3  -MMD -MP -I. -target riscv64 -mriscv=RV64IAMFD -S  vvadd.c
% clang -g -O3  -MMD -MP -I. -target riscv64 -mriscv=RV64IAMFD -S  main.c
% riscv64-unknown-elf-gcc vvadd.s main.s -o vvadd
% spike pk vvadd

I get the following error:

z  0000000000000000 ra 00000000000102f8 sp 000000007f7e9ac0 gp 0000000000015c00
tp 0000000000000000 t0 000000000000000a t1 0000000000000009 t2 0000000000000000
s0 000000007f7e9ac0 s1 0000000000000000 a0 000000000000000a a1 000000007f7e9b18
a2 000000007f7e9af0 a3 000000000000000a a4 000000000000000a a5 0000000000000002
a6 000000000000001f a7 0000000000000000 s2 0000000000000000 s3 0000000000000000
s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000
s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000
t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000
pc 000000000001030c va 000000000000000a insn       ffffffff sr 8000000200046020
User load segfault @ 0x000000000000000a

I am using commit point e617c9c for riscv-llvm and 52e04ed for riscv-clang, commit 65cb174 for riscv-gnu-toolchain, 3a4e893 for riscv-isa-sim and 2dcae92 for riscv-pk ( basically riscv-trunk branch for both gnu tool chain and llvm ).

The program, however, works perfectly fine when there is no function call:

vvadd.c

int A[100];                                                                   
int B[100];                                                                   
int C[100];                                                                   

#include <stdio.h>                                                            

int main() {                                                                  

  for ( int i = 0; i < 100; i++ ) {                                           
    A[i] = i+1;                                                               
    B[i] = i+1;                                                               
  }                                                                           

  for ( int i = 0; i < 100; i++ ) {                                           
    C[i] = A[i] + B[i];                                                       
  }                                                                           

  for ( int i = 0; i < 100; i++ ) {                                           
    if ( C[i] != 2*(i+1) ) {                                                  
      printf("\n[FAILED]\n");                                                 
      return 0;                                                               
    }                                                                         
  }                                                                           

  printf("\n[PASSED]\n");                                                     
  return 0;                                                                   

}
% clang -g -O3  -MMD -MP -I. -target riscv64 -mriscv=RV64IAMFD -S  vvadd.c
% riscv64-unknown-elf-gcc vvadd.s -o vvadd
% spike pk vvadd

[PASSED]

Thanks,

Best Regards,
Nitish




Kito Cheng

unread,
Sep 14, 2017, 11:07:54 AM9/14/17
to Nitish Srivastava, RISC-V SW Dev
Hi Nitish:

I guess you are using the Berkeley's version on riscv/riscv-llvm, it's no longer maintained, you could try our new llvm toolchain on our github (https://github.com/andestech/riscv-llvm-toolchain), it's more stable and usable :) 

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXGzhnNDTiANq8GOQv2%3DrG9rbeRZU%2BeEusvt%2Bfk5stSEQw%40mail.gmail.com.

Nitish Srivastava

unread,
Sep 18, 2017, 10:29:24 AM9/18/17
to Kito Cheng, RISC-V SW Dev

Hi Kito,

Thanks for the response. The compiler worked for the basic function calls ( the ones I had in my previous example ). But now I am facing trouble compiling the programs which use standard libraries. eg.

string.cpp

#include<string>
#include<iostream>

int main(){
  std::string s = "hello world!";
  std::cout << s << std::endl;
  return 0;

}

When I compile it using clang++

% riscv64-unknown-elf clang++ -g -O3 -MMD -MP -I.  -target riscv64  -S string.cpp

I get the following error:

string.cpp:1:9: fatal error: 'string' file not found
#include<string>
        ^~~~~~~~
1 error generated.

Can you let me know how can I compile these programs?

Thanks,

Best Regards,
Nitish


To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.

Nitish Srivastava

unread,
Sep 18, 2017, 1:43:04 PM9/18/17
to Kito Cheng, RISC-V SW Dev

Hi Kito,

Sorry for bothering you again. But to solve the issue I tried adding all the headers to my CPATH like this:

% export CPATH="/path/to/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/:/path/to/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/riscv64-unknown-elf/:/path/to/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include"

After this, I was able to compile the program to assembly using clang++

 clang++ -g -O3  -MMD -MP -target riscv64 -S string.cpp -o string.s

But, when I tried to assemble the program using riscv64-unknown-elf-gcc (from Andes toolchain itself), I get the following error:

% riscv64-unknown-elf-g++ string.s -o string

gives me the error:

string.s: Assembler messages:
string.s:3: Error: junk at end of line, first unrecognized character is `"'
string.s:4: Error: junk at end of line, first unrecognized character is `"'
string.s:5: Error: junk at end of line, first unrecognized character is `"'
string.s:6: Error: junk at end of line, first unrecognized character is `"'
string.s:7: Error: junk at end of line, first unrecognized character is `"'
string.s:8: Error: junk at end of line, first unrecognized character is `"'
string.s:9: Error: junk at end of line, first unrecognized character is `"'
string.s:10: Error: junk at end of line, first unrecognized character is `"'
string.s:11: Error: junk at end of line, first unrecognized character is `"'
string.s:12: Error: junk at end of line, first unrecognized character is `"'
string.s:13: Error: junk at end of line, first unrecognized character is `"'
string.s:14: Error: junk at end of line, first unrecognized character is `"'
string.s:15: Error: junk at end of line, first unrecognized character is `"'
string.s:16: Error: junk at end of line, first unrecognized character is `"'
string.s:17: Error: junk at end of line, first unrecognized character is `"'
string.s:18: Error: junk at end of line, first unrecognized character is `"'
string.s:19: Error: junk at end of line, first unrecognized character is `"'
string.s:20: Error: junk at end of line, first unrecognized character is `"'
string.s:21: Error: junk at end of line, first unrecognized character is `"'
string.s:22: Error: junk at end of line, first unrecognized character is `"'
string.s:33: Error: junk at end of line, first unrecognized character is `"'
string.s:57: Error: junk at end of line, first unrecognized character is `"'

Here are the first few lines of the string.s assembly file:

   1         .text
   2         .file   "string.cpp"
   3         .file   1 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/riscv64-unknown-elf/bits" "atomic_word.h"
   4         .file   2 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/bits" "ios_base.h"
   5         .file   3 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "iostream"
   6         .file   4 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/riscv64-unknown-elf/bits" "c++config.h"
   7         .file   5 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/bits" "postypes.h"
   8         .file   6 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/sys" "_types.h"
   9         .file   7 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/lib/clang/5.0.0/include" "stddef.h"
  10         .file   8 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include" "wchar.h"
  11         .file   9 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "cwchar"
  12         .file   10 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/sys" "reent.h"
  13         .file   11 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/sys" "lock.h"
  14         .file   12 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/lib/clang/5.0.0/include" "stdarg.h"
  15         .file   13 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/debug" "debug.h"
  16         .file   14 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "clocale"
  17         .file   15 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include" "locale.h"
  18         .file   16 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include" "ctype.h"
  19         .file   17 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "cctype"
  20         .file   18 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ext" "new_allocator.h"
  21         .file   19 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include" "wctype.h"
  22         .file   20 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "cwctype"
  23         .globl  main                    # -- Begin function main
  24         .p2align        2
  25         .type   main,@function
  26 main:                                   # @main
  27 .Lfunc_begin0:
  28         .file   21 "string.cpp"
  29         .loc    21 4 0                  # string.cpp:4:0
  30 # BB#0:
  31         addi    sp, sp, -16
  32 .Ltmp0:
  33         .file   22 "/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1" "ostream"
  34         .loc    22 561 2 prologue_end   # /work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ostream:561:2
  35         sd      ra, 8(sp)
  36         lui     a0, %hi(_ZSt4cout)
  37         addi    a0, a0, %lo(_ZSt4cout)

I would really appreciate if you can provide any help.

Thanks a lot,

Best Regards,
Nitish

PkmX

unread,
Sep 18, 2017, 2:14:12 PM9/18/17
to Nitish Srivastava, RISC-V SW Dev
Hi,

The new `.file` directive emitted by clang isn't recognized by GNU as. You can invoke clang with `-no-integrated-as` to disable that.

Chih-Mao Chen (PkmX)
Software R&D, Andes Technology
https://github.com/pkmx

Nitish Srivastava

unread,
Sep 18, 2017, 3:08:03 PM9/18/17
to PkmX, Kito Cheng, RISC-V SW Dev

Hi Chih,

Thanks a lot. I added -not-integrated-as to clang but now I am getting the following error:

% riscv64-unknown-elf-clang++ -g -O3  -no-integrated-as -static -MMD -MP -target riscv64  -S string.cpp 
% riscv64-unknown-elf-gcc string.s -o string

This gives the error:

/tmp/cccSWqVD.o: In function `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)':
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ostream:561: undefined reference to `std::cout'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ostream:561: undefined reference to `std::cout'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ostream:561: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/ostream:561: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/tmp/cccSWqVD.o: In function `.L0 ':
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/riscv64-unknown-elf/include/c++/7.1.1/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status

I thought may be it is because I need to set the LD_LIBRARY_PATH variable to point to the directories having .so files for std::cout etc. So this is what I did:

% export LD_LIBRARY_PATH=/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/lib:/work/zhang/users/nks45/RISCV-LLVM-TOOLCHAIN/lib64

Basically added the lib and lib64 folders from the path where I installed riscv-llvm-toolchain to the LD_LIBRARY_PATH. But even after doing this I get the same linker error.

I would really appreciate if you can tell what is going wrong. Is there something else that I need to do. I am really thankful for the advice so far.

Thanks,

Best Regards,
Nitish

Michael Clark

unread,
Sep 18, 2017, 3:26:42 PM9/18/17
to Nitish Srivastava, PkmX, Kito Cheng, RISC-V SW Dev
Try linking with riscv64-unknown-elf-g++ instead of riscv64-unknown-elf-gcc. The C++ compiler will add libstdc++.

Sent from my iPhone

Nitish Srivastava

unread,
Sep 18, 2017, 3:40:52 PM9/18/17
to Michael Clark, PkmX, Kito Cheng, RISC-V SW Dev
Thanks a lot. That worked. :-) :-). I can now run the simple example of printing a string on the screen. 

Actually, I am trying to compile an entire benchmark suite using Andes RISCV llvm compiler, so I might ask few more questions if I get stuck. But thanks to all of you for your help :)

Best Regards,
Nitish

Kito Cheng

unread,
Sep 18, 2017, 10:31:49 PM9/18/17
to Nitish Srivastava, Michael Clark, PkmX, RISC-V SW Dev
Hi Nitish:

Thanks for your report, we're fixing the include search path issue for compiling C++ program, I expect it could be fixed today, and I'll let you know when we done. Feel free to report more issue/bug when you got  problems during building benchmark :)

Nitish Srivastava

unread,
Sep 19, 2017, 9:47:58 AM9/19/17
to Kito Cheng, Michael Clark, PkmX, RISC-V SW Dev

Hi Kito,

I ran into another issue while compiling a local implementation of stdx. ( Please see the files attached ).

When I compile the project, I get the following error:

First I make a static library using stdx implementation:

riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../stdx  -S ../stdx/stdx-Exception.cc
riscv64-unknown-elf-g++ -c stdx-Exception.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../stdx  -S ../stdx/stdx-MathUtils.cc
riscv64-unknown-elf-g++ -c stdx-MathUtils.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../stdx  -S ../stdx/stdx-StringUtils.cc
riscv64-unknown-elf-g++ -c stdx-StringUtils.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../stdx  -S ../stdx/stdx-FstreamUtils.cc
riscv64-unknown-elf-g++ -c stdx-FstreamUtils.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../stdx  -S ../stdx/stdx-Timer.cc
riscv64-unknown-elf-g++ -c stdx-Timer.s
riscv64-unknown-elf-ar rcv libstdx.a stdx-Exception.o stdx-MathUtils.o stdx-StringUtils.o stdx-FstreamUtils.o stdx-Timer.o
a - stdx-Exception.o
a - stdx-MathUtils.o
a - stdx-StringUtils.o
a - stdx-FstreamUtils.o
a - stdx-Timer.o
riscv64-unknown-elf-ranlib libstdx.a

Then a static library of a single benchmark:

riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../dither -I../stdx -I../
pinfo  -S ../dither/dither-scalar.cc
riscv64-unknown-elf-g++ -c dither-scalar.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../dither -I../stdx -I../
pinfo  -S ../dither/dither-xloops-reg.cc
riscv64-unknown-elf-g++ -c dither-xloops-reg.s
riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../dither -I../stdx -I../
pinfo  -S ../dither/dither-xloops.cc
riscv64-unknown-elf-g++ -c dither-xloops.s
riscv64-unknown-elf-ar rcv libdither.a dither-scalar.o dither-xloops-reg.o dither-xloops.o
a - dither-scalar.o
a - dither-xloops-reg.o
a - dither-xloops.o
riscv64-unknown-elf-ranlib libdither.a

And then linking them together gives me this error:

riscv64-unknown-elf-clang++ -Wall -g -O3 -D_RISCV_ARCH -mllvm -disable-lsr -no-integrated-as -static -MMD -MP -I. -target riscv64  -I../dither -I../stdx -I../pinfo  -S ../dither/dither.cc
riscv64-unknown-elf-g++ -c dither.s
riscv64-unknown-elf-g++ -L.   -o dither dither.o -ldither -lstdx


Error:

./libstdx.a(stdx-Timer.o): In function `.Lfunc_end3':
/home/nks45/temp/xloops-bmarks/build-riscv-clang/../stdx/stdx-Timer.cc:104: undefined reference to `__sync_val_compare_and_swap_1'
./libstdx.a(stdx-Timer.o): In function `stdx::Timer::get_resolution()':
/home/nks45/temp/xloops-bmarks/build-riscv-clang/../stdx/stdx-Timer.cc:111: undefined reference to `__sync_val_compare_and_swap_1'

collect2: error: ld returned 1 exit status

I checked the stdx-Timer.cc and there is no call to compare and swap anywhere. I was searching online and found something similar on riscv-tools ( https://github.com/riscv/riscv-gnu-toolchain/issues/175 ). Let me know what you think. Is there something that I am doing wrong? I have attached the related files.

Thanks,

Best Regards,
Nitish

stdx-Timer.cc
stdx-Timer.h
stdx-Timer.inl

Kito Cheng

unread,
Sep 19, 2017, 10:31:00 AM9/19/17
to Nitish Srivastava, Michael Clark, PkmX, RISC-V SW Dev
Hi Nitish:

Header search issue is fixed[1] now, you can compile C++ program with single command now.

riscv64-unknown-elf-clang++ string.cpp -o string


For __sync_val_compare_and_swap_1 issue, are you trying to build xloops-bmarks[2], I am trying to reproduce that in progress.





--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 19, 2017, 10:32:51 AM9/19/17
to Kito Cheng, Michael Clark, PkmX, RISC-V SW Dev
Hi Kito,

  Yes, I am actively working on xloops benchmarks and are trying to compile the same. 

  Thanks,

Best Regards,
Nitish



PkmX

unread,
Sep 19, 2017, 11:12:13 AM9/19/17
to Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev
Hi,

As a sanity check, was your riscv64 gcc toolchain compiled with A (atomic) extension?

Chih-Mao Chen (PkmX)
Software R&D, Andes Technology
https://github.com/pkmx

To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 19, 2017, 11:32:24 AM9/19/17
to PkmX, Kito Cheng, Michael Clark, RISC-V SW Dev
No I did not. I compiled it using "--with-arch=rv64im".

I am planning to run these benchmarks on the new RISCV port in gem5 and I am not very sure how many atomic operations does that support, so I wanted to stay away from atomic operations for now. The benchmarks do not use atomic operations either.

I am trying to build it using "ima" now to see if that helps in the compilation and if the binary can run on both spike and gem5.

Thanks,

Best Regards,
Nitish




Hi,

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Kito Cheng

unread,
Sep 19, 2017, 11:44:21 AM9/19/17
to Nitish Srivastava, PkmX, Michael Clark, RISC-V SW Dev
Hi Nitish:

I can build xloops-bmarks successful with few modification in RV64IMAC, and no __sync_val_compare_and_swap_1 issue.

so the root cause seems like cause by lack of A extension, our RISC-V LLVM code gen don't consider when lacking A extension this moment, we'll investigate the how risc-v gcc code gen without A extension for that.

My configure options:
../xloops-bmarks/configure --host=riscv64-unknown-elf  CC=riscv64-unknown-elf-clang CXX=riscv64-unknown-elf-clang++ --with-clang RUN=qemu-riscv64


--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 20, 2017, 4:44:02 PM9/20/17
to Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Hi Kito,

  Thanks it worked.

Best Regards,
Nitish




Nitish Srivastava

unread,
Sep 21, 2017, 9:34:00 AM9/21/17
to Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Hi Kito,

  I have a quick question. It seems like the overall project after the build takes more than 50GB. Is there a way to reduce that? I just want Clang for C and C++ and the backend only for RISCV. I think it might save some build time as well. 

  Thanks,

Best Regards,
Nitish



PkmX

unread,
Sep 21, 2017, 10:34:00 AM9/21/17
to Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev
Hi Nitish,

The build script by default builds llvm with RelWithDebInfo and static linking, so the resulting llvm executables are quite large.

You can modify `Makefile` (and `Makefile.in` in case you reconfigure) to pass cmake with `-DCMAKE_BUILD_TYPE=Release` to exclude debug info and `-DBUILD_SHARED_LIBS=On` to enable dynamic linking of LLVM libraries. That should greatly reduce the size required.

Chih-Mao Chen (PkmX)
Software R&D, Andes Technology
https://github.com/pkmx

On Thu, Sep 21, 2017 at 9:33 PM, Nitish Srivastava <nk...@cornell.edu> wrote:
Hi Kito,

  I have a quick question. It seems like the overall project after the build takes more than 50GB. Is there a way to reduce that? I just want Clang for C and C++ and the backend only for RISCV. I think it might save some build time as well. 

  Thanks,

Best Regards,
Nitish

-- 
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

PkmX

unread,
Sep 21, 2017, 10:44:13 AM9/21/17
to Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev
Hi,

Actually you can change the build type at configure time with `--with-build-type=Release`, so you don't have to mess with `Makefile.in`.

Chih-Mao Chen (PkmX)
Software R&D, Andes Technology
https://github.com/pkmx

On Thu, Sep 21, 2017 at 10:33 PM, PkmX <pkm...@gmail.com> wrote:
Hi Nitish,

The build script by default builds llvm with RelWithDebInfo and static linking, so the resulting llvm executables are quite large.

You can modify `Makefile` (and `Makefile.in` in case you reconfigure) to pass cmake with `-DCMAKE_BUILD_TYPE=Release` to exclude debug info and `-DBUILD_SHARED_LIBS=On` to enable dynamic linking of LLVM libraries. That should greatly reduce the size required.

Chih-Mao Chen (PkmX)
Software R&D, Andes Technology
https://github.com/pkmx

On Thu, Sep 21, 2017 at 9:33 PM, Nitish Srivastava <nk...@cornell.edu> wrote:
Hi Kito,

  I have a quick question. It seems like the overall project after the build takes more than 50GB. Is there a way to reduce that? I just want Clang for C and C++ and the backend only for RISCV. I think it might save some build time as well. 

  Thanks,

Best Regards,
Nitish

-- 
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 21, 2017, 10:45:54 AM9/21/17
to PkmX, Kito Cheng, Michael Clark, RISC-V SW Dev
Hi Kito, 

  After reading the makefile that is what I was planning to do as well. But I still need to add -DBUILD_SHARED_LIBS=On option in the makefile right??
  
  Thanks a lot!

Best Regards,
Nitish



PkmX

unread,
Sep 21, 2017, 10:56:13 AM9/21/17
to Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev
Yes, it will shave off some size but not as dramatic as disabling debug info I believe.

To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Kito Cheng

unread,
Sep 21, 2017, 1:02:32 PM9/21/17
to PkmX, Nitish Srivastava, Michael Clark, RISC-V SW Dev
Hi Nitish:

I've add a new configure option --enable-clang-only=yes for riscv-llvm-toolchain[1], it can significantly reduce the install size, and I've change the default build type to release.

BTW, here is MinSizeRel for build type, it will compile llvm with -Os.

./configure --enable-clang-only=yes --with-build-type=MinSizeRel



--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Khem Raj

unread,
Sep 21, 2017, 1:16:28 PM9/21/17
to Nitish Srivastava, Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Nitish

You might want to use -DLLVM_TARGETS_TO_BUILD=<> to just built selected
backends. and -DCMAKE_BUILD_TYPE=Release will get you stripped binaries
> <kito....@gmail.com <mailto:kito....@gmail.com>>
> wrote:
>
> Hi Nitish:
>
> Header search issue is fixed[1] now, you can
> compile C++ program with single command now.
>
> riscv64-unknown-elf-clang++ string.cpp -o string
>
>
> For __sync_val_compare_and_swap_1 issue, are you
> trying to build xloops-bmarks[2], I am trying to
> reproduce that in progress.
>
>
> [1]
> https://github.com/andestech/riscv-llvm-toolchain/commit/131978ce34010f709406ccff96272d710f4728ee
> <https://github.com/andestech/riscv-llvm-toolchain/commit/131978ce34010f709406ccff96272d710f4728ee>
>
> [2] https://github.com/cornell-brg/xloops-bmarks
> <https://github.com/cornell-brg/xloops-bmarks>
>
>
> On Tue, Sep 19, 2017 at 9:47 PM, Nitish
> Srivastava <nk...@cornell.edu
> <mailto:kito....@gmail.com>> wrote:
>
> Hi Nitish:
>
> Thanks for your report, we're fixing the
> include search path issue for compiling
> C++ program, I expect it could be fixed
> today, and I'll let you know when we
> done. Feel free to report more issue/bug
> when you got  problems during building
> benchmark :)
>
>
> On Tue, Sep 19, 2017 at 3:40 AM, Nitish
> Srivastava <nk...@cornell.edu
> <mailto:nk...@cornell.edu>> wrote:
>
> Thanks a lot. That worked. :-) :-).
> I can now run the simple example of
> printing a string on the screen.
>
> Actually, I am trying to compile an
> entire benchmark suite using Andes
> RISCV llvm compiler, so I might ask
> few more questions if I get stuck.
> But thanks to all of you for your
> help :)
>
> Best Regards,
> Nitish
>
> ‌
>
> On Mon, Sep 18, 2017 at 12:26 PM,
> Michael Clark <michae...@mac.com
> <mailto:michae...@mac.com>> wrote:
>
> Try linking with
> riscv64-unknown-elf-g++ instead
> of riscv64-unknown-elf-gcc. The
> C++ compiler will add libstdc++.
>
> Sent from my iPhone
>
> > On 19/09/2017, at 7:07 AM, Nitish Srivastava <nk...@cornell.edu
> <mailto:nk...@cornell.edu>> wrote:
> >
> > % riscv64-unknown-elf-clang++ -g -O3 -no-integrated-as -static -MMD -MP -target riscv64 -S string.cpp % riscv64-unknown-elf-gcc string.s -o string
>
>
>
> --
> You received this message because you are
> subscribed to the Google Groups "RISC-V SW
> Dev" group.
> To unsubscribe from this group and stop
> receiving emails from it, send an email to
> sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to
> sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> <https://groups.google.com/a/groups.riscv.org/group/sw-dev/>.
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXHo%3DSCXRtX2VESHB3aKmpSUDrrgX4C5%2B0x4fmS_c_KEfQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
>
> --
> You received this message because you are subscribed
> to the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving
> emails from it, send an email to
> sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to
> sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> <https://groups.google.com/a/groups.riscv.org/group/sw-dev/>.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEnAOM4%3DpEyisER22mTjXW9xHaEc16PkTkqw%3DOvFYc4%2BA%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEnAOM4%3DpEyisER22mTjXW9xHaEc16PkTkqw%3DOvFYc4%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> You received this message because you are subscribed to
> the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to
> sw-...@groups.riscv.org <mailto:sw-...@groups.riscv.org>.
> <https://groups.google.com/a/groups.riscv.org/group/sw-dev/>.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACSh3m2vp-0bwi-K-GWVWHVNveRdT0LT-kM_99ga9O78Ad0NPQ%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACSh3m2vp-0bwi-K-GWVWHVNveRdT0LT-kM_99ga9O78Ad0NPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> <https://groups.google.com/a/groups.riscv.org/group/sw-dev/>.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXGKD51BnheAU6J91SO1s_aN-O4zR4Cs2Z-wP_7vV9iJQg%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXGKD51BnheAU6J91SO1s_aN-O4zR4Cs2Z-wP_7vV9iJQg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> Visit this group at
> https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEQD%3Dq7h5Wkq3dxVvX2ohiPxS8DEh72RLWdw6EX%3DxRmzw%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEQD%3Dq7h5Wkq3dxVvX2ohiPxS8DEh72RLWdw6EX%3DxRmzw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Khem Raj

unread,
Sep 21, 2017, 1:18:27 PM9/21/17
to PkmX, Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev


On 9/21/17 7:33 AM, PkmX wrote:
> Hi Nitish,
>
> The build script by default builds llvm with RelWithDebInfo and static
> linking, so the resulting llvm executables are quite large.
>
> You can modify `Makefile` (and `Makefile.in` in case you reconfigure) to
> pass cmake with `-DCMAKE_BUILD_TYPE=Release` to exclude debug info and
> `-DBUILD_SHARED_LIBS=On` to enable dynamic linking of LLVM libraries.
> That should greatly reduce the size required.

Keep in mind using shared libs does slow down the resulting clang/llvm
compiler when run, If you are not using clang for static compilation
then it might be not something you would worry about.

>
> Chih-Mao Chen (PkmX)
> Software R&D, Andes Technology
> https://github.com/pkmx
>
> On Thu, Sep 21, 2017 at 9:33 PM, Nitish Srivastava <nk...@cornell.edu
> <mailto:nk...@cornell.edu>> wrote:
>
> Hi Kito,
>
>   I have a quick question. It seems like the overall project after
> the build takes more than 50GB. Is there a way to reduce that? I
> just want Clang for C and C++ and the backend only for RISCV. I
> think it might save some build time as well.
>
>   Thanks,
>
> Best Regards,
> Nitish
>
> --
> You received this message because you are subscribed to the Google
> Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> <https://groups.google.com/a/groups.riscv.org/group/sw-dev/>.
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEQD%3Dq7h5Wkq3dxVvX2ohiPxS8DEh72RLWdw6EX%3DxRmzw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To post to this group, send email to sw-...@groups.riscv.org
> <mailto:sw-...@groups.riscv.org>.
> Visit this group at
> https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACSh3m28XEafep3ExHY0OYzP%2BrjbenbWwhgnd2nud27CMemBHw%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACSh3m28XEafep3ExHY0OYzP%2BrjbenbWwhgnd2nud27CMemBHw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

PkmX

unread,
Sep 21, 2017, 1:32:55 PM9/21/17
to Khem Raj, Nitish Srivastava, Kito Cheng, Michael Clark, RISC-V SW Dev
On Fri, Sep 22, 2017 at 1:16 AM, Khem Raj <raj....@gmail.com> wrote:
> Nitish
>
> You might want to use -DLLVM_TARGETS_TO_BUILD=<> to just built selected
> backends. and -DCMAKE_BUILD_TYPE=Release will get you stripped binaries

-DLLVM_TARGETS_TO_BUILD=RISCV is already in the generated Makefile.

With that said, @kito, I think we should follow
https://reviews.llvm.org/D36538 to remove RISCV from LLVM_ALL_TARGETS
and build with `-DLLVM_TARGETS_TO_BUILD=
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=RISCV`.

Nitish Srivastava

unread,
Sep 22, 2017, 1:10:56 PM9/22/17
to Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev

Hi Kito,

Thanks a lot! I also wanted to know is there a way to debug the llvm build using gdb. In “Debug” and “RelWithDebInfo”, llvm and clang are themselves compiled with -g option, however when I am trying to debug the llvm code using gdb, seems like gdb cannot find the symbols. For eg:

% gdb -args clang -Wall -g -O3  -mllvm -disable-lsr  -MMD -MP  -S matrix-mul-xloops.c

(gdb) break /path/to/RISCVRegisterInfo.cpp:101
No source file named /path/to/RISCVRegisterInfo.cpp
Make breakpoint pending on future shared library load? (y or [n])

I get the same message even when I turn on the static linking.

Thanks,

Best Regards,

Nitish

Khem Raj

unread,
Sep 22, 2017, 1:15:57 PM9/22/17
to Nitish Srivastava, Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
On Fri, Sep 22, 2017 at 10:10 AM, Nitish Srivastava <nk...@cornell.edu> wrote:

Hi Kito,

Thanks a lot! I also wanted to know is there a way to debug the llvm build using gdb. In “Debug” and “RelWithDebInfo”, llvm and clang are themselves compiled with -g option, however when I am trying to debug the llvm code using gdb, seems like gdb cannot find the symbols. For eg:

% gdb -args clang -Wall -g -O3  -mllvm -disable-lsr  -MMD -MP  -S matrix-mul-xloops.c

(gdb) break /path/to/RISCVRegisterInfo.cpp:101
No source file named /path/to/RISCVRegisterInfo.cpp
Make breakpoint pending on future shared library load? (y or [n])

I get the same message even when I turn on the static linking.


​what happens if you say 'y' and then let it run
I am guessing if function is in a .so then it will
get hit once that .so is loaded.​

 

Thanks,

Best Regards,

Nitish

To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 22, 2017, 1:18:58 PM9/22/17
to Khem Raj, Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Yes, I did that and seems like the gdb doesn't apply the break point and doesn't stop at that line.




Khem Raj

unread,
Sep 22, 2017, 1:30:20 PM9/22/17
to Nitish Srivastava, Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
On Fri, Sep 22, 2017 at 10:18 AM, Nitish Srivastava <nk...@cornell.edu> wrote:
Yes, I did that and seems like the gdb doesn't apply the break point and doesn't stop at that line.

​hmm, just run file cmd on libclang .so and see if says stripped or "not stripped" at end

e.g. 

$ file /usr/lib/libclang.so.6.0                          
/usr/lib/libclang.so.6.0: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=d2b6d578cac2550c87554a611fc581924b422ff3, not stripped​

Nitish Srivastava

unread,
Sep 22, 2017, 2:03:50 PM9/22/17
to Khem Raj, Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev

Hi Khem Raj,

It says not stripped:

% file /path/to/lib/libclang.so.5.0
/path/to/lib/libclang.so.5.0: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=02fb9d6c11196a753051e8e0a73c225bb50c197f, not stripped

When I compile with static linking, it says

(gdb) break /path/to/riscv-llvm-toolchain/riscv-llvm/lib/Target/RISCV/RISCVXloops.cpp:71
Breakpoint 1 at 0x16c6342: file /path/to/riscv-llvm-toolchain/riscv-llvm/lib/Target/RISCV/RISCVXloops.cpp, line 71.

(gdb) set logging on
(gdb) run

gdb.txt

Starting program: /work/global/nks45/PUENGINE-RISCV-LLVM-TOOLCHAIN/bin/clang | tee gdb.log
During startup program exited normally.
Starting program: /work/global/nks45/PUENGINE-RISCV-LLVM-TOOLCHAIN/bin/clang -Wall -g -O3 -mllvm -disable-lsr -MMD -MP -S matrix-mul-xloops.c
Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7_3.4.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after vfork from child process 133702.
Detaching after fork from child process 133720.
[Inferior 1 (process 133698) exited with code 0376]
Missing separate debuginfos, use: debuginfo-install libgcc-4.8.5-11.el7.x86_64 libstdc++-4.8.5-11.el7.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64 zlib-1.2.7-17.el7.x86_6

I can see the line of code where the breakpoint is set are executed (I have printf statements there), however gdb doesn’t stop.

Thanks,

Best Regards,
Nitish

Michael Clark

unread,
Sep 22, 2017, 5:21:12 PM9/22/17
to Nitish Srivastava, Khem Raj, Kito Cheng, PkmX, RISC-V SW Dev
Have you tried:

set follow-fork-mode


Suspect the driver may fork and run child processes? Or is LLVM/Clang completely monolithic? I know the linker is invoked separately. GCC of course forks a lot e.g. cc1, collect2, as, ld


Sent from my iPhone

Nitish Srivastava

unread,
Sep 25, 2017, 2:59:54 PM9/25/17
to Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Hi Kito,

  Thanks to all of you for your great work. I was just curious that are you guys working on support for floating point extensions as well and is it going to be out anytime soon. I have few floating point benchmarks as well that I want to compile and run :-).

  Thanks,

Best Regards,
Nitish




Kito Cheng

unread,
Sep 27, 2017, 4:38:07 AM9/27/17
to Nitish Srivastava, PkmX, Michael Clark, RISC-V SW Dev
Hi Nitish:

Sure, floating point extensions part we are working on progress, we'll update when the testsuite is passed.

To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

Nitish Srivastava

unread,
Sep 27, 2017, 9:21:04 AM9/27/17
to Kito Cheng, PkmX, Michael Clark, RISC-V SW Dev
Reply all
Reply to author
Forward
0 new messages