diff options
| author | pg <[email protected]> | 2025-07-09 23:35:43 +0300 |
|---|---|---|
| committer | pg <[email protected]> | 2025-07-09 23:50:04 +0300 |
| commit | fe6a7eafb85bb6cdb3610636f458610d4f978e15 (patch) | |
| tree | cdcd4638e225ad51632036bdff37a41f991c59e4 | |
| parent | d4edd65117ec282a0fcaf67eaa56c42665dd72d8 (diff) | |
```
pg:~/1/contrib/tools/yasm ya make -r --target-platform=default-freebsd-x86_64
Ok
```
commit_hash:d44f7e6e2ed31611ad352069a9289f448f29632a
| -rw-r--r-- | build/conf/linkers/ld.conf | 2 | ||||
| -rw-r--r-- | build/platform/lld/ya.make | 5 | ||||
| -rw-r--r-- | build/ymake.core.conf | 5 | ||||
| -rwxr-xr-x | build/ymake_conf.py | 24 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxx/ya.make | 2 |
5 files changed, 34 insertions, 4 deletions
diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf index ab172b1aac0..9f732877462 100644 --- a/build/conf/linkers/ld.conf +++ b/build/conf/linkers/ld.conf @@ -96,7 +96,7 @@ elsewhen ($OS_ANDROID == "yes") { _LD_USE_STDLIB=-nostdlib++ } } -elsewhen ($OS_LINUX == "yes" || $OS_DARWIN == "yes" || $OS_IOS == "yes") { +elsewhen ($OS_LINUX == "yes" || $OS_DARWIN == "yes" || $OS_IOS == "yes" || $OS_FREEBSD == "yes") { _LD_USE_STDLIB=-nodefaultlibs } diff --git a/build/platform/lld/ya.make b/build/platform/lld/ya.make index 79536a33b50..568b9c652f1 100644 --- a/build/platform/lld/ya.make +++ b/build/platform/lld/ya.make @@ -48,6 +48,11 @@ ELSEIF (OS_LINUX) # add build-id to binaries to allow external tools check equality of binaries -Wl,--build-id=sha1 ) +ELSEIF (OS_FREEBSD) + LDFLAGS( + -fuse-ld=lld + --ld-path=${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld.lld + ) ELSEIF (OS_DARWIN OR OS_IOS) LDFLAGS( -fuse-ld=lld diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 97b5a3243e2..313ede55843 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -382,6 +382,11 @@ when ($OS_DARWIN == "yes") { } # tag:allocator +when ($OS_FREEBSD == "yes") { + DEFAULT_ALLOCATOR=SYSTEM +} + +# tag:allocator when ($OS_LINUX == "yes") { when ($GCC) { # tcmalloc broken build diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 33b80f5ec2d..14b1a188e4b 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -160,6 +160,9 @@ class Platform(object): assert self.is_32_bit or self.is_64_bit assert not (self.is_32_bit and self.is_64_bit) + self.is_freebsd = self.os == 'freebsd' + self.is_freebsd_x86_64 = self.is_freebsd and self.is_x86_64 + self.is_linux = self.os == 'linux' or 'yocto' in self.os self.is_linux_x86_64 = self.is_linux and self.is_x86_64 self.is_linux_armv8 = self.is_linux and self.is_armv8 @@ -187,7 +190,7 @@ class Platform(object): self.is_none = self.os == 'none' - self.is_posix = self.is_linux or self.is_apple or self.is_android or self.is_yocto + self.is_posix = self.is_linux or self.is_apple or self.is_android or self.is_yocto or self.is_freebsd @staticmethod def from_json(data): @@ -207,9 +210,14 @@ class Platform(object): yield 'LINUX' yield 'OS_LINUX' + if self.is_freebsd: + yield 'FREEBSD' + yield 'OS_FREEBSD' + if self.is_macos: yield 'DARWIN' yield 'OS_DARWIN' + if self.is_iossim: yield 'IOS' yield 'OS_IOS' @@ -1193,6 +1201,8 @@ class GnuToolchain(Toolchain): target_triple = self.tc.triplet_opt.get(target.arch, None) if not target_triple: target_triple = select(default=None, selectors=[ + (target.is_freebsd and target.is_x86_64, 'x86_64-freebsd-unknown'), + (target.is_linux and target.is_x86_64, 'x86_64-linux-gnu'), (target.is_linux and target.is_armv8, 'aarch64-linux-gnu'), (target.is_linux and target.is_armv6 and target.armv6_float_abi == 'hard', 'armv6-linux-gnueabihf'), @@ -1306,6 +1316,9 @@ class GnuToolchain(Toolchain): if target.is_apple: self.setup_apple_sdk(target) + if target.is_freebsd: + self.setup_freebsd_sdk_impl(project='build/internal/platform/freebsd', var='${FREEBSD_SDK_RESOURCE_GLOBAL}') + if self.tc.is_from_arcadia or self.tc.is_system_cxx: if target.is_linux: if not tc.os_sdk_local: @@ -1324,6 +1337,11 @@ class GnuToolchain(Toolchain): if target.is_yocto: self.setup_sdk(project='build/platform/yocto_sdk/yocto_sdk', var='${YOCTO_SDK_ROOT_RESOURCE_GLOBAL}') + def setup_freebsd_sdk_impl(self, project, var): + self.platform_projects.append(project) + self.c_flags_platform.append('--sysroot') + self.c_flags_platform.append(var) + def setup_apple_sdk(self, target): if not self.tc.os_sdk_local: self.setup_apple_arcadia_sdk(target) @@ -1640,7 +1658,7 @@ class Linker(object): # Android toolchain is NDK, LLD works on all supported platforms return Linker.LLD - elif self.build.target.is_linux or self.build.target.is_macos or self.build.target.is_ios or self.build.target.is_wasm: + elif self.build.target.is_linux or self.build.target.is_macos or self.build.target.is_ios or self.build.target.is_wasm or self.build.target.is_freebsd: return Linker.LLD # There is no linker choice on Windows (link.exe) @@ -1703,6 +1721,8 @@ class LD(Linker): if self.musl.value: self.ld_flags.extend(['-Wl,--no-as-needed']) + elif target.is_freebsd: + self.ld_flags.extend(['-lc', '-lm', '-lpthread', '-Wl,--no-as-needed']) elif target.is_linux: self.ld_flags.extend(['-ldl', '-lrt', '-Wl,--no-as-needed']) if self.tc.is_gcc: diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index f79aff9a161..5b56e018e25 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -33,7 +33,7 @@ ELSEIF (OS_IOS) PEERDIR( contrib/libs/cxxsupp/builtins ) -ELSEIF (OS_LINUX OR OS_DARWIN) +ELSEIF (OS_LINUX OR OS_DARWIN OR OS_FREEBSD) IF (ARCH_ARM6 OR ARCH_ARM7) # libcxxrt support for ARM is currently broken, use libcxxabi instead SET(CXX_RT "libcxxabi") |
