[LLVMbugs] [Bug 15567] New: llvm-extract alters linkage of symbols

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 21 18:50:55 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15567

            Bug ID: 15567
           Summary: llvm-extract alters linkage of symbols
           Product: new-bugs
           Version: 3.2
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bruce.mitchener at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10221
  --> http://llvm.org/bugs/attachment.cgi?id=10221&action=edit
Example C file for the bug

I've reproduced this with the 3.2 release.

If you take a simple program like the attached extract.c and compile it:

    clang -emit-llvm -o extract.bc -c extract.c

And then decide that you want to delete the 'foo' symbol from it:

    llvm-extract -delete -func=foo -o failed.bc extract.bc

Things that were previously private linkage are now hidden visibility instead:

    llvm-dis failed.bc
    llvm-dis extract.bc

And then diffing the 2 .ll files:

--- extract.ll    2013-03-22 08:42:09.000000000 +0700
+++ failed.ll    2013-03-22 08:42:06.000000000 +0700
@@ -1,14 +1,9 @@
-; ModuleID = 'extract.bc'
+; ModuleID = 'failed.bc'
 target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.8.0"

- at .str = private unnamed_addr constant [21 x i8] c"Going to delete foo.\00",
align 1
- at .str1 = private unnamed_addr constant [14 x i8] c"Hello, world\0A\00", align
1
-
-define void @foo() nounwind uwtable ssp {
-  %1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([21 x i8]*
@.str, i32 0, i32 0))
-  ret void
-}
+ at .str = hidden unnamed_addr constant [21 x i8] c"Going to delete foo.\00",
align 1
+ at .str1 = hidden unnamed_addr constant [14 x i8] c"Hello, world\0A\00", align 1

 declare i32 @printf(i8*, ...)

So we can see that .str and .str1 went from 'private unnamed_addr constant' to
'hidden unnamed_addr constant'

-- 
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/20130322/9a6d2b89/attachment.html>


More information about the llvm-bugs mailing list