<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ld64.lld.darwinnew-linked Chromium Framework is somewhat crashy"
   href="https://bugs.llvm.org/show_bug.cgi?id=48657">48657</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ld64.lld.darwinnew-linked Chromium Framework is somewhat crashy
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>MachO
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Repro:

1. Download
<a href="https://drive.google.com/file/d/1j6_f55jX1WYjwrDSmQYbr_X043mLG9L2/view?usp=sharing">https://drive.google.com/file/d/1j6_f55jX1WYjwrDSmQYbr_X043mLG9L2/view?usp=sharing</a>

2. Unpack, cd chromium_framework

3. `ld @response.txt` (this will write its output in the right place below
Chromium.app, which is also in the zip)

4. `Chromium.app/Contents/MacOS/Chromium --single-process` to start the browser
(without `--single-process` is fine too, but it's easier to catch the crash in
lldb with the flag)

5. Go to <a href="https://www.pinterest.com/hclev073/asdf/">https://www.pinterest.com/hclev073/asdf/</a> and scroll down a bit

6. Go to 2 and repeat, but this time link with ld64.lld.darwinnew

Expected: Works just as well with lld as with ld

Actual: Crashes with lld after scrolling for less than a second.


(But: lld.darwinnew can now link Chromium and produce a mostly-working binary!
And it links it over 4x as fast as ld64 O_O)




Note to self: Repro zip created this way:

0. Build `chrome`, `rm
'out/gn/obj/chrome/chrome_framework_shared_library/Chromium Framework'`

1. `LLD_REPRODUCE=chromium_framework.tar ninja -C out/gn
'obj/chrome/chrome_framework_shared_library/Chromium Framework'`

2. `cd out/gn`

3. `open chromium_framework.tar`

4. `cd chromium_framework`

5. `cp -R ../Chromium.app .`

6. `vim response.txt`, delete the `--color-diagnostics` line, change the `-o`
line to `-o "./Chromium.app/Contents/Frameworks/Chromium
Framework.framework/Versions/Current/Chromium Framework"`

7. zip up chromium_framework again

(App bundles are common on macOS, and I wonder if we can teach lld some flag to
make creating repro zips with app bundles less manual. But in this case we have
a framework bundle nested in an app bundle and the binary is copied (well,
hard-linked) to the right place in a step that runs after the actual link, so
that's maybe tricky. Maybe a LLD_REPRODUCE_CONTAINING_DIR=Chromium.app
LLD_REPRODUCE_OUTPUT_PATH_IN_CONTAINING_DIR='Chromium.app/Contents/Frameworks/Chromium
Framework.framework/Versions/Current/Chromium Framework' and then lld could
figure it out from that?)</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>