<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 - Need support for the -n, --nmagic option for linux kernel link on AArch64"
   href="https://bugs.llvm.org/show_bug.cgi?id=41522">41522</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Need support for the -n, --nmagic option for linux kernel link on AArch64
          </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>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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLD doesn't currently support the -n, --nmagic option that is now required to
compile the Linux Kernel VDSO shared object (shared object mapped into all
user-space programs to provide support for system calls). The patch to enforce
it:
<a href="https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=691efbedc60d2a7364a90e38882fc762f06f52c4">https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=691efbedc60d2a7364a90e38882fc762f06f52c4</a>

The -n option is similar to the -N, --omagic option that is partially supported
by LLD (<a href="https://reviews.llvm.org/D26888">https://reviews.llvm.org/D26888</a>). My understanding is:
-n (turn off page alignment)
-N (turn off page alignment, do not make text readonly)
LLD does not turn off page alignment with -N but it does apply the "do not make
text readonly" part. 

I suspect that supporting -n may be as simple as aliasing it to
-zmax-page-size=1 but I'll need to double check for any other side-effects in
ld.bfd first. Note that -zmax-page-size=1 doesn't quite do the same thing in
ld.bfd as ld.lld, with ld.bfd the OutputSection alignment is set to whatever
-zmax-page-size= is set to, even if there is an InputSection with a greater
alignment, this can be overridden by the poorly documented ALIGN_WITH_INPUT
optional section attribute. By contrast ld.lld always behaves as if
ALIGN_WITH_INPUT is present. 

The -n, --nmagic is also frequently used by embedded systems for
micro-controllers and other systems that lack a memory management system and
thus have no pages.</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>