Skip to content

Conversation

@limit-ordinal
Copy link

@limit-ordinal limit-ordinal commented Dec 19, 2025

Fixes #2285

Resubmitting this now that all compiler and unit tests are passing and CI has been added.

Changes include:

  • Hints for the linker to find several libc functions. On NetBSD, several of the default libc function names point to compatibility versions, leading to some unexpected behavior unless specific C header files are imported. NetBSD C headers contain macros that will translate references to standard libc function names into calls to the modern (renamed) functions on modern systems, but since we lack access to this from within c3 code, I included the modern function names in @cname attributes when compiling for NetBSD.
  • Struct and constant definitions for sockets, polling, errno, etc.
  • Changes to the linker code to work around some quirks in the NetBSD dynamic linker. In particular, LLVM will sometimes generate an output executable / library with more than two PT_LOAD segments, which the dynamic linker on NetBSD does not support. I added flags when compiling / linking on NetBSD that restrict LLVM to generating two segments.
  • A target triple for netbsd aarch64 so llvm builds/links the compiler properly on this platform

Includes:
- Hints to find non-compatibility libc functions
- Struct and constant definitions for sockets, polling, etc.
- Changes to the linker code to work around some quirks in the NetBSD dynamic linker
- A target triple for netbsd aarch64 so llvm builds/links the compiler properly on this platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to build on NetBSD.

1 participant