[PATCH] D118840: [ELF] Support (TYPE=<value>) to customize the output section type

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 17 17:27:00 PST 2022


MaskRay added a comment.

In D118840#3331173 <https://reviews.llvm.org/D118840#3331173>, @nathanchance wrote:

> I have not done a bisect but it seems likely that this change breaks linking modules for the arm64 Linux kernel, is this expected?
>
>   $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper defconfig all
>   ...
>   ld.lld: error: section type mismatch for .plt
>   >>> <internal>:(.plt): SHT_PROGBITS
>   >>> output section .plt: SHT_NOBITS
>   ...
>
> I believe the `.plt` handling in the linker script comes from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/include/asm/module.lds.h?h=v5.17-rc4.

I do not know whether we want to remove the error for `NOLOAD`.

`.plt 0 (NOLOAD) : { BYTE(0) }` looks questionable to me. 
Seems that it needs `/DISCARD/ : { *(.plt) }` if it just wants to leave a one-byte `.plt` but ignoring the regular `.plt`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118840



More information about the llvm-commits mailing list