Closed Bug 1459626 Opened 7 years ago Closed 6 years ago

moz_arena_realloc has missing linkage

Categories

(Firefox Build System :: General, defect)

3 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tjr, Assigned: tjr)

References

(Blocks 1 open bug)

Details

The third type of error I am getting for CFI is: > 0:08.67 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.67 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.69 i8* (i64, i8*, i64)* @moz_arena_realloc > 0:08.69 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.69 i8* (i64, i8*, i64)* @moz_arena_realloc > 0:08.69 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.71 i8* (i64, i64, i64)* @moz_arena_calloc > 0:08.71 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.72 i8* (i64, i64, i64)* @moz_arena_calloc > 0:08.72 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:08.73 i8* (i64, i64)* @moz_arena_malloc > 0:08.73 LLVM ERROR: Broken module found, compilation aborted! > 0:08.74 i8* (i64, i64)* @moz_arena_malloc > 0:08.74 LLVM ERROR: Broken module found, compilation aborted! > 0:09.03 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:09.05 i8* (i64, i8*, i64)* @moz_arena_realloc > 0:09.05 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:09.07 i8* (i64, i64, i64)* @moz_arena_calloc > 0:09.08 Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! > 0:09.10 clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
This is when linking what? mozglue or xul?
It looks like it happens when linking auxillary programs. gdb-tests, jsapi-tests, the js shell. I took one at random and dug in a bit: Running command: /builds/worker/my-workspace/build/src/clang/bin/clang++ -B /builds/worker/my-workspace/build/src/gcc/bin -std=gnu++14 -o ../../../dist/bin/gdb-tests -Qunused-arguments -fuse-ld=lld -flto=thin -fsanitize=cfi-icall -fsanitize-blacklist=/builds/worker/my-workspace/build/src/new-cfi-whitelist.txt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE -Qunused-arguments -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-noexcept-type -Wno-unknown-warning-option -Wno-return-type-c-linkage -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fuse-ld=lld -flto=thin -fsanitize=cfi-icall -fsanitize-blacklist=/builds/worker/my-workspace/build/src/new-cfi-whitelist.txt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE -fno-rtti -fno-exceptions -fno-math-errno -pthread -pipe -g -O1 -fno-omit-frame-pointer /builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/js/src/gdb/gdb-tests.list -lpthread -flto=thin -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id -fuse-ld=lld -rdynamic -Wl,-rpath-link,/builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/dist/lib -fcolor-diagnostics ../build/libjs_static.a ../../../config/external/nspr/pr/libnspr4.so ../../../config/external/nspr/libc/libplc4.so ../../../config/external/nspr/ds/libplds4.so -lm -ldl -lrt -lm -ldl -v clang version 6.0.0 (trunk) (llvm/trunk 317840) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /builds/worker/my-workspace/build/src/clang/bin Found candidate GCC installation: /builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.2 Selected GCC installation: /builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/builds/worker/my-workspace/build/src/clang/bin/ld.lld" -export-dynamic --hash-style=both --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o ../../../dist/bin/gdb-tests /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/crtbegin.o -L/builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../.. -L/builds/worker/my-workspace/moz-toolchain/build/stage3/clang/bin/../lib -L/lib -L/usr/lib -plugin /builds/worker/my-workspace/moz-toolchain/build/stage3/clang/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=O1 -plugin-opt=thinlto /builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/js/src/gdb/gdb-tests.list -lpthread -z noexecstack -z text -z relro --build-id -rpath-link /builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/dist/bin -rpath-link /builds/worker/my-workspace/build/src/obj-x86_64-pc-linux-gnu/dist/lib ../build/libjs_static.a ../../../config/external/nspr/pr/libnspr4.so ../../../config/external/nspr/libc/libplc4.so ../../../config/external/nspr/ds/libplds4.so -lm -ldl -lrt -lm -ldl -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /builds/worker/my-workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! i8* (i64, i8*, i64)* @moz_arena_realloc Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! i8* (i64, i64, i64)* @moz_arena_calloc Alias should have private, internal, linkonce, weak, linkonce_odr, weak_odr, or external linkage! i8* (i64, i64)* @moz_arena_malloc LLVM ERROR: Broken module found, compilation aborted! clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) cat gdb-tests.list INPUT("gdb-tests.o") INPUT("Unified_cpp_js_src_gdb0.o") INPUT("../../../mozglue/build/SSE.o") INPUT("../../../mozglue/build/dummy.o") INPUT("../../../memory/build/Unified_cpp_memory_build0.o") INPUT("../../../memory/replace/logalloc/FdPrintf.o") INPUT("../../../memory/replace/logalloc/LogAlloc.o") INPUT("../../../memory/mozalloc/mozalloc_abort.o") INPUT("../../../memory/mozalloc/Unified_cpp_memory_mozalloc0.o") INPUT("../../../mozglue/misc/AutoProfilerLabel.o") INPUT("../../../mozglue/misc/ConditionVariable_posix.o") INPUT("../../../mozglue/misc/Mutex_posix.o") INPUT("../../../mozglue/misc/Printf.o") INPUT("../../../mozglue/misc/StackWalk.o") INPUT("../../../mozglue/misc/TimeStamp.o") INPUT("../../../mozglue/misc/TimeStamp_posix.o") INPUT("../../../mfbt/lz4.o") INPUT("../../../mfbt/Compression.o") INPUT("../../../mfbt/Decimal.o") INPUT("../../../mfbt/Unified_cpp_mfbt0.o") INPUT("../../../mfbt/Unified_cpp_mfbt1.o") listsymbolsearch gdb-tests.list moz_arena_realloc ../../../memory/build/Unified_cpp_memory_build0.o ---------------- W _ZN19DummyArenaAllocatorI9AllocatorI17ReplaceMallocBaseEE17moz_arena_reallocEmPvm ---------------- W _ZN9AllocatorI15MozJemallocBaseE17moz_arena_reallocEmPvm ---------------- W _ZN9AllocatorI17ReplaceMallocBaseE17moz_arena_reallocEmPvm ---------------- T moz_arena_realloc
I compiled with -emit-llvm and used llvm-dis and found the following: > define i8* @moz_arena_realloc(i64 %arg1, i8* %arg2, i64 %arg3) local_unnamed_addr #0 !dbg !6542 { > %call = tail call i8* @_ZN9AllocatorI17ReplaceMallocBaseE17moz_arena_reallocEmPvm(i64 %arg1, i8* %arg2, i64 %arg3), !dbg !6547 > > define linkonce_odr hidden i8* @_ZN9AllocatorI17ReplaceMallocBaseE17moz_arena_reallocEmPvm(i64 %arg1, i8* %arg2, i64 %arg3) local_unnamed_addr #7 comdat align 2 !dbg !6548 { > store i8* (i64, i8*, i64)* @_ZN19DummyArenaAllocatorI9AllocatorI17ReplaceMallocBaseEE17moz_arena_reallocEmPvm, i8* (i64, i8*, i64)** getelementptr inbounds (%struct.malloc_table_t, %struct.malloc_table_t* @_ZL19gReplaceMallocTable, i64 0, i32 19), align 8, !dbg !11385 > > define linkonce_odr hidden i8* @_ZN9AllocatorI15MozJemallocBaseE17moz_arena_reallocEmPvm(i64 %aArenaId, i8* %arg1, i64 %arg2) #7 comdat align 2 !dbg !11803 { > > define linkonce_odr hidden i8* @_ZN19DummyArenaAllocatorI9AllocatorI17ReplaceMallocBaseEE17moz_arena_reallocEmPvm(i64, i8* %arg1, i64 %arg2) #0 comdat align 2 !dbg !13848 { It seems like @moz_arena_realloc is missing a linkage value...
Blocks: 1465549
No longer blocks: cfi
This is https://bugs.llvm.org/show_bug.cgi?id=37625 which has a resolution now.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.