[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 19901] New: The plugin can drop a symbol gold has asked for
From:       bugzilla-daemon () llvm ! org
Date:       2014-05-30 20:28:03
Message-ID: bug-19901-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

--1401481683.42aA2F2.28286
Date: Fri, 30 May 2014 15:28:03 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"

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

            Bug ID: 19901
           Summary: The plugin can drop a symbol gold has asked for
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: gold-plugin
          Assignee: unassignedbugs@nondot.org
          Reporter: rafael.espindola@gmail.com
                CC: llvmbugs@cs.uiuc.edu, nlewycky@google.com
    Classification: Unclassified

$ cat test.ll
define linkonce_odr void @f() {
  ret void
}
$ cat test2.ll
define i32 @main() {
  call void @f()
  ret i32 0
}
define linkonce_odr void @f() {
  ret void
}
$ llc test2.ll -o test2.o -filetype=obj
$ llvm-as test.ll -o test.o
$ clang -flto test.o test2.o -o test
$ ./test
Segmentation fault

What is going on is:

gold decides to keep the 'f' defined in the IR file and tells the plugin that.
The plugin calls lto_codegen_add_must_preserve_symbol, but that does nothing
since the symbol is linkonce_odr and the IR linker will not copy it in if it is
not needed (from its narrow point of view).

The fix for the the gold plugin is clear if a bit laborious: apply the
restrictions to the unmerged module. If we are told to keep a symbol, change
the linkage to make sure we do. If we are told to drop a symbol, drop it before
even passing it down to the IR linker.

I will test this on OS X with ld64 in a sec.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

--1401481683.42aA2F2.28286
Date: Fri, 30 May 2014 15:28:03 -0500
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"

<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 --- - The plugin can drop a symbol gold has asked for"
   href="http://llvm.org/bugs/show_bug.cgi?id=19901">19901</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The plugin can drop a symbol gold has asked for
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>gold-plugin
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs&#64;nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rafael.espindola&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs&#64;cs.uiuc.edu, nlewycky&#64;google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat test.ll
define linkonce_odr void &#64;f() {
  ret void
}
$ cat test2.ll
define i32 &#64;main() {
  call void &#64;f()
  ret i32 0
}
define linkonce_odr void &#64;f() {
  ret void
}
$ llc test2.ll -o test2.o -filetype=obj
$ llvm-as test.ll -o test.o
$ clang -flto test.o test2.o -o test
$ ./test
Segmentation fault

What is going on is:

gold decides to keep the 'f' defined in the IR file and tells the plugin that.
The plugin calls lto_codegen_add_must_preserve_symbol, but that does nothing
since the symbol is linkonce_odr and the IR linker will not copy it in if it is
not needed (from its narrow point of view).

The fix for the the gold plugin is clear if a bit laborious: apply the
restrictions to the unmerged module. If we are told to keep a symbol, change
the linkage to make sure we do. If we are told to drop a symbol, drop it before
even passing it down to the IR linker.

I will test this on OS X with ld64 in a sec.</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>

--1401481683.42aA2F2.28286--


_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic