<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - llvm-extract alters linkage of symbols"
   href="http://llvm.org/bugs/show_bug.cgi?id=15567">15567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-extract alters linkage of symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bruce.mitchener@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10221" name="attach_10221" title="Example C file for the bug">attachment 10221</a> <a href="attachment.cgi?id=10221&action=edit" title="Example C file for the bug">[details]</a></span>
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"

-@.str = private unnamed_addr constant [21 x i8] c"Going to delete foo.\00",
align 1
-@.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
-}
+@.str = hidden unnamed_addr constant [21 x i8] c"Going to delete foo.\00",
align 1
+@.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'</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>