LLC.exe cannot produce assembly - windows

I have a very simple C program called simple.c, and I want to use the LLVM toolchain to first produce IR Bitcode, then compile and link the bitcode myself.
This is what I currently do:
clang -O3 -emit-llvm simple.c -c -o simple.bc
llc -filetype=obj simple.bc <---- this is where it fails
simple.c
#include <stdio.h>
int main(void){
printf("Hello, World!\n");
return 0;
}
i can run the code when i compile it directly with clang, and i can run the bitcode with lli, however llc fails with this:
```C:\Users\Dvino\Desktop\hovet\hovet>llc -filetype=obj simple.bc
Stack dump:
0. Program arguments: llc -filetype=obj simple.bc
1. Running pass 'Function Pass Manager' on module 'simple.bc'.
2. Running pass 'Expand Atomic instructions' on function '#main'
#0 0x0fa3aed0 (C:\Windows\SYSTEM32\ucrtbased.dll+0x8aed0)
#1 0x0fa3d9ec (C:\Windows\SYSTEM32\ucrtbased.dll+0x8d9ec)
#2 0x0fa3dfc0 (C:\Windows\SYSTEM32\ucrtbased.dll+0x8dfc0)
#3 0x02800def (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2430def)
#4 0x029a3490 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x25d3490)
#5 0x03f8b086 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x3bbb086)
#6 0x03f8b279 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x3bbb279)
#7 0x03f8ce06 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x3bbce06)
#8 0x03f8dba8 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x3bbdba8)
#9 0x00b84936 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7b4936)
#10 0x00b7b056 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7ab056)
#11 0x00b7b2d6 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7ab2d6)
#12 0x00b78215 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7a8215)
#13 0x00b84df6 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7b4df6)
#14 0x00b86408 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x7b6408)
#15 0x01cc60d8 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x18f60d8)
#16 0x01cc4824 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x18f4824)
#17 0x01afa507 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x172a507)
#18 0x01a11eaf (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x1641eaf)
#19 0x01a0f0f6 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x163f0f6)
#20 0x02739ff3 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2369ff3)
#21 0x02d448e2 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x29748e2)
#22 0x02d44bf4 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2974bf4)
#23 0x02d45d52 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2975d52)
#24 0x02d46595 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2976595)
#25 0x02d3ff8d (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x296ff8d)
#26 0x006781a6 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2a81a6)
#27 0x00678ed2 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x2a8ed2)
#28 0x044cde5e (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x40fde5e)
#29 0x044cdcf7 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x40fdcf7)
#30 0x044cdb8d (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x40fdb8d)
#31 0x044cded8 (C:\Users\Dvino\Desktop\hovet\hovet\llc.exe+0x40fded8)
#32 0x750f8494 (C:\Windows\System32\KERNEL32.DLL+0x18494)
#33 0x777f41c8 (C:\Windows\SYSTEM32\ntdll.dll+0x641c8)
#34 0x777f4198 (C:\Windows\SYSTEM32\ntdll.dll+0x64198)
```

Related

Program received SIGSEGV - invalid memory reference

I wrote a small linker in fortran-cpp to read a file with some numbers.
$cat mainProg.f
program fprogram
real*8 c(30)
do i=1,30
c(i) = i * 1.0
end do
print*,"Before calling cpp function"
c PASS ARRAY "C" TO CPP
call pass_to_cpp(c)
print*,"After calling cpp function"
do i=1,30
print*,' c =',c(i)
end do
print*,"I'm done here ..!!"
c stop
end
and,
$cat cprog.C
#include<iostream>
#include<cmath>
#include<fstream>
using namespace std;
extern "C" {
void pass_to_cpp_(double *c);
}
void pass_to_cpp_(double *c)
{
ifstream myfile ("example.txt");
for(int i=0; i<30; i++)
{
myfile >> c[i];
cout <<"called = " << i << "\n";
}
}
I am building this on ubuntu 16.04 to be run on a windows machine. I am usin mingw for compiling.
Here is the error on windows:
called = 0
Program received a signal SIGSEGV: Segmentation fault - invalid memory reference
Backtrace for this error:
#0 ffffffffffffff
#1 ffffffffffffff
#2 ffffffffffffff
#3 ffffffffffffff
#4 ffffffffffffff
#5 ffffffffffffff
#6 ffffffffffffff
#7 ffffffffffffff
#8 ffffffffffffff
#9 ffffffffffffff
#10 ffffffffffffff
#11 ffffffffffffff
#12 ffffffffffffff
#13 ffffffffffffff
#14 ffffffffffffff
#15 ffffffffffffff
File 'example.txt' is a simple file with 30 numbers.
Any suggestions on what is the cause of the error?
I compiled with this:
$ x86_64-w64-mingw32-gfortran -c main_read.f
$ x86_64-w64-mingw32-g++ -c cread.C
$ x86_64-w64-mingw32-gfortran -o read.exe main_read.o cread.o -lstdc++ -static
If I dont use -static, it complains 'libgfortran3.dll not found'.

