[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 11:36:00 PST 2024


nathanchance wrote:

I took this for a spin against the Linux kernel and immediately found two problems, although they do not appears to be strictly related to this pull request.

It appears that I introduced the first issue in commit [2b2a25845d53](https://git.kernel.org/linus/2b2a25845d534ac6d55086e35c033961fdd83a26) ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO"):

```
ld.lld: error: unknown argument '-fPIC'
make[4]: *** [arch/s390/kernel/vdso64/Makefile:53: arch/s390/kernel/vdso64/vdso64.so.dbg] Error 1
```

I think the solution is just to remove this altogether:

```diff
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index e3c9085f8fa7..caa4ebff8a19 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -26,7 +26,7 @@ KBUILD_AFLAGS_64 += -m64
 KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
 KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
 KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
-ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
+ldflags-y := -shared -soname=linux-vdso64.so.1 \
             --hash-style=both --build-id=sha1 -T

 $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
```

I am unsure about the second issue, which is that the `__bug_table` section is mergeable and writable, which is unsupported by `ld.lld`:

```
ld.lld: error: fs/ext4/crypto.o:(__bug_table): writable SHF_MERGE section is not supported
```

This was changed by commit [e21f8baf8d9a](https://git.kernel.org/linus/e21f8baf8d9a452a09a9cf7c8ab4720ff9a891ef) ("s390/bug: add entry size to the __bug_table section"), which explicitly mentions this, so I am not sure if we can revert that, although there may be a better way? I think this section needs to stay writable for `clear_once_table()`?

https://github.com/llvm/llvm-project/pull/75643


More information about the llvm-commits mailing list