https://bugs.llvm.org/show_bug.cgi?id=41522

            Bug ID: 41522
           Summary: Need support for the -n, --nmagic option for linux
                    kernel link on AArch64
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedb...@nondot.org
          Reporter: peter.sm...@linaro.org
                CC: llvm-bugs@lists.llvm.org, peter.sm...@linaro.org

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:
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=691efbedc60d2a7364a90e38882fc762f06f52c4

The -n option is similar to the -N, --omagic option that is partially supported
by LLD (https://reviews.llvm.org/D26888). 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to