build: fix sigsetjmp issues and ensure required libs on Linux
1. Handle `sigsetjmp` platform differences:
- Separate `sigsetjmp` linkage to platform-specific files.
- Use `__sigsetjmp` on Linux to handle `sigsetjmp` being a macro.
- Maintain original implementation for Darwin.
2. Ensure linking of required libs:
- Explicitly link against fundamental libs (e.g., libm, libatomic).
- Address the fact that typical Linux linkers don't link these by
default.
This commit is contained in:
@@ -356,6 +356,8 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, llFiles
|
||||
"-rpath", "$ORIGIN",
|
||||
"-rpath", "$ORIGIN/../lib",
|
||||
"-Xlinker", "--gc-sections",
|
||||
"-lm",
|
||||
"-latomic",
|
||||
"-lpthread", // libpthread is built-in since glibc 2.34 (2021-08-01); we need to support earlier versions.
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user