[llvm-bugs] [Bug 27651] New: Link will change global value order
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 5 01:24:58 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27651
Bug ID: 27651
Summary: Link will change global value order
Product: libraries
Version: 3.8
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Linker
Assignee: unassignedbugs at nondot.org
Reporter: xiulipan at outlook.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
We are using a module as library and link the source code in the library and
when the source code has some blocks there are some bugs with the global value.
In debug version the ~Module will assert.
Here is llvm ir for global values before link and after link:
Before link:
@_NSConcreteGlobalBlock = external global i8*
@.str = private unnamed_addr addrspace(2) constant [9 x i8] c"i12@?0i8\00",
align 1
@__block_descriptor_tmp = internal constant { i64, i64, i8 addrspace(2)*, i8
addrspace(2)* } { i64 0, i64 32, i8 addrspace(2)* getelementptr inbounds ([9 x
i8], [9 x i8] addrspace(2)* @.str, i32 0, i32 0), i8 addrspace(2)* null }
@__block_literal_global = internal constant { i8**, i32, i32, i8*,
%struct.__block_descriptor* } { i8** @_NSConcreteGlobalBlock, i32 1342177280,
i32 0, i8* bitcast (i32 (i8*, i32)* @__test_block_invoke to i8*),
%struct.__block_descriptor* bitcast ({ i64, i64, i8 addrspace(2)*, i8
addrspace(2)* }* @__block_descriptor_tmp to %struct.__block_descriptor*) },
align 8
After link:
@__block_literal_global = internal constant { i8**, i32, i32, i8*,
%struct.__block_descriptor* } { i8** @_NSConcreteGlobalBlock, i32 1342177280,
i32 0, i8* bitcast (i32 (i8*, i32)* @__test_block_invoke to i8*),
%struct.__block_descriptor* bitcast ({ i64, i64, i8 addrspace(2)*, i8
addrspace(2)* }* @__block_descriptor_tmp to %struct.__block_descriptor*) },
align 8
@_NSConcreteGlobalBlock = external global i8*
@__block_descriptor_tmp = internal constant { i64, i64, i8 addrspace(2)*, i8
addrspace(2)* } { i64 0, i64 32, i8 addrspace(2)* getelementptr inbounds ([9 x
i8], [9 x i8] addrspace(2)* @.str, i32 0, i32 0), i8 addrspace(2)* null }
@.str = private unnamed_addr addrspace(2) constant [9 x i8] c"i12@?0i8\00",
align 1
As the global valve orders change, the dependency of these global values are
messed.
It seems the bug was caused by ModuleLinker::linkIfNeeded with a recursion call
but with a wrong order.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160505/220e3638/attachment-0001.html>
More information about the llvm-bugs
mailing list