[PATCH] D61201: [LLD][ELF] Full support for -n (--nmagic) and -N (--omagic)

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 08:52:40 PDT 2019


peter.smith added a comment.

In D61201#1493631 <https://reviews.llvm.org/D61201#1493631>, @peter.smith wrote:

> In D61201#1491977 <https://reviews.llvm.org/D61201#1491977>, @MaskRay wrote:
>
> > https://sourceware.org/bugzilla/show_bug.cgi?id=24505 doesn't get a response, but I researched the users of `CONSTANT(...)`:
> >
> > `CONSTANT(COMMONPAGESIZE)`: 2 users: edk2, u-boot
> >  `CONSTANT(MAXPAGESIZE)`: 1 user: fuchsia zircon, but they don't use -n or -N
> >
> > u-boot and fuchsia zircon don't seem to use -n or -N. edk2 is probably the only project that uses both `-n/-N` and `CONSTANT(...)`. It has `DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20`
> >
> > We probably shouldn't be constrained by ld.bfd's behavior for this single user,
> >  if making `MaxPageSize` and `PageSize` to 1 makes our implementation simpler.
> >
> > The potential users can make straightforward changes to adapt to lld's behavior: change `CONSTANT(COMMONPAGESIZE)` to a literal constant.
>
>
> I'll make an alternative implementation that in effect implements -z common-page, and have -n/-N set it to 1 and will post as a separate review. It will probably be of similar complexity to this. In the example above it does look to be using -z common-page-size and CONSTANT(COMMONPAGESIZE) as a way of passing a parameter to the linker script.


I've implemented the alternative with the max and common page size set to 1 in D61688 <https://reviews.llvm.org/D61688> . I'll leave this open as I think the complexity of the implementation is similar.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61201/new/

https://reviews.llvm.org/D61201





More information about the llvm-commits mailing list