On Sat, Jul 05, 2025 at 20:16:17 +0000, ci4ic4 wrote:

> You may have noticed that recently ziglang.org started publishing
> NetBSD compiler sets for aarch64, arm, x86 and x86-64. The aarch64
> one works fine for me (as well as the self-built one), but it still
> uses the LLVM backend, as far as I understand it. The i386 version
> works as expected, ditto for the backend. The x86-64 version stopped
> working for some time, presumably around the time it switched to a
> native backend.
> 
> Can anyone suggest a possible reason for this? The problem is
> tracked here: https://github.com/ziglang/zig/issues/24341 .

Sounds like the fallout from the changes in current.  I think the
discussion starts around here:

https://mail-index.netbsd.org/tech-userlevel/2023/01/05/msg013666.html

| Our dynamic linker ld_elf.so in map_object.c currently can only
| handle 2 PT_LOAD segments (one for text and one for data); the
| kernel elf loader does not have this limitation, it can load
| multiple PT_LOAD segment.  The following patch (from FreeBSD)
| removes this limitation from the dynamic linker.  The reason I made
| this patch now is that the latest binutils (2.39) for amd64 sets a
| maxinum pagesize of 2Mb, and when using relocation read only
| binaries (ld -z relro) this will cause the binaries to have an extra
| 2Mbytes for alignment.  This can be fixed by building binutils to
| set a separate code segment by default (ld -z separate-code).
| Binutils then sets the maximum page size to 4Kb.  Setting this
| option creates 4 PT_LOAD segments, two for text (r--, r-x) and two
| for data (r--, rw-), which also improves security.  This is the
| default for linux on x86 and the patch also makes it the default for
| NetBSD x86.  The patch also adds -z noseparate-code to the kernel
| builds so that we don't need to fix the boot loaders.  I am planning
| to commit this soon, so please let me know if you hsve any
| objections.

-uwe

Reply via email to