<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59793>59793</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang appends an extra string to Grub2 making it not work with MBR systems
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          immolo
      </td>
    </tr>
</table>

<pre>
    Using Gentoo with clang on a MBR system I have come across an extra string the content `/lib/ld-linux.so.2` is being added to `/usr/lib/grub/i386-pc/diskboot.img` and `/usr/lib/grub/i386-pc/boot.img` taking it over 512 bytes meaning it can't be used on a MBR system.

You can use `truncate` to remove the extra string then it will install and boot correctly but I am highlighting this here in hopes of a better fix.

Steps to reproduce in Gentoo:

1. Use a clang stage3 on MBR system.
2. emerge -va sys-boot/grub
3. grub-install /dev/sda

Error:

`Installing for i386-pc plaftorm.`
`grub-install: error: diskboot.img size must be 512 bytes.`

I'm not really sure what files I can attach to help debugging this one but if you can think of any please ask for them.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2TozYQ_TXi0mUKizGMDxxma-MtH3JJag85NtCAYiFR6pY9zq9PCXs8ziSHXERR6tcf7z01MpvRETVq903tvmcYZfKhMfPsrc9a31-bn2zcCD_IifdwMTJBZ9GN4B0g_PrtN-ArC81whAnPBJ2fCbALnhnQAb1LQGAJKYlM6d4JOQFVFUofrGnT2W-scfE9Z59rVRVgGFpKCOx76kH8PTxyeIDGENPHlK_VZumUPvSGT633kpt5TEnQ9f8H9gwRPKWqRsCfKcBuq6G9CjHMhO5-06FTuhZoCSJT_5WHXBXfVfF2O__wMcWnwNSKhOg6FFpLeQg0-zOtrHylyaVKF2MtGMeC1q7TpFah8yFQJ_YKbRQ4As4wmXGyZpzkhjYMEwUC42DyCzH4ARBaEqEAg3n_R4u_Cy1862YJvo_dirvJrcq359BtDj-ZAO8GYMGRyjT_v6bXOdBMYSTYnDFdbVLrH-yvIWUO6WfzMV8SkM5KH7jH56K_hODDl0ZUVRxvsDTw4APc5YTF4iA-zHkS_iP2uY4q34DuKeHZMcDmL4I58qrsQ_mnROt5VLqewXmBQGjtFTgGgsuEAoOxxHBcBUcR7KZE60R2gZ7aOI4PdbyjVTwzwPXuEJmMO61CuSssljARzad1OJlozrO-Kft9uceMmm1V67qoav2aTU293RcvFRaIhS731A91vd13r31Z07bGqsxMowtdFtuiLIqXnX7NS631MLQay7Krh32lXgqa0djc2vOc-zBmhjlSs9vX-zKz2JLldUFo7egC66XSOu2L0CTMpo0jq5fCGhb-zCJGLDU3s-CykOv_YyV4-BFiq2F-PL1E7sWH023ZfHqLsxhsM4ksnPygD8lPRqbY5p2f0wO354_PZgn-T-qS5dZ2WenDOs7fAQAA__-Drpyt">