[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
Wed Mar 8 20:17:10 PST 2017


angerman added a comment.

In https://reviews.llvm.org/D30770#696262, @pcc wrote:

> Test case?


I guess I need some guidance here, in putting the testfile together properly:

Using the following `dont-dead_strip-prefix-data.ll`

  define i32 @main() prefix i32 123 {
   %main = bitcast i32 ()* @main to i32*
   %prefix_ptr = getelementptr inbounds i32, i32* %main, 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
  }



  $ clang dont-dead_strip-prefix-data.ll -o dont-dead_strip-prefix-data -dead_strip && ./dont-dead_strip-prefix-data

will exit with `1` without the patch, and `0` with the patch.


https://reviews.llvm.org/D30770





More information about the llvm-commits mailing list