[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
Tue May 7 08:54:21 PDT 2019


peter.smith added a comment.

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.


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

https://reviews.llvm.org/D61201





More information about the llvm-commits mailing list