[Pkg-clamav-devel] Uploading 0.98.7+dfsg-4

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Thu Nov 26 23:01:09 UTC 2015


Hi Sebastian,

On 24.11.2015 23:45, Sebastian Andrzej Siewior wrote:
> The build failed on ppc due to llvm. All testcases segfaulted. yay.

:-(

> I looked at ppc build log 0.98.7+dfsg-4+b1 vs 0.99~rc2+dfsg-1 and we had
> libllvm3.6v5 1:3.6.2-3 on both and gcc slightly changed:
>  g++-5_5.2.1-23 
>  g++-5_5.2.1-24 (exp build)
> 
> The diff between the two version limited to what I believe makes piece
>   git diff debian-0.98.7+dfsg-4..debian-0.99_rc2+dfsg-1 libclamav/c++
> 
> does not show much changes. Just the SSL flags got in there.

The most important change between 0.98.7+dfsg-4+b1 and 0.99~rc2+dfsg-1 is
that in the latter the bytecode tests are actually run, while they aren't
in the former.

So it's even worse than you thought: 0.98.7+dfsg-4+b1 is also broken on powerpc.
I verified that by building current unstable branch, where the check patch
is fixed, on powerpc. It also fails with these segfaults.

It seems to me that LLVM's MCJIT is totally broken on powerpc, i.e. it
always segfaults. Attached is a simple test case demonstrating this:
 * on amd64:
$ make clean && make && ./test
rm -f test test.o
g++ -Wall -g -std=c++11 -I/usr/include/llvm-3.6/ -I/usr/include/llvm-c-3.6 -DLLVM_VERSION=36 -DUSE_MCJIT=0 -DUSE_FINALIZE=1 -DNDEBUG   -c -o test.o test.cpp
cc -L/usr/lib/llvm-3.6/lib  test.o  -lLLVM-3.6 -lstdc++  -o test
LLVM module:
---------
; ModuleID = 'test'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define i32 @test() {
EntryBlock:
  ret i32 1
}
---------
verifying... 
starting test() with JIT...
Result: 1

 * on powerpc:
$ make clean && make && ./test
rm -f test test.o
g++ -Wall -g -std=c++11 -I/usr/include/llvm-3.6/ -I/usr/include/llvm-c-3.6 -DLLVM_VERSION=36 -DUSE_MCJIT=0 -DUSE_FINALIZE=1 -DNDEBUG   -c -o test.o test.cpp
cc -L/usr/lib/llvm-3.6/lib  test.o  -lLLVM-3.6 -lstdc++  -o test
Invalid data memory access: 0x10a2a6e8
[...]
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

This works with the JIT engine from LLVM 3.5, but the MCJIT engine from
LLVM 3.5 also segfaults.

The crash happens in 'EE->finalizeObject()' with the following backtrace:
Program received signal SIGSEGV, Segmentation fault.
llvm::RuntimeDyldELF::resolveRelocation (this=0x1002be10, RE=..., Value=17759874762048788080)
    at /build/llvm-toolchain-3.6-K5PWDp/llvm-toolchain-3.6-3.6.2/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:858
858	                           RE.SymOffset);
(gdb) bt
#0  llvm::RuntimeDyldELF::resolveRelocation (this=0x1002be10, RE=..., Value=17759874762048788080)
    at /build/llvm-toolchain-3.6-K5PWDp/llvm-toolchain-3.6-3.6.2/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:858
#1  0x0f57d440 in llvm::RuntimeDyldELF::resolveRelocation (this=<optimized out>, this at entry=<error reading variable: PC not saved>, Section=..., Offset=<optimized out>, 
    Value=<optimized out>, Type=<optimized out>, Addend=189247323900, SymOffset=18446744056529682432)
    at /build/llvm-toolchain-3.6-K5PWDp/llvm-toolchain-3.6-3.6.2/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:864

I have no idea how to fix LLVM.
We could work around this problem by using LLVM 3.5 on powerpc, but that is
no long term solution.

Best regards,
Andreas

-------------- next part --------------
LLVM     := 3.6
MCJIT    := 0
FINALIZE := 1

LLVM_VERSION=$(shell echo $(LLVM) | sed 's/\.//')

CXXFLAGS := -Wall -g -std=c++11 -I/usr/include/llvm-$(LLVM)/ -I/usr/include/llvm-c-$(LLVM) -DLLVM_VERSION=$(LLVM_VERSION) -DUSE_MCJIT=$(MCJIT) -DUSE_FINALIZE=$(FINALIZE) -DNDEBUG
LDLIBS := -lLLVM-$(LLVM) -lstdc++ $(LDLIBS)
LDFLAGS := -L/usr/lib/llvm-$(LLVM)/lib

EXAMPLES=test
OBJS=$(addsuffix .o,$(EXAMPLES))

.phony: all clean

all: $(OBJS) $(EXAMPLES)

clean:
	$(RM) $(EXAMPLES) $(OBJS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 1902 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-clamav-devel/attachments/20151127/7aa0dc80/attachment.cpp>


More information about the Pkg-clamav-devel mailing list