Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need support for the -n, --nmagic option for linux kernel link on AArch64 #40867

Closed
smithp35 opened this issue Apr 17, 2019 · 1 comment
Closed
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate lld:ELF

Comments

@smithp35
Copy link
Collaborator

Bugzilla Link 41522
Resolution DUPLICATE
Resolved on Apr 17, 2019 03:21
Version unspecified
OS Linux
CC @smithp35

Extended Description

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.

@smithp35
Copy link
Collaborator Author

Looks like this a duplicate of pr40542, I'll merge any new information and resolve this one.

*** This bug has been marked as a duplicate of bug #39888 ***

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate lld:ELF
Projects
None yet
Development

No branches or pull requests

1 participant