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
--
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.
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.
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
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
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
--
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/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXHo%3DSCXRtX2VESHB3aKmpSUDrrgX4C5%2B0x4fmS_c_KEfQ%40mail.gmail.com.
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/CACvivXEnAOM4%3DpEyisER22mTjXW9xHaEc16PkTkqw%3DOvFYc4%2BA%40mail.gmail.com.
Hi,
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.
--
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/CACSh3m2vp-0bwi-K-GWVWHVNveRdT0LT-kM_99ga9O78Ad0NPQ%40mail.gmail.com.
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.
--
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/CACvivXGKD51BnheAU6J91SO1s_aN-O4zR4Cs2Z-wP_7vV9iJQg%40mail.gmail.com.
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.
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/.
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.
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.
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/.
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/CACvivXEiHm1pZ6SOU%3DS_DWsbc3E2TDkuP7G8cuBObM0GrY5j8A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEiHm1pZ6SOU%3DS_DWsbc3E2TDkuP7G8cuBObM0GrY5j8A%40mail.gmail.com.
--
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/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACSh3m14iKbmueh6K0-2n3-ht7VppGVz%2BuG%2Bi2V77tRVc5PpWg%40mail.gmail.com.
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
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
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/CACvivXHuZv4af_vhO7%2BgY08TZ2X8BBVKFbn%2BKjSyysRNTv5GEA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXHuZv4af_vhO7%2BgY08TZ2X8BBVKFbn%2BKjSyysRNTv5GEA%40mail.gmail.com.
Yes, I did that and seems like the gdb doesn't apply the break point and doesn't stop at that line.
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
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.
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/CACvivXEzyG%3D-r377SRky6FoZqSxjzuK%2Bx79ts-EAvq-Jjs0Nwg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACvivXEzyG%3D-r377SRky6FoZqSxjzuK%2Bx79ts-EAvq-Jjs0Nwg%40mail.gmail.com.