[PATCH] D30770: Ensure that prefix data is preserved with subsections-via-symbols
Moritz Angermann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 05:50:22 PDT 2017
angerman reopened this revision.
angerman added a comment.
This revision is now accepted and ready to land.
So I've been playing with LLVM5 and GHC, and it seems like this solution is insufficient :-/ I've boiled this down to the following:
let `lib.ll`
define void @f() prefix i32 123 {
ret void
}
and `dont-dead_strip-prefix-data.ll` be
declare void @f();
define i32 @main() {
%f = bitcast void ()* @f to i32*
%prefix_ptr = getelementptr inbounds i32, i32* %f, i32 -1
%prefix_val = load i32, i32* %prefix_ptr
%1 = icmp eq i32 %prefix_val, 123
%2 = xor i1 %1, true
%3 = zext i1 %2 to i32
ret i32 %3
}
This is almost identical to the example from before, only now we split this over two objects.
clang -c lib.ll -o lib.o
clang dont-dead_strip-prefix-data.ll lib.o -o dont-dead_strip-prefix-data -dead_stip && ./dont-dead_strip-prefix-data
Thus I believe we need a temporary global symbol instead.
Repository:
rL LLVM
https://reviews.llvm.org/D30770
More information about the llvm-commits
mailing list