The command set arch <arch, e.g. arm, mips> is used to set gdb-multiarch to support a specific architecture. When specify set arch arm, it responses The target architecture is assumed to be arm. While specify set arch powerpc, it responses Ambiguous item "powerpc".
What is the proper way to set gdb-multiarch to support PowerPC?
While specify set arch powerpc, it responses Ambiguous item "powerpc".
Type (gdb) set arch. GDB will respond with a list of available architectures. In my build, I see:
... powerpc:common64, powerpc:common, powerpc:603, powerpc:EC603e, powerpc:604,
powerpc:403, powerpc:601, powerpc:620, powerpc:630, powerpc:a35, powerpc:rs64ii,
powerpc:rs64iii, powerpc:7400, powerpc:e500, powerpc:e500mc, powerpc:e500mc64,
powerpc:MPC8XX, powerpc:750, powerpc:titan, powerpc:vle, powerpc:e5500,
powerpc:e6500, ...
You probably want powerpc:common64 or powerpc:common.
Related
I'm using conan to build a library that uses arrow parquet. I built arrow myself because I couldn't find versions in conan center that included parquet:
In my conanfile.txt
[options]
arrow:shared=True # I tried both shared and static
arrow:parquet=True
arrow:with_snappy=True
conan install .. --build=arrow
It builds and executes properly in my machine, but fails the tests in the Jenkins server with
SIGILL - Illegal instruction signal
From this and this posts, it seems like there could be an architecture conflict. And indeed, there are differences:
Jenkins server
AVX supported
AVX2 not supported
my computer
AVX supported
AVX2 supported
Furthermore, the arrow code has optimizations up to the avx level. For example, in byte_stream_split.h:
#if defined(ARROW_HAVE_AVX2)
template <typename T>
void ByteStreamSplitDecodeAvx2(const uint8_t* data, int64_t num_values, int64_t stride,
T* out)
// Code
Since I didn't add support for AVX2, how do I tell conan to build arrow without AVX2 support, or whatever the minimum common configuration might be?
Or is there something entirely different I should be looking at?
In arrow, the level of SIMD instructions used is controlled by these cmake options
define_option_string(ARROW_SIMD_LEVEL
"Compile-time SIMD optimization level"
"SSE4_2" # default to SSE4.2
"NONE"
"SSE4_2"
"AVX2"
"AVX512")
define_option_string(ARROW_RUNTIME_SIMD_LEVEL
"Max runtime SIMD optimization level"
"MAX" # default to max supported by compiler
"NONE"
"SSE4_2"
"AVX2"
"AVX512"
"MAX")
This option is used here, to check whether or not to pass in the preprocessor definitions
if(CXX_SUPPORTS_AVX2 AND ARROW_RUNTIME_SIMD_LEVEL MATCHES "^(AVX2|AVX512|MAX)$")
set(ARROW_HAVE_RUNTIME_AVX2 ON)
add_definitions(-DARROW_HAVE_RUNTIME_AVX2 -DARROW_HAVE_RUNTIME_BMI2)
endif()
You can specify this cmake option, ARROW_SIMD_LEVEL and ARROW_RUNTIME_SIMD_LEVEL via the cmake generator when you run cmake. If that doesn't work, it means arrow doesn't yet support it as a cmake config through conan, so you might need to alter your build flow to be able to manually run cmake
Under Ubuntu 64 bit I got
llc --version
LLVM (http://llvm.org/):
LLVM version 3.1
Optimized build with assertions.
Built Oct 15 2012 (18:15:59).
Default target: x86_64-pc-linux-gnu
Host CPU: btver1
Registered Targets:
arm - ARM
mips - Mips
mips64 - Mips64 [experimental]
mips64el - Mips64el [experimental]
mipsel - Mipsel
thumb - Thumb
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
I can't do this
clang -march=arm -x c++ /tmp/cpp.cpp
error: unknown target CPU 'arm'
I'm missing something here ? Why I can't compile for ARM ?
-march is LLVM's internal tools command line option and is not connected with clang at all. If you need to compile for other target you need to specify the target triplet. This can be done in several ways (I do not remember offhand, whether they work with 3.1, but they definitely work with 3.2):
Make a link from clang to your-target-triple-clang, e.g. to
arm-none-linux-gnueabi-clang and compile everything via it
Provide -target option, e.g. clang -target arm-none-linux-gnueabi
To get a list of options of the clang compiler, use:
clang -cc1 -help
To specify the target, use -triple:
clang -cc1 -triple "arm-vendor-os" filename
where "vendor" and "os" should be replaced with the actual vendor and OS name. It can also be replaced with unknown.
-triple is a string of the form ARCHITECTURE-VENDOR-OS or ARCHITECTURE-VENDOR-OS-ENVIRONMENT. For example: x86_64-apple-darwin10
the llvm linker links for the host, which is only one of the targets, it wont link to every target in the list. it will definitely compile for any target. Basically clang goes from C/C++ to bytecode, then llc takes bytecode and makes assembly for the specific target (new experrimental option to take the bytecode straight to object file) then you need to get a cross assembler and a cross linker to take it the final mile (I use gnu binutils). Unfortunately I found that clang to bytecode is not completely generic (I had hoped and expected that it would be), it does in fact change the target independent output based on the target. The example below using the host triple instead of using -march allowed for my examples to build properly on more hosts.
ARMGNU?=arm-none-eabi
LOPS = -Wall -m32 -emit-llvm -ccc-host-triple $(ARMGNU)
OOPS = -std-compile-opts
LLCOPS = -march=thumb -mtriple=$(ARMGNU)
clang $(LOPS) -c blinker03.c -o blinker03.clang.bc
opt $(OOPS) blinker03.clang.bc -o blinker03.clang.thumb.opt.bc
llc $(LLCOPS) blinker03.clang.thumb.opt.bc -o blinker03.clang.thumb.opt.s
$(ARMGNU)-as blinker03.clang.thumb.opt.s -o blinker03.clang.thumb.opt.o
$(ARMGNU)-ld -o blinker03.clang.thumb.opt.elf -T memmap vectors.o blinker03.clang.thumb.opt.o
I have not, but before long will experiment with using the llc straight to object (actually I tried it on a simple test but have not used it on anything larger or posted it anywhere).
You're confusing your flags. clang's -march= wants a processor family. You probably meant to use clang -arch arm instead.
As this comment says this option it's not supported yet under linux, for now.
"-arch arm" is equivalent to "-arch armv4t" in clang. I suppose that a generic "arm" target is not allowed with "-march=", which should require something more precise, such as "armv6", "thumbv7", "armv4t", ...
Try selecting a specific subarch.
Starting Clang 11 (trunk), the list of supported target architectures could be handily printed using the newly added -print-targets flag.
I need an additional library given as linker input, since the linker cannot find a symbol.
llvm_map_components_to_libnames(llvm_libs support core bitreader)
target_link_libraries(SkeletonPass ${llvm_libs})
The missing library must be missing from the components.
How do I specify all components as input?
First of all, although it's outdated, I suggest you read the following
http://releases.llvm.org/2.7/docs/UsingLibraries.html
it's a nice read. In that is suggested too look up llvm-config.
LLVM comes with a tool, llvm-config
which can help you in your case.
Second, I warmly suggest you have a look at the following SO post
How do I link when building with llvm libraries?
which also mention this tool.
Looking at the documentation I linked, this is the synopsis:
llvm-config option [components...]
where if components is not specified, its default value is all which according to the doc:
Includes all LLVM libraries. The default if no components are specified.
I will explicitly add all which can be omitted in your case.
llvm-config --components all:
Print all valid component names.
while
llvm-config --libs all:
Print all the libraries needed to link against the specified LLVM components, including any dependencies.
Please check llvm-config --help for more options and info.
So to answer your question, you could print all the components with the command mentioned above and put them inside your llvm_map_components_to_libnames().
To list all the components try running this command:
llvm-config --components
For me the output was
aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo a
mdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwr
iter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker
engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lan
aiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430
msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes powerpc powerpcasmpars
er powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcas
mparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize weba
ssembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcored
esc xcoredisassembler xcoreinfo xray
I have a device whose cpu is armv7 but without fpu.
I can compile node with option --with-arm-float-abi=soft, but when I run "node", "Illegal instruction (core dumped)" happened.
root#router:/tmp/target/bin# ./node -v
v4.2.4
root#router:/tmp/target/bin# ./node --v8-options | head -2
target arm v7 vfp3 soft
ARMv7=1 VFP3=1 VFP32DREGS=0 NEON=0 SUDIV=0 UNALIGNED_ACCESSES=1
MOVW_MOVT_IMMEDIATE_LOADS=0 COHERENT_CACHE=0 USE_EABI_HARDFLOAT=0
The tool objdump showed me that there are instructions (such as vpush, vpop...) in use which are not supported by my cpu (arm v7 without fpu).
For the further, I found openssl and v8 in the source of node use fpu's instructions.
the configure line as below
./configure \
--prefix=target \
--dest-cpu=arm \
--dest-os=linux \
--without-snapshot \
--with-arm-float-abi=soft \
--fully-static
Can somebody tell me how to compile node-v4.2.4 without fpu supported?
source code: nodejs-v4.2.2
arm version: Cortex-A9 Floating-Point Unit (FPU)(Optional)
After many tries, I used node-v0.10.14 instead, which works well without fpu supported. ;-)
So I still do not known how to compile nodejs-v4.2.2 without fpu supported.
It's impossible.
V8 does not support no fpu mode since 3.18 (https://github.com/nodejs/node/issues/4447#issuecomment-168549889), the assumption is that the kernel can emulate the FPU for you. And NodeJS is based on V8.
Relavant comment in the source code:
https://github.com/v8/v8/blob/master/src/arm/assembler-arm.cc#L174
It's clarified in v8-users mailing list too.
In Windows you can do:
CSystemInfo info;
this->m_strVersion = info.GetFileVersion( CFileSystemHelper::GetApplicationPath() + _T("/test.exe") );
to get the version number.
How would I do it in C++ on linux ?
Windows adopts a version resource system with standard API support, Linux and UNIX have no such high level concepts for a variety of reasons ranging from legacy to redundancy.
Best options are to query the local packaging system (RPM, APT, etc), or try executing with --version command line parameter which is a recommended GNU standard.
Example RPM query on command line for the Samba tool smbget:
# rpm -q -f /usr/bin/smbget --queryformat '%{version}\n'
3.0.33
You probably want to retrieve the path of the currently executing executable.
On Linux, you could use the /proc/ pseudo-file system. Read the proc(5) man page for more.
Specifically, you probably want to do something like
char myexepath[512];
memset (myexepath, 0, sizeof(myexepath);
readlink ("/proc/self/exe", myexepath, sizeof(myexepath));
(but you really should check for runtime errors above)
If you simply wanted to display the version of a program, you should have a convention about it. Usually accepting --version as the program first argument.
I invite you to read Advanced Linux Programming.