How Get llvm Library in Go?

My OS is GNU/Ubuntu 16.10- 64bit.
i also report this to GoLang.
https://github.com/golang/go/issues/19444
$ go get llvm.org/llvm/bindings/go/llvm
package llvm.org/llvm/bindings/go/llvm: unrecognized import path "llvm.org/llvm/bindings/go/llvm" (parse https://llvm.org/llvm/bindings/go/llvm?go-get=1: no go-import meta tags ())
$ go get llvm.org/llvm/bindings
package llvm.org/llvm/bindings: unrecognized import path "llvm.org/llvm/bindings" (parse https://llvm.org/llvm/bindings?go-get=1: no go-import meta tags ())
so go get say not parse https://llvm.org/llvm/bindings?go-get=1
in browser also https://llvm.org/ not open.(HTTPS)
Not Found
The requested URL / was not found on this server.
Apache/2.2.22 (Ubuntu) Server at llvm.org Port 443
but http://llvm.org is good.(HTTP)
how can get this libs for GoLang?
==================
Try github.com/go-llvm/llgo :
guest#system:~/go/src/github.com/go-llvm/llgo$ ./llgo-go.sh build
can't load package: package github.com/go-llvm/llgo: no buildable Go source files in /home/guest/go/src/github.com/go-llvm/llgo
guest#system:~/go/src/github.com/go-llvm/llgo$ ./llgo-go.sh install
can't load package: package github.com/go-llvm/llgo: no buildable Go source files in /home/guest/go/src/github.com/go-llvm/llgo
guest#system:~/go/src/github.com/go-llvm/llgo$ ./llgo-go.sh install
can't load package: package github.com/go-llvm/llgo: no buildable Go source files in /home/guest/go/src/github.com/go-llvm/llgo
guest#system:~/go/src/github.com/go-llvm/llgo$ make
./update_clang.sh
can't load package: package llvm.org/llvm/bindings/go/llvm: cannot find package "llvm.org/llvm/bindings/go/llvm" in any of:
/usr/lib/go-1.8/src/llvm.org/llvm/bindings/go/llvm (from $GOROOT)
/home/guest/go/src/llvm.org/llvm/bindings/go/llvm (from $GOPATH)
Makefile:25: recipe for target 'workdir/.update-clang-stamp' failed
make: *** [workdir/.update-clang-stamp] Error 1
guest#system:~/go/src/github.com/go-llvm/llgo$ export PATH=/path/to/gcc-inst/bin:$PATH
guest#system:~/go/src/github.com/go-llvm/llgo$ export LD_LIBRARY_PATH=/path/to/gcc-inst/lib64:$LD_LIBRARY_PATH
guest#system:~/go/src/github.com/go-llvm/llgo$ export CC=`which gcc`
guest#system:~/go/src/github.com/go-llvm/llgo$ export CXX=`which g++`
guest#system:~/go/src/github.com/go-llvm/llgo$ export LIBGO_CFLAGS=--gcc-toolchain=/path/to/gcc-inst
guest#system:~/go/src/github.com/go-llvm/llgo$ go get -d github.com/go-llvm/llgo/cmd/gllgo
package llvm.org/llvm/bindings/go/llvm: unrecognized import path "llvm.org/llvm/bindings/go/llvm" (parse https://llvm.org/llvm/bindings/go/llvm?go-get=1: no go-import meta tags ())
package golang.org/x/tools/go/exact: cannot find package "golang.org/x/tools/go/exact" in any of:
/usr/lib/go-1.8/src/golang.org/x/tools/go/exact (from $GOROOT)
/home/guest/go/src/golang.org/x/tools/go/exact (from $GOPATH)
package golang.org/x/tools/go/gccgoimporter: cannot find package "golang.org/x/tools/go/gccgoimporter" in any of:
/usr/lib/go-1.8/src/golang.org/x/tools/go/gccgoimporter (from $GOROOT)
/home/guest/go/src/golang.org/x/tools/go/gccgoimporter (from $GOPATH)
package golang.org/x/tools/go/importer: cannot find package "golang.org/x/tools/go/importer" in any of:
/usr/lib/go-1.8/src/golang.org/x/tools/go/importer (from $GOROOT)
/home/guest/go/src/golang.org/x/tools/go/importer (from $GOPATH)
guest#system:~/go/src/github.com/go-llvm/llgo$ $GOPATH/src/llvm.org/llvm/bindings/go/build.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
bash: /home/guest/go/src/llvm.org/llvm/bindings/go/build.sh: No such file or directory
guest#system:~/go/src/github.com/go-llvm/llgo$
$ go version
go version go1.8 linux/amd64
$ cmake -version
cmake version 3.8.20170216-gb9229
CMake suite maintained and supported by Kitware (kitware.com/cmake).
guest#system:~/go/src/github.com/go-llvm/llvm$ ./update_llvm.sh
+ llvm_components=all-targets analysis asmparser asmprinter bitreader bitwriter codegen core debuginfo executionengine instrumentation interpreter ipo irreader linker mc mcjit objcarcopts option profiledata scalaropts support target
+ dirname ./update_llvm.sh
+ gollvmdir=.
+ grep run_update_llvm_sh_to_get_revision_ ./llvm_dep.go
+ sed -E -e s/.*run_update_llvm_sh_to_get_revision_([0-9]+.*)/\1/g
+ llvmrev=218171
+ workdir=./workdir
+ llvmdir=./workdir/llvm
+ llvm_builddir=./workdir/llvm_build
+ mkdir -p ./workdir
+ svn co -r 218171 https://llvm.org/svn/llvm-project/llvm/trunk ./workdir/llvm
Checked out revision 218171.
+ mkdir -p ./workdir/llvm_build
+ cmake_flags=../llvm
+ llvm_config=./workdir/llvm_build/bin/llvm-config
+ which ninja
+ test -n /usr/bin/ninja
+ cd ./workdir/llvm_build
+ cmake -G Ninja ../llvm
-- Target triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx disabled.
CMake Warning (dev) at cmake/modules/HandleLLVMOptions.cmake:131 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "C_SUPPORTS_FPIC" will no longer be dereferenced when
the policy is set to NEW. Since the policy is not set the OLD behavior
will be used.
Call Stack (most recent call first):
cmake/modules/HandleLLVMOptions.cmake:148 (add_flag_or_print_warning)
CMakeLists.txt:315 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting AArch64
-- Targeting ARM
-- Targeting CppBackend
-- Targeting Hexagon
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting R600
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting X86
-- Targeting XCore
-- Configuring done
-- Generating done
-- Build files have been written to: /home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build
+ ninja -C ./workdir/llvm_build llvm-config
ninja: Entering directory `./workdir/llvm_build'
[2/2] Linking CXX executable bin/llvm-config
+ ./workdir/llvm_build/bin/llvm-config --libs all-targets analysis asmparser asmprinter bitreader bitwriter codegen core debuginfo executionengine instrumentation interpreter ipo irreader linker mc mcjit objcarcopts option profiledata scalaropts support target
+ sed -e s/-l//g
+ llvm_buildtargets=LLVMOption LLVMObjCARCOpts LLVMMCJIT LLVMRuntimeDyld LLVMLinker LLVMIRReader LLVMipo LLVMVectorize LLVMInterpreter LLVMInstrumentation LLVMExecutionEngine LLVMDebugInfo LLVMBitWriter LLVMAsmParser LLVMXCoreDisassembler LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo LLVMXCoreAsmPrinter LLVMX86Disassembler LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter LLVMX86Utils LLVMSystemZDisassembler LLVMSystemZCodeGen LLVMSystemZAsmParser LLVMSystemZDesc LLVMSystemZInfo LLVMSystemZAsmPrinter LLVMSparcDisassembler LLVMSparcCodeGen LLVMSparcAsmParser LLVMSparcDesc LLVMSparcInfo LLVMSparcAsmPrinter LLVMR600CodeGen LLVMR600Desc LLVMR600Info LLVMR600AsmPrinter LLVMPowerPCDisassembler LLVMPowerPCCodeGen LLVMPowerPCAsmParser LLVMPowerPCDesc LLVMPowerPCInfo LLVMPowerPCAsmPrinter LLVMNVPTXCodeGen LLVMNVPTXDesc LLVMNVPTXInfo LLVMNVPTXAsmPrinter LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMSP430AsmPrinter LLVMMipsDisassembler LLVMMipsCodeGen LLVMMipsAsmParser LLVMMipsDesc LLVMMipsInfo LLVMMipsAsmPrinter LLVMHexagonCodeGen LLVMHexagonAsmPrinter LLVMHexagonDesc LLVMHexagonInfo LLVMCppBackendCodeGen LLVMCppBackendInfo LLVMARMDisassembler LLVMARMCodeGen LLVMARMAsmParser LLVMARMDesc LLVMARMInfo LLVMARMAsmPrinter LLVMAArch64Disassembler LLVMMCDisassembler LLVMAArch64CodeGen LLVMSelectionDAG LLVMAsmPrinter LLVMCodeGen LLVMScalarOpts LLVMProfileData LLVMObject LLVMBitReader LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMCore LLVMAArch64AsmParser LLVMMCParser LLVMAArch64Desc LLVMAArch64Info LLVMAArch64AsmPrinter LLVMMC LLVMAArch64Utils LLVMSupport
+ ninja -C ./workdir/llvm_build LLVMOption LLVMObjCARCOpts LLVMMCJIT LLVMRuntimeDyld LLVMLinker LLVMIRReader LLVMipo LLVMVectorize LLVMInterpreter LLVMInstrumentation LLVMExecutionEngine LLVMDebugInfo LLVMBitWriter LLVMAsmParser LLVMXCoreDisassembler LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo LLVMXCoreAsmPrinter LLVMX86Disassembler LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter LLVMX86Utils LLVMSystemZDisassembler LLVMSystemZCodeGen LLVMSystemZAsmParser LLVMSystemZDesc LLVMSystemZInfo LLVMSystemZAsmPrinter LLVMSparcDisassembler LLVMSparcCodeGen LLVMSparcAsmParser LLVMSparcDesc LLVMSparcInfo LLVMSparcAsmPrinter LLVMR600CodeGen LLVMR600Desc LLVMR600Info LLVMR600AsmPrinter LLVMPowerPCDisassembler LLVMPowerPCCodeGen LLVMPowerPCAsmParser LLVMPowerPCDesc LLVMPowerPCInfo LLVMPowerPCAsmPrinter LLVMNVPTXCodeGen LLVMNVPTXDesc LLVMNVPTXInfo LLVMNVPTXAsmPrinter LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMSP430AsmPrinter LLVMMipsDisassembler LLVMMipsCodeGen LLVMMipsAsmParser LLVMMipsDesc LLVMMipsInfo LLVMMipsAsmPrinter LLVMHexagonCodeGen LLVMHexagonAsmPrinter LLVMHexagonDesc LLVMHexagonInfo LLVMCppBackendCodeGen LLVMCppBackendInfo LLVMARMDisassembler LLVMARMCodeGen LLVMARMAsmParser LLVMARMDesc LLVMARMInfo LLVMARMAsmPrinter LLVMAArch64Disassembler LLVMMCDisassembler LLVMAArch64CodeGen LLVMSelectionDAG LLVMAsmPrinter LLVMCodeGen LLVMScalarOpts LLVMProfileData LLVMObject LLVMBitReader LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMCore LLVMAArch64AsmParser LLVMMCParser LLVMAArch64Desc LLVMAArch64Info LLVMAArch64AsmPrinter LLVMMC LLVMAArch64Utils LLVMSupport FileCheck
ninja: Entering directory `./workdir/llvm_build'
ninja: no work to do.
+ ./workdir/llvm_build/bin/llvm-config --version
+ llvm_version=3.6.0svn
+ ./workdir/llvm_build/bin/llvm-config --cppflags
+ llvm_cflags=-I/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm/include -I/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
+ uname
+ [ Linux == Darwin ]
./update_llvm.sh: 59: [: Linux: unexpected operator
+ ./workdir/llvm_build/bin/llvm-config --ldflags
+ ./workdir/llvm_build/bin/llvm-config --libdir
+ ./workdir/llvm_build/bin/llvm-config --libs all-targets analysis asmparser asmprinter bitreader bitwriter codegen core debuginfo executionengine instrumentation interpreter ipo irreader linker mc mcjit objcarcopts option profiledata scalaropts support target
+ ./workdir/llvm_build/bin/llvm-config --system-libs
+ llvm_ldflags=-L/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build//lib -Wl,-rpath,/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build//lib -lLLVMOption -lLLVMObjCARCOpts -lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMLinker -lLLVMIRReader -lLLVMipo -lLLVMVectorize -lLLVMInterpreter -lLLVMInstrumentation -lLLVMExecutionEngine -lLLVMDebugInfo -lLLVMBitWriter -lLLVMAsmParser -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMObject -lLLVMBitReader -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lrt -ldl -ltinfo -latomic -lpthread -lz
+ sed -e s##LLVM_REVISION##218171#g; s##LLVM_CFLAGS##-I/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm/include -I/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS#g; s##LLVM_LDFLAGS##-L/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build//lib -Wl,-rpath,/home/guest/go/src/github.com/go-llvm/llvm/workdir/llvm_build//lib -lLLVMOption -lLLVMObjCARCOpts -lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMLinker -lLLVMIRReader -lLLVMipo -lLLVMVectorize -lLLVMInterpreter -lLLVMInstrumentation -lLLVMExecutionEngine -lLLVMDebugInfo -lLLVMBitWriter -lLLVMAsmParser -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMObject -lLLVMBitReader -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lrt -ldl -ltinfo -latomic -lpthread -lz#g ./llvm_config.go.in
+ printf package llvm\n\nconst Version = "%s"\n 3.6.0svn
guest#system:~/go/src/github.com/go-llvm/llvm/examples$ cd factorial
guest#system:~/go/src/github.com/go-llvm/llvm/examples/factorial$ ls
factorial factorial.go
guest#system:~/go/src/github.com/go-llvm/llvm/examples/factorial$ go build factorial.go
guest#system:~/go/src/github.com/go-llvm/llvm/examples/factorial$ ./factorial
; ModuleID = 'fac_module'
define i32 #fac(i32) {
entry:
%cmptmp = icmp eq i32 %0, 0
br i1 %cmptmp, label %end, label %iffalse
iffalse: ; preds = %entry
%subtmp = add i32 %0, -1
%calltmp = call i32 #fac(i32 %subtmp)
%multmp = mul i32 %calltmp, %0
br label %end
end: ; preds = %entry, %iffalse
%result = phi i32 [ %multmp, %iffalse ], [ 1, %entry ]
ret i32 %result
}
-----------------------------------------
Running fac(10) with JIT...
Result: 3628800
DONE
guest#system:~$ go get llvm.org/llvm.v36/bindings/go/llvm
package llvm.org/llvm.v36/bindings/go/llvm: unrecognized import path "llvm.org/llvm.v36/bindings/go/llvm" (parse https://llvm.org/llvm.v36/bindings/go/llvm?go-get=1: no go-import meta tags ())
guest#system:~$ go get -d llvm.org/llvm.v36/bindings/go/llvm
package llvm.org/llvm.v36/bindings/go/llvm: unrecognized import path "llvm.org/llvm.v36/bindings/go/llvm" (parse https://llvm.org/llvm.v36/bindings/go/llvm?go-get=1: no go-import meta tags ())
$ which llvm-config
/usr/bin/llvm-config
guest#system:~/go/src/github.com/go-llvm/llvm/workdir/llvm_build/bin$ ls
FileCheck llvm-config llvm-lit llvm-tblgen
guest#system:~/go/src/github.com/axw/llgo$ ./update_third_party.sh
github.com/axw/llgo$ ./update_third_party.sh
Cloning into '/tmp/update_third_party.auPNC9/gofrontend'...
remote: Sending approximately 92.68 MiB ...
remote: Counting objects: 3087, done
remote: Finding sources: 100% (69/69)
remote: Total 33940 (delta 26755), reused 33933 (delta 26755)
Receiving objects: 100% (33940/33940), 92.79 MiB | 60.00 KiB/s, done.
Resolving deltas: 100% (26755/26755), done.
Checking connectivity... done.
Note: checking out '81eb6a3f425b2158c67ee32c0cc973a72ce9d6be'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 81eb6a3... runtime: don't overallocate in select code
patching file libgo/runtime/chan.goc
patching file libgo/runtime/chan.h
patching file libgo/runtime/heapdump.c
patching file libgo/runtime/malloc.goc
patching file libgo/runtime/malloc.h
Hunk #1 succeeded at 392 (offset 2 lines).
Hunk #2 succeeded at 403 (offset 2 lines).
Hunk #3 succeeded at 460 (offset 2 lines).
Hunk #4 succeeded at 478 (offset 2 lines).
Hunk #5 succeeded at 507 (offset 2 lines).
patching file libgo/runtime/mcache.c
patching file libgo/runtime/mcentral.c
patching file libgo/runtime/mgc0.c
Hunk #3 succeeded at 1380 (offset 2 lines).
Hunk #4 succeeded at 1390 (offset 2 lines).
Hunk #5 succeeded at 1804 (offset 2 lines).
Hunk #6 succeeded at 2151 (offset 4 lines).
Hunk #7 succeeded at 2428 (offset 5 lines).
Hunk #8 succeeded at 2443 (offset 5 lines).
Hunk #9 succeeded at 2451 (offset 5 lines).
patching file libgo/runtime/mheap.c
patching file libgo/runtime/netpoll.goc
patching file libgo/runtime/proc.c
Hunk #1 succeeded at 326 (offset 24 lines).
Hunk #2 succeeded at 809 (offset 100 lines).
Hunk #3 succeeded at 820 (offset 100 lines).
Hunk #4 succeeded at 847 (offset 100 lines).
Hunk #5 succeeded at 855 (offset 100 lines).
Hunk #6 succeeded at 864 (offset 100 lines).
Hunk #7 succeeded at 881 (offset 100 lines).
Hunk #8 succeeded at 894 (offset 100 lines).
Hunk #9 succeeded at 933 (offset 100 lines).
Hunk #10 succeeded at 953 (offset 100 lines).
Hunk #11 succeeded at 987 (offset 100 lines).
Hunk #12 succeeded at 1011 (offset 100 lines).
Hunk #13 succeeded at 1452 (offset 106 lines).
Hunk #14 succeeded at 1481 (offset 106 lines).
Hunk #15 succeeded at 1525 (offset 106 lines).
Hunk #16 succeeded at 1618 (offset 106 lines).
Hunk #17 succeeded at 1673 (offset 106 lines).
Hunk #18 succeeded at 1709 (offset 106 lines).
Hunk #19 succeeded at 1730 (offset 106 lines).
Hunk #20 succeeded at 1749 (offset 106 lines).
Hunk #21 succeeded at 1794 (offset 106 lines).
Hunk #22 succeeded at 1832 (offset 106 lines).
Hunk #23 succeeded at 1928 (offset 106 lines).
Hunk #24 succeeded at 2031 (offset 106 lines).
Hunk #25 succeeded at 2159 (offset 106 lines).
Hunk #26 succeeded at 2184 (offset 106 lines).
Hunk #27 succeeded at 2192 (offset 106 lines).
Hunk #28 succeeded at 2484 (offset 119 lines).
Hunk #29 succeeded at 2595 (offset 119 lines).
Hunk #30 succeeded at 2627 (offset 119 lines).
Hunk #31 succeeded at 2657 (offset 119 lines).
Hunk #32 succeeded at 2682 (offset 119 lines).
Hunk #33 succeeded at 2826 (offset 119 lines).
Hunk #34 succeeded at 2906 (offset 126 lines).
Hunk #35 succeeded at 3044 (offset 126 lines).
Hunk #36 succeeded at 3080 (offset 126 lines).
Hunk #37 succeeded at 3112 (offset 126 lines).
Hunk #38 succeeded at 3268 (offset 126 lines).
Hunk #39 succeeded at 3422 (offset 126 lines).
patching file libgo/runtime/runtime.h
patching file libgo/runtime/sema.goc
patching file libgo/runtime/sigqueue.goc
patching file libgo/runtime/time.goc
patching file libgo/Makefile.am
Hunk #1 succeeded at 4139 (offset 401 lines).
Hunk #2 succeeded at 4246 (offset 409 lines).
patching file libgo/Makefile.in
Hunk #1 succeeded at 2433 (offset 221 lines).
Hunk #2 succeeded at 2540 (offset 229 lines).
patching file libgo/go/runtime/mfinal_test.go
Hunk #1 succeeded at 65 (offset 3 lines).
cp: cannot stat '../../cmake/config.guess': No such file or directory
how can fix?

Why doesn't 'ld' warn when linking '-mthumb-only' object files without '-mthumb'?

In my setup using gcc-arm-none-eabi 4.8 and binutils 2.26 I get pretty undefined behavior when compiling the object files separately with -mthumb but leaving that flag out in the final linking step using ld without getting any warning from the linker. Why is that the case?
The undefined behavior is probably (according to the very helpful FOSS developers I have asked first) due to the default multilib architecture chosen by the linker due to the lack of the flag. However, why doesn't the linker warn about this issue? Can't it easily detect the ISA of the linked functions from the object and library files to determine that something fishy is going on?
Ideally yes it should know from the objects being linked. Disassemble and examine the interaction between functions of different objects.
I was recently trying to demonstrate how good the gnu tools/linker was at adding trampolines. When it consistently failed miserably. It would put the trampoline in for you for one direction but not the other (thumb to/from arm). I think this was an assembly to/from C issue and I didnt use a plethera of directives like the compiler uses, so that was probably it.
Fairly simple to setup some test cases, make an object out of functions built for arm, make another out of functions built for thumb, have them call each other. Put enough structure around it to get the tools to link without error and then disassemble and examine.
armstart.s
.global _start
_start:
bl notmain
b hang
hang: b .
notmain.c
extern unsigned int one ( unsigned int );
int notmain ( void )
{
one(1);
return(0);
}
one.c
extern unsigned int two ( unsigned int x );
unsigned int one ( unsigned int x )
{
return(two(x+5));
}
two.c
extern unsigned int one ( unsigned int x );
unsigned int two ( unsigned int x )
{
return(one(x+7));
}
Makefile
ARMGNU = arm-none-eabi
#ARMGNU = arm-linux-gnueabi
AOPS = --warn --fatal-warnings
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding
all : notmain.bin
clean:
rm -f *.bin
rm -f *.o
rm -f *.elf
rm -f *.list
rm -f *.bc
rm -f *.opt.s
rm -f *.norm.s
rm -f *.hex
armstart.o : armstart.s
$(ARMGNU)-as $(AOPS) armstart.s -o armstart.o
notmain.o : notmain.c
$(ARMGNU)-gcc $(COPS) -c notmain.c -o notmain.o
two.o : two.c
$(ARMGNU)-gcc $(COPS) -mthumb -c two.c -o two.o
one.o : one.c
$(ARMGNU)-gcc $(COPS) -c one.c -o one.o
notmain.bin : memmap armstart.o notmain.o one.o two.o
$(ARMGNU)-ld -o notmain.elf -T memmap armstart.o notmain.o one.o two.o
$(ARMGNU)-objdump -D notmain.elf > notmain.list
$(ARMGNU)-objcopy notmain.elf notmain.hex -O ihex
$(ARMGNU)-objcopy notmain.elf notmain.bin -O binary
some of the disassembly:
20000024 <one>:
20000024: e92d4010 push {r4, lr}
20000028: e2800005 add r0, r0, #5
2000002c: eb000007 bl 20000050 <__two_from_arm>
20000030: e8bd4010 pop {r4, lr}
20000034: e12fff1e bx lr
20000038 <two>:
20000038: b510 push {r4, lr}
2000003a: 3007 adds r0, #7
2000003c: f000 f804 bl 20000048 <__one_from_thumb>
20000040: bc10 pop {r4}
20000042: bc02 pop {r1}
20000044: 4708 bx r1
20000046: 46c0 nop ; (mov r8, r8)
20000048 <__one_from_thumb>:
20000048: 4778 bx pc
2000004a: 46c0 nop ; (mov r8, r8)
2000004c: eafffff4 b 20000024 <one>
20000050 <__two_from_arm>:
20000050: e59fc000 ldr ip, [pc] ; 20000058 <__two_from_arm+0x8>
20000054: e12fff1c bx ip
20000058: 20000039 andcs r0, r0, r9, lsr r0
2000005c: 00000000 andeq r0, r0, r0
And the toolchain in this case
arm-none-eabi-gcc (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(binutils 2.26.20160125)
Worked quite nicely.
Likewise with gcc 5.4.0 and binutils 2.26.1.
Looking at the differences between readelf for the two objects we see for example:
< 00000004 00000a1d R_ARM_JUMP24 00000000 two
---
> 00000004 00000a0a R_ARM_THM_CALL 00000000 one
compiling the object files separately with -mthumb but leaving that flag out in the final linking step using ld without getting any warning from the linker. Why is that the case?
The resulting executable file should work fine on most ARM platforms except for the microcontroller profiles (Cortex-M). There is even a good reason to mix thumb code with ARM libraries: Code size.

How to build cmake 3.1.3 using clang 3.6.0 and libc++?

I'm trying to build cmake 3.1.3 using clang and its own c++ library, i.e:
export CC=clang
export CXX=clang++
export CXXFLAGS="-std=c++11 -stdlib=libc++"
export LDFLAGS="-lc++ -lc++abi"
followed by
./bootstrap
However, this does not work due to the way the bootstrap script tests the CXX compiler. If I hack the bootstrap file and add the LDFLAGS to the CXX test I can start to compile cmake. However, once I reach the bootstrap stage, the compile cmake binary is broken. What am I doing wrong?
Using Angew's idea and trying to compile with the existing cmake installation actually gets you a bit farther: If you use almost the same exports as above:
export CC=clang
export CXX=clang++
export CXXFLAGS="-std=c++11 -stdlib=libc++"
export LDFLAGS="-L${COMPILERROOT}/lib -lc++ -lc++abi"
and a little sed to get around a weird compilation error (assuming you are in a different build directory and you extracted the cmake sources to the directory ../cmake from the current one)
sed -i s/kwsys_ios::hex/cmsys_ios::istringstream::hex/g ../cmake/Source/kwsys/SystemInformation.cxx
sed -i s/kwsys_ios::dec/cmsys_ios::istringstream::dec/g ../cmake/Source/kwsys/SystemInformation.cxx
You can then compile cmake via:
cmake ../cmake/ -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}
make -j${NPROC}
make install
It still crashed for example if I try to cmake a Cern ROOT6 install:
This warning is for project developers. Use -Wno-dev to suppress it.
uncaught_exception not yet implemented
Program received signal SIGABRT, Aborted.
0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
#1 0x00007ffff6e4acf8 in abort () from /lib64/libc.so.6
#2 0x00007ffff7b755a5 in std::uncaught_exception() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#3 0x00007ffff7ba80fd in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#4 0x0000000000531561 in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) ()
#5 0x0000000000530c8c in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) ()
#6 0x000000000052fccb in cmakemainMessageCallback(char const*, char const*, bool&, void*) ()
#7 0x00000000007527c9 in cmSystemTools::Message(char const*, char const*) ()
#8 0x000000000085c934 in cmake::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cmListFileBacktrace const&) ()
#9 0x000000000062a756 in cmMakefile::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const ()
#10 0x00000000009c56cb in cmConditionEvaluator::GetDefinitionIfUnquoted(cmExpandedCommandArgument const&) const ()
#11 0x00000000009c57fd in cmConditionEvaluator::GetVariableOrString(cmExpandedCommandArgument const&) const ()
#12 0x00000000009c0600 in cmConditionEvaluator::HandleLevel2(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#13 0x00000000009bce3b in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#14 0x00000000009bdd5e in cmConditionEvaluator::HandleLevel0(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#15 0x00000000009bcd91 in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#16 0x00000000009d902b in cmIfCommand::InvokeInitialPass(std::__1::vector<cmListFileArgument, std::__1::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#17 0x000000000062b4d6 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#18 0x000000000098ffb1 in cmForEachFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmMakefile&, cmExecutionStatus&) ()
#19 0x000000000062c5cb in cmMakefile::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()
#20 0x000000000062b21c in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#21 0x0000000000630242 in cmMakefile::ReadListFile(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool) ()
#22 0x00000000005cbad4 in cmLocalGenerator::ReadInputFile() ()
#23 0x00000000005cb437 in cmLocalGenerator::Configure() ()
#24 0x0000000000ca2af8 in cmLocalUnixMakefileGenerator3::Configure() ()
#25 0x0000000000bf3df6 in cmGlobalGenerator::Configure() ()
#26 0x0000000000c44edd in cmGlobalUnixMakefileGenerator3::Configure() ()
#27 0x000000000084c49e in cmake::ActualConfigure() ()
#28 0x0000000000849b24 in cmake::Configure() ()
#29 0x0000000000850efa in cmake::Run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, bool) ()
#30 0x000000000052f665 in do_cmake(int, char const* const*) ()
#31 0x000000000052c149 in main ()
However, if I add the -Wno-dev option to the cmake call it works fine.

g++ "value temporarily unavailable, due to optimizations"

I'm getting some "value temporarily unavailable, due to optimizations" problems, but I am compiling with debug enabled, as far as I know.
I.e. I'm using -g -O0 -fno-inline flags, so I'm not sure why is this still happening. Is it some flag I missed?
Compiler is g++-mp-4.6 (GCC) 4.6.3, OS is OSX 10.6 Darwin Palace-of-the-Nine-Moons.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
Full compile options are g++-mp-4.6 -Wall -Werror -Wno-unused -g -O0 -fno-inline -I/usr/local/include -I../allig -std=c++0x -c src/Toolbox.cpp -o o/Toolbox.o for every file.
gdb session:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000021
[Switching to process 23874]
0x0000000100035d64 in al_get_bitmap_width ()
(gdb) bt
#0 0x0000000100035d64 in al_get_bitmap_width ()
#1 0x0000000100005e47 in Icon::resize (this=0x101244530, w=<value temporarily unavailable, due to optimizations>, h=<value temporarily unavailable, due to optimizations>) at ../allig/Icon.cpp:24
#2 0x0000000100005e1f in Icon::create_icon (this=0x101244530, _icon_size=<value temporarily unavailable, due to optimizations>) at ../allig/Icon.cpp:20
#3 0x000000010000ae24 in Icontainer::add_icon (this=0x101244210, tt=0x101244530) at ../allig/Icontainer.cpp:18
#4 0x0000000100002d58 in _al_mangled_main (argc=1, argv=0x7fff5fbff600) at src/mapedit.cpp:202
#5 0x000000010009ff17 in +[AllegroAppDelegate app_main:] ()
#6 0x00007fff82d45114 in __NSThread__main__ ()
#7 0x00007fff81f4afd6 in _pthread_start ()
#8 0x00007fff81f4ae89 in thread_start ()
(gdb) up
#1 0x0000000100005e47 in Icon::resize (this=0x101244530, w=<value temporarily unavailable, due to optimizations>, h=<value temporarily unavailable, due to optimizations>) at ../allig/Icon.cpp:24
24 ow=al_get_bitmap_width(icon);
Current language: auto; currently c++
[...]
(gdb) up
#2 0x0000000100005e1f in Icon::create_icon (this=0x101244530, _icon_size=<value temporarily unavailable, due to optimizations>) at ../allig/Icon.cpp:20
20 resize(_icon_size,_icon_size);
(gdb) print _icon_size
$2 = <value temporarily unavailable, due to optimizations>
(gdb) up
#3 0x000000010000ae24 in Icontainer::add_icon (this=0x101244210, tt=0x101244530) at ../allig/Icontainer.cpp:18
18 tt->create_icon(icon_size);
(gdb) print icon_size
$3 = 32 ' '
(gdb) quit
code snippets:
void Icon::resize (unsigned char w, unsigned char h) {
unsigned short ow,oh;
ow=al_get_bitmap_width(icon);
up
void Icon::create_icon (unsigned char _icon_size) {
resize(_icon_size,_icon_size);
}
up
int Icontainer::add_icon (Icon *tt) {
int ret=icons.size();
tt->tool=TOOL_TILE;
tt->create_icon(icon_size);
finally here the icon size was available.

Resources