Nixpkgs overlay
parent
4c1beb7946
commit
837b701018
@ -1,43 +1,45 @@
|
||||
{ nixpkgs ? import <nixpkgs>
|
||||
, system ? { config = "x86_64-unknown-genode"; }
|
||||
}:
|
||||
{ nixpkgs ? import <nixpkgs>, system ? { config = "x86_64-unknown-genode"; } }:
|
||||
|
||||
with builtins;
|
||||
|
||||
let
|
||||
nixpkgs' = nixpkgs
|
||||
{ crossSystem = system // { useLLVM = true; };
|
||||
config.allowUnsupportedSystem = true;
|
||||
nixpkgs' = nixpkgs {
|
||||
config.allowUnsupportedSystem = true;
|
||||
crossSystem = {
|
||||
isx86_64 = true;
|
||||
isGenode = true;
|
||||
imports = [ ./platform.nix ];
|
||||
};
|
||||
overlays = [ (import ./overlay) ];
|
||||
};
|
||||
|
||||
portIncludes = ports: listToAttrs
|
||||
( map
|
||||
( name:
|
||||
let port = getAttr name ports; in
|
||||
{ name = name + "_include";
|
||||
value = getAttr "include" port;
|
||||
}
|
||||
)
|
||||
(attrNames ports)
|
||||
);
|
||||
portIncludes = ports:
|
||||
listToAttrs (map (name:
|
||||
let port = getAttr name ports;
|
||||
in {
|
||||
name = name + "_include";
|
||||
value = getAttr "include" port;
|
||||
}) (attrNames ports));
|
||||
|
||||
toolchain = import ./tool/toolchain.nix;
|
||||
in
|
||||
rec {
|
||||
in rec {
|
||||
inherit toolchain;
|
||||
nixpkgs = nixpkgs';
|
||||
|
||||
dhall = import ./dhall { inherit nixpkgs; };
|
||||
|
||||
upstream = import ./upstream { inherit nixpkgs toolchain; };
|
||||
upstream = import ./upstream { inherit nixpkgs; };
|
||||
|
||||
ports = import ./ports { inherit nixpkgs toolchain upstream; };
|
||||
|
||||
libretro = import ./libretro { inherit nixpkgs upstream toolchain; inherit (ports) stdcxx libc; };
|
||||
libretro = import ./libretro {
|
||||
inherit nixpkgs upstream toolchain;
|
||||
inherit (ports) stdcxx libc;
|
||||
};
|
||||
|
||||
shell = import ./shell.nix
|
||||
{ inherit nixpkgs toolchain;
|
||||
dhallPackages = dhall;
|
||||
pkgs = { inherit upstream ports; };
|
||||
};
|
||||
shell = import ./shell.nix {
|
||||
inherit nixpkgs toolchain;
|
||||
dhallPackages = dhall;
|
||||
pkgs = { inherit upstream ports; };
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
set(GENODE 1)
|
||||
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
|
||||
set(CMAKE_C_LINK_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE} "-pie")
|
||||
set(CMAKE_C_LINK_OPTIONS_NO_PIE "-no-pie")
|
||||
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
|
||||
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
|
||||
|
||||
# Disable the stack protector until a later stage of LLVM migration
|
||||
set(CMAKE_C_FLAGS "-fno-stack-protector")
|
||||
set(CMAKE_CXX_FLAGS "-fno-stack-protector")
|
||||
|
||||
# Shared libraries with no builtin soname may not be linked safely by
|
||||
# specifying the file path.
|
||||
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
|
||||
|
||||
# Initialize C link type selection flags. These flags are used when
|
||||
# building a shared library, shared module, or executable that links
|
||||
# to other libraries to select whether to use the static or shared
|
||||
# versions of the libraries.
|
||||
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
|
||||
set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
|
||||
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
|
||||
endforeach()
|
@ -0,0 +1,83 @@
|
||||
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
||||
index 6391f35684..f2ab802fb5 100644
|
||||
--- a/bfd/config.bfd
|
||||
+++ b/bfd/config.bfd
|
||||
@@ -554,7 +554,7 @@ case "${targ}" in
|
||||
targ_selvecs=hppa_elf32_vec
|
||||
;;
|
||||
|
||||
- i[3-7]86-*-elf* | i[3-7]86-*-rtems*)
|
||||
+ i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
|
||||
targ_defvec=i386_elf32_vec
|
||||
targ_selvecs="iamcu_elf32_vec i386_coff_vec"
|
||||
;;
|
||||
@@ -662,7 +662,7 @@ case "${targ}" in
|
||||
targ_selvecs="i386_elf32_vec iamcu_elf32_vec l1om_elf64_vec k1om_elf64_vec"
|
||||
want64=true
|
||||
;;
|
||||
- x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia)
|
||||
+ x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia | x86_64-*-genode*)
|
||||
targ_defvec=x86_64_elf64_vec
|
||||
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec"
|
||||
case "${targ}" in
|
||||
diff --git a/config.sub b/config.sub
|
||||
index c95acc681d..388c305636 100755
|
||||
--- a/config.sub
|
||||
+++ b/config.sub
|
||||
@@ -1376,7 +1376,7 @@ case $os in
|
||||
| powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
|
||||
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
|
||||
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
|
||||
- | midnightbsd*)
|
||||
+ | midnightbsd* | genode*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
qnx*)
|
||||
diff --git a/gas/configure.tgt b/gas/configure.tgt
|
||||
index 3d0415c1aa..7cd96b6be4 100644
|
||||
--- a/gas/configure.tgt
|
||||
+++ b/gas/configure.tgt
|
||||
@@ -139,7 +139,8 @@ case ${generic_target} in
|
||||
|
||||
arm-*-phoenix*) fmt=elf ;;
|
||||
arm-*-elf) fmt=elf ;;
|
||||
- arm-*-eabi* | arm-*-rtems*) fmt=elf em=armeabi ;;
|
||||
+ arm-*-eabi* | arm-*-rtems* | arm-*-genode*)
|
||||
+ fmt=elf em=armeabi ;;
|
||||
arm-*-symbianelf*) fmt=elf em=symbian ;;
|
||||
arm-*-kaos*) fmt=elf ;;
|
||||
arm-*-conix*) fmt=elf ;;
|
||||
@@ -213,6 +214,7 @@ case ${generic_target} in
|
||||
i386-*-elfiamcu) fmt=elf arch=iamcu ;;
|
||||
i386-*-elf*) fmt=elf ;;
|
||||
i386-*-fuchsia*) fmt=elf ;;
|
||||
+ i386-*-genode*) fmt=elf ;;
|
||||
i386-*-kaos*) fmt=elf ;;
|
||||
i386-*-bsd*) fmt=aout em=386bsd ;;
|
||||
i386-*-nacl*) fmt=elf em=nacl
|
||||
diff --git a/ld/configure.tgt b/ld/configure.tgt
|
||||
index fad8b2e5c8..04f7fa0e70 100644
|
||||
--- a/ld/configure.tgt
|
||||
+++ b/ld/configure.tgt
|
||||
@@ -115,7 +115,7 @@ arm-*-nto*) targ_emul=armnto ;;
|
||||
arm-*-phoenix*) targ_emul=armelf ;;
|
||||
armeb-*-elf | armeb-*-eabi*)
|
||||
targ_emul=armelfb ;;
|
||||
-arm-*-elf | arm*-*-eabi* | arm-*-rtems*)
|
||||
+arm-*-elf | arm*-*-eabi* | arm-*-rtems* | arm-*-genode*)
|
||||
targ_emul=armelf ;;
|
||||
arm*-*-symbianelf*) targ_emul=armsymbian;;
|
||||
arm-*-kaos*) targ_emul=armelf ;;
|
||||
@@ -302,10 +302,10 @@ x86_64-*-netbsd*) targ_emul=elf_x86_64
|
||||
esac ;;
|
||||
i[3-7]86-*-elfiamcu) targ_emul=elf_iamcu
|
||||
targ_extra_emuls=elf_i386 ;;
|
||||
-i[3-7]86-*-elf* | i[3-7]86-*-rtems*)
|
||||
+i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
|
||||
targ_emul=elf_i386
|
||||
targ_extra_emuls=elf_iamcu ;;
|
||||
-x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia*)
|
||||
+x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
|
||||
targ_emul=elf_x86_64
|
||||
targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64 elf_l1om elf_k1om"
|
||||
targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64 elf_l1om elf_k1om"
|
@ -0,0 +1,300 @@
|
||||
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
|
||||
index 3c139d72479..89d6df3f5b4 100644
|
||||
--- a/lib/Basic/Targets.cpp
|
||||
+++ b/lib/Basic/Targets.cpp
|
||||
@@ -147,6 +147,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||
return new FreeBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Fuchsia:
|
||||
return new FuchsiaTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||
+ case llvm::Triple::Genode:
|
||||
+ return new GenodeTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Linux:
|
||||
return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::NetBSD:
|
||||
@@ -171,6 +173,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||
return new FreeBSDTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Fuchsia:
|
||||
return new FuchsiaTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||
+ case llvm::Triple::Genode:
|
||||
+ return new GenodeTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Linux:
|
||||
return new LinuxTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::NetBSD:
|
||||
@@ -528,6 +532,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||
return new FreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Fuchsia:
|
||||
return new FuchsiaTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
+ case llvm::Triple::Genode:
|
||||
+ return new GenodeTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::KFreeBSD:
|
||||
return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::Solaris:
|
||||
diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h
|
||||
index 09867d82c38..f67151a13e8 100644
|
||||
--- a/lib/Basic/Targets/OSTargets.h
|
||||
+++ b/lib/Basic/Targets/OSTargets.h
|
||||
@@ -760,6 +760,26 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
+// Genode Target
|
||||
+template <typename Target>
|
||||
+class LLVM_LIBRARY_VISIBILITY GenodeTargetInfo : public OSTargetInfo<Target> {
|
||||
+protected:
|
||||
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
||||
+ MacroBuilder &Builder) const override {
|
||||
+ Builder.defineMacro("__GENODE__");
|
||||
+ Builder.defineMacro("__ELF__");
|
||||
+ // Required by the libc++ locale support.
|
||||
+ if (Opts.CPlusPlus)
|
||||
+ Builder.defineMacro("_GNU_SOURCE");
|
||||
+ }
|
||||
+
|
||||
+public:
|
||||
+ GenodeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
+ : OSTargetInfo<Target>(Triple, Opts) {
|
||||
+ this->MCountName = "__mcount";
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
// WebAssembly target
|
||||
template <typename Target>
|
||||
class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
|
||||
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
|
||||
index 4793a1f90b2..4691b898eb2 100644
|
||||
--- a/lib/Driver/CMakeLists.txt
|
||||
+++ b/lib/Driver/CMakeLists.txt
|
||||
@@ -44,6 +44,7 @@ add_clang_library(clangDriver
|
||||
ToolChains/DragonFly.cpp
|
||||
ToolChains/FreeBSD.cpp
|
||||
ToolChains/Fuchsia.cpp
|
||||
+ ToolChains/Genode.cpp
|
||||
ToolChains/Gnu.cpp
|
||||
ToolChains/Haiku.cpp
|
||||
ToolChains/HIP.cpp
|
||||
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
|
||||
index a784e218f13..881b78abc4d 100644
|
||||
--- a/lib/Driver/Driver.cpp
|
||||
+++ b/lib/Driver/Driver.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ToolChains/DragonFly.h"
|
||||
#include "ToolChains/FreeBSD.h"
|
||||
#include "ToolChains/Fuchsia.h"
|
||||
+#include "ToolChains/Genode.h"
|
||||
#include "ToolChains/Gnu.h"
|
||||
#include "ToolChains/HIP.h"
|
||||
#include "ToolChains/Haiku.h"
|
||||
@@ -4570,6 +4571,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
||||
case llvm::Triple::Solaris:
|
||||
TC = llvm::make_unique<toolchains::Solaris>(*this, Target, Args);
|
||||
break;
|
||||
+ case llvm::Triple::Genode:
|
||||
+ TC = llvm::make_unique<toolchains::Genode>(*this, Target, Args);
|
||||
+ break;
|
||||
case llvm::Triple::AMDHSA:
|
||||
TC = llvm::make_unique<toolchains::AMDGPUToolChain>(*this, Target, Args);
|
||||
break;
|
||||
diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp
|
||||
index 1a46073aaa3..72b6f7389a3 100644
|
||||
--- a/lib/Driver/SanitizerArgs.cpp
|
||||
+++ b/lib/Driver/SanitizerArgs.cpp
|
||||
@@ -693,7 +693,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||
ImplicitCfiRuntime = TC.getTriple().isAndroid();
|
||||
|
||||
if (AllAddedKinds & Address) {
|
||||
- NeedPIE |= TC.getTriple().isOSFuchsia();
|
||||
+ NeedPIE |= TC.getTriple().isOSFuchsia() | TC.getTriple().isOSGenode();
|
||||
if (Arg *A =
|
||||
Args.getLastArg(options::OPT_fsanitize_address_field_padding)) {
|
||||
StringRef S = A->getValue();
|
||||
diff --git a/lib/Driver/ToolChains/Genode.cpp b/lib/Driver/ToolChains/Genode.cpp
|
||||
new file mode 100644
|
||||
index 00000000000..cbb1b9e30c4
|
||||
--- /dev/null
|
||||
+++ b/lib/Driver/ToolChains/Genode.cpp
|
||||
@@ -0,0 +1,84 @@
|
||||
+//===--- Genode.cpp --- Genode ToolChain Implementations --------*- C++ -*-===//
|
||||
+//
|
||||
+// The LLVM Compiler Infrastructure
|
||||
+//
|
||||
+// This file is distributed under the University of Illinois Open Source
|
||||
+// License. See LICENSE.TXT for details.
|
||||
+//
|
||||
+//===----------------------------------------------------------------------===//
|
||||
+
|
||||
+
|
||||
+#include "Genode.h"
|
||||
+#include "InputInfo.h"
|
||||
+#include "CommonArgs.h"
|
||||
+#include "clang/Driver/Compilation.h"
|
||||
+#include "clang/Driver/Driver.h"
|
||||
+#include "clang/Driver/Options.h"
|
||||
+#include "llvm/ADT/SmallString.h"
|
||||
+#include "llvm/Option/ArgList.h"
|
||||
+#include "llvm/Support/Path.h"
|
||||
+
|
||||
+using namespace clang::driver;
|
||||
+using namespace clang::driver::tools;
|
||||
+using namespace clang::driver::toolchains;
|
||||
+using namespace clang;
|
||||
+using namespace llvm::opt;
|
||||
+
|
||||
+void genode::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
+ const InputInfo &Output,
|
||||
+ const InputInfoList &Inputs,
|
||||
+ const llvm::opt::ArgList &Args,
|
||||
+ const char *LinkingOutput) const {
|
||||
+ const ToolChain &ToolChain = getToolChain();
|
||||
+ const Driver &D = ToolChain.getDriver();
|
||||
+ ArgStringList CmdArgs;
|
||||
+
|
||||
+ if (Output.isFilename()) {
|
||||
+ CmdArgs.push_back("-o");
|
||||
+ CmdArgs.push_back(Output.getFilename());
|
||||
+ } else {
|
||||
+ assert(Output.isNothing() && "Invalid output.");
|
||||
+ }
|
||||
+
|
||||
+ AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
|
||||
+
|
||||
+ const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
|
||||
+}
|
||||
+
|
||||
+Genode::Genode(const Driver &D, const llvm::Triple &Triple,
|
||||
+ const llvm::opt::ArgList &Args)
|
||||
+ : Generic_ELF(D, Triple, Args) {
|
||||
+ SmallString<128> P(getDriver().Dir);
|
||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "lib");
|
||||
+ getFilePaths().push_back(P.str());
|
||||
+}
|
||||
+
|
||||
+void Genode::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const {
|
||||
+ SmallString<128> P(getDriver().Dir);
|
||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "include/c++/v1");
|
||||
+ addSystemInclude(DriverArgs, CC1Args, P.str());
|
||||
+}
|
||||
+
|
||||
+bool Genode::isPIEDefault() const {
|
||||
+ switch (getTriple().getArch()) {
|
||||
+ case llvm::Triple::aarch64:
|
||||
+ case llvm::Triple::x86_64:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+SanitizerMask Genode::getSupportedSanitizers() const {
|
||||
+ return Generic_ELF::getSupportedSanitizers();
|
||||
+}
|
||||
+
|
||||
+SanitizerMask Genode::getDefaultSanitizers() const {
|
||||
+ return Generic_ELF::getDefaultSanitizers();
|
||||
+}
|
||||
+
|
||||
+Tool *Genode::buildLinker() const {
|
||||
+ return new tools::genode::Linker(*this);
|
||||
+}
|
||||
diff --git a/lib/Driver/ToolChains/Genode.h b/lib/Driver/ToolChains/Genode.h
|
||||
new file mode 100644
|
||||
index 00000000000..971efb04ef9
|
||||
--- /dev/null
|
||||
+++ b/lib/Driver/ToolChains/Genode.h
|
||||
@@ -0,0 +1,69 @@
|
||||
+//===----- Genode.h --- Genode ToolChain Implementations --------*- C++ -*-===//
|
||||
+//
|
||||
+// The LLVM Compiler Infrastructure
|
||||
+//
|
||||
+// This file is distributed under the University of Illinois Open Source
|
||||
+// License. See LICENSE.TXT for details.
|
||||
+//
|
||||
+//===----------------------------------------------------------------------===//
|
||||
+
|
||||
+
|
||||
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||
+
|
||||
+#include "Gnu.h"
|
||||
+#include "clang/Driver/Tool.h"
|
||||
+#include "clang/Driver/ToolChain.h"
|
||||
+
|
||||
+namespace clang {
|
||||
+namespace driver {
|
||||
+namespace tools {
|
||||
+
|
||||
+//// genode -- Directly call GNU Binutils linker
|
||||
+namespace genode {
|
||||
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
|
||||
+public:
|
||||
+ Linker(const ToolChain &TC) : GnuTool("genode::Linker", "linker", TC) {}
|
||||
+
|
||||
+ bool hasIntegratedCPP() const override { return false; }
|
||||
+ bool isLinkJob() const override { return true; }
|
||||
+
|
||||
+ void ConstructJob(Compilation &C, const JobAction &JA,
|
||||
+ const InputInfo &Output, const InputInfoList &Inputss,
|
||||
+ const llvm::opt::ArgList &Args,
|
||||
+ const char *LinkingOutput) const override;
|
||||
+};
|
||||
+} // end namespace genode
|
||||
+} // end namespace tools
|
||||
+
|
||||
+namespace toolchains {
|
||||
+
|
||||
+class LLVM_LIBRARY_VISIBILITY Genode : public Generic_ELF {
|
||||
+public:
|
||||
+ Genode(const Driver &D, const llvm::Triple &Triple,
|
||||
+ const llvm::opt::ArgList &Args);
|
||||
+ bool HasNativeLLVMSupport() const override { return true; }
|
||||
+
|
||||
+ bool IsMathErrnoDefault() const override { return true; }
|
||||
+
|
||||
+ CXXStdlibType
|
||||
+ GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
|
||||
+ return ToolChain::CST_Libcxx;
|
||||
+ }
|
||||
+ void addLibCxxIncludePaths(
|
||||
+ const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const override;
|
||||
+
|
||||
+ bool isPIEDefault() const override;
|
||||
+ SanitizerMask getSupportedSanitizers() const override;
|
||||
+ SanitizerMask getDefaultSanitizers() const override;
|
||||
+
|
||||
+protected:
|
||||
+ Tool *buildLinker() const override;
|
||||
+};
|
||||
+
|
||||
+} // end namespace toolchains
|
||||
+} // end namespace driver
|
||||
+} // end namespace clang
|
||||
+
|
||||
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
|
||||
index 67842b5dca2..26a2c65fec2 100644
|
||||
--- a/lib/Frontend/InitHeaderSearch.cpp
|
||||
+++ b/lib/Frontend/InitHeaderSearch.cpp
|
||||
@@ -221,6 +221,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
||||
case llvm::Triple::PS4:
|
||||
case llvm::Triple::ELFIAMCU:
|
||||
case llvm::Triple::Fuchsia:
|
||||
+ case llvm::Triple::Genode:
|
||||
break;
|
||||
case llvm::Triple::Win32:
|
||||
if (triple.getEnvironment() != llvm::Triple::Cygnus)
|
||||
@@ -329,6 +330,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
||||
case llvm::Triple::NaCl:
|
||||
case llvm::Triple::ELFIAMCU:
|
||||
case llvm::Triple::Fuchsia:
|
||||
+ case llvm::Triple::Genode:
|
||||
break;
|
||||
case llvm::Triple::PS4: {
|
||||
// <isysroot> gets prepended later in AddPath().
|
||||
diff --git a/test/Driver/genode.c b/test/Driver/genode.c
|
||||
new file mode 100644
|
||||
index 00000000000..e69de29bb2d
|
||||
diff --git a/test/Driver/genode.cpp b/test/Driver/genode.cpp
|
||||
new file mode 100644
|
||||
index 00000000000..e69de29bb2d
|
@ -0,0 +1,13 @@
|
||||
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h
|
||||
index 3f5e59b2544..97d06d6ccd1 100644
|
||||
--- a/lib/builtins/assembly.h
|
||||
+++ b/lib/builtins/assembly.h
|
||||
@@ -45,7 +45,7 @@
|
||||
#define CONST_SECTION .section .rodata
|
||||
|
||||
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
||||
- defined(__linux__)
|
||||
+ defined(__linux__) || defined(__GENODE__)
|
||||
#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
|
||||
#else
|
||||
#define NO_EXEC_STACK_DIRECTIVE
|
@ -0,0 +1,78 @@
|
||||
self: super:
|
||||
|
||||
let
|
||||
inherit (super) lib stdenv;
|
||||
|
||||
genodeTarget = stdenv.targetPlatform ? isGenode
|
||||
-> stdenv.targetPlatform.isGenode;
|
||||
|
||||
genodelibc = self.callPackage ./libc { stdenv = self.crossLibcStdenv; };
|
||||
|
||||
in {
|
||||
|
||||
binutils-unwrapped = super.binutils-unwrapped.overrideAttrs
|
||||
(attrs: { patches = attrs.patches ++ [ ./binutils.patch ]; });
|
||||
|
||||
cmake = super.cmake.overrideAttrs (attrs: {
|
||||
postInstall = if genodeTarget then ''
|
||||
local MODULE="$out/share/cmake-${
|
||||
lib.versions.majorMinor attrs.version
|
||||
}/Modules/Platform/Genode.cmake"
|
||||
if [ -e "$MODULE" ]; then
|
||||
echo "Upstream provides $MODULE!"
|
||||
exit 1
|
||||
fi
|
||||
cp ${./Genode.cmake} $MODULE
|
||||
'' else
|
||||
null;
|
||||
});
|
||||
|
||||
llvmPackages = self.recurseIntoAttrs self.llvmPackages_8;
|
||||
|
||||
llvmPackages_8 = super.llvmPackages_8 // {
|
||||
|
||||
llvm = super.llvmPackages_8.llvm.overrideAttrs
|
||||
(attrs: { patches = [ ./llvm.patch ]; });
|
||||
|
||||
compiler-rt = super.llvmPackages_8.compiler-rt.overrideAttrs
|
||||
(attrs: { patches = attrs.patches ++ [ ./compiler-rt.patch ]; });
|
||||
|
||||
libcxxabi = (super.llvmPackages_8.libcxxabi.override {
|
||||
enableShared = false;
|
||||
}).overrideAttrs (attrs: {
|
||||
postUnpack = attrs.postUnpack + ''
|
||||
patch -p1 -d $(ls -d llvm-*) -i ${./llvm-genode.patch}
|
||||
'';
|
||||
cmakeFlags = attrs.cmakeFlags ++ (lib.optionals genodeTarget [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_BAREMETAL=ON"
|
||||
]);
|
||||
|
||||
installPhase = attrs.installPhase
|
||||
+ "install -m 644 ../include/*.h $out/include";
|
||||
});
|
||||
|
||||
libcxx = (super.llvmPackages_8.libcxx.override {
|
||||
enableShared = false;
|
||||
}).overrideAttrs (attrs: {
|
||||
patches = attrs.patches ++ (lib.optional genodeTarget ./libc++.patch);
|
||||
nativeBuildInputs = attrs.nativeBuildInputs
|
||||
++ [ super.buildPackages.python ];
|
||||
cmakeFlags = attrs.cmakeFlags
|
||||
++ (lib.optional genodeTarget "-DLIBCXX_ENABLE_THREADS=OFF");
|
||||
});
|
||||
|
||||
clang-unwrapped = super.llvmPackages_8.clang-unwrapped.overrideAttrs
|
||||
(attrs: {
|
||||
patches = attrs.patches ++ (lib.optional genodeTarget ./clang.patch);
|
||||
});
|
||||
};
|
||||
|
||||
genodeHeaders = self.callPackage ./headers { };
|
||||
|
||||
inherit genodelibc;
|
||||
libcCross = genodelibc;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{ stdenvNoCC, lib, fetchurl }:
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
version = "19.08";
|
||||
platform = stdenv.targetPlatform;
|
||||
in stdenv.mkDerivation {
|
||||
pname = platform.system + "-headers";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/genodelabs/genode/archive/${version}.tar.gz";
|
||||
sha256 = "1x5yjb4l36pfg87k389qyq3y3kv5yblzn9r6ikyqgam413bpxabi";
|
||||
};
|
||||
|
||||
specs = with platform; []
|
||||
++ lib.optional is32bit "32bit"
|
||||
++ lib.optional is64bit "64bit"
|
||||
++ lib.optional isAarch32 "arm"
|
||||
++ lib.optional isAarch64 "arm_64"
|
||||
++ lib.optional isRiscV "riscv"
|
||||
++ lib.optional isx86 "x86"
|
||||
++ lib.optional isx86_32 "x86_32"
|
||||
++ lib.optional isx86_64 "x86_64";
|
||||
|
||||
builder = builtins.toFile "builder.sh" ''
|
||||
source $stdenv/setup
|
||||
|
||||
tar fx $src \
|
||||
--strip-components=2 \
|
||||
genode-$version/repos/base/include \
|
||||
genode-$version/repos/demo/include \
|
||||
genode-$version/repos/gems/include \
|
||||
genode-$version/repos/libports/include \
|
||||
genode-$version/repos/os/include \
|
||||
genode-$version/repos/ports/include \
|
||||
|
||||
includeDir=$out/include
|
||||
mkdir -p $includeDir
|
||||
|
||||
for DIR in */include; do
|
||||
for SPEC in $specs; do
|
||||
if [ -d $DIR/spec/$SPEC ]; then
|
||||
cp -r $DIR/spec/$SPEC/* $includeDir/
|
||||
rm -r $DIR/spec/$SPEC
|
||||
fi
|
||||
done
|
||||
rm -rf $DIR/spec
|
||||
cp -r $DIR/* $includeDir
|
||||
done
|
||||
'';
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
diff --git a/include/locale b/include/locale
|
||||
index 2043892fa2d..6e5c285a7c9 100644
|
||||
--- a/include/locale
|
||||
+++ b/include/locale
|
||||
@@ -737,7 +737,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
+ long long __ll = strtoll(__a, &__p2, __base);
|
||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -777,7 +777,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
+ unsigned long long __ll = strtoull(__a, &__p2, __base);
|
||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -806,19 +806,19 @@ _Tp __do_strtod(const char* __a, char** __p2);
|
||||
template <>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float __do_strtod<float>(const char* __a, char** __p2) {
|
||||
- return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
||||
+ return strtof(__a, __p2);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double __do_strtod<double>(const char* __a, char** __p2) {
|
||||
- return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
||||
+ return strtod(__a, __p2);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double __do_strtod<long double>(const char* __a, char** __p2) {
|
||||
- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
||||
+ return strtold(__a, __p2);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -1197,13 +1197,13 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
- if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
||||
+ if (!isxdigit(*__ns))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
- if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
||||
+ if (!isdigit(*__ns))
|
||||
break;
|
||||
}
|
||||
if (__grouping.empty())
|
||||
diff --git a/utils/google-benchmark/src/internal_macros.h b/utils/google-benchmark/src/internal_macros.h
|
||||
index 5dbf4fd2752..4699c5ed913 100644
|
||||
--- a/utils/google-benchmark/src/internal_macros.h
|
||||
+++ b/utils/google-benchmark/src/internal_macros.h
|
||||
@@ -70,6 +70,8 @@
|
||||
#define BENCHMARK_OS_FUCHSIA 1
|
||||
#elif defined (__SVR4) && defined (__sun)
|
||||
#define BENCHMARK_OS_SOLARIS 1
|
||||
+#elif defined(__GENODE__)
|
||||
+ #define BENCHMARK_OS_GENODE 1
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) && defined(__GLIBCXX__)
|
@ -0,0 +1,24 @@
|
||||
--- src/lib/libc/include/stdlib.h.orig 2019-04-18 13:26:58.781188866 +0200
|
||||
+++ src/lib/libc/include/stdlib.h 2019-04-18 13:27:46.100594001 +0200
|
||||
@@ -81,7 +81,8 @@
|
||||
#endif
|
||||
extern int __mb_cur_max;
|
||||
extern int ___mb_cur_max(void);
|
||||
-#define MB_CUR_MAX ((size_t)___mb_cur_max())
|
||||
+/* ASCII only */
|
||||
+#define MB_CUR_MAX 1
|
||||
|
||||
_Noreturn void abort(void);
|
||||
int abs(int) __pure2;
|
||||
|
||||
--- src/lib/libc/include/xlocale/_stdlib.h.orig 2019-04-18 13:28:52.691756865 +0200
|
||||
+++ src/lib/libc/include/xlocale/_stdlib.h 2019-04-18 13:29:13.079500565 +0200
|
||||
@@ -57,5 +57,6 @@
|
||||
int wctomb_l(char *, wchar_t, locale_t);
|
||||
|
||||
int ___mb_cur_max_l(locale_t);
|
||||
-#define MB_CUR_MAX_L(x) ((size_t)___mb_cur_max_l(x))
|
||||
+/* ASCII only */
|
||||
+#define MB_CUR_MAX_L(x) 1
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
--- src/lib/libc/include/runetype.h.orig 2019-04-16 11:51:27.954530199 +0200
|
||||
+++ src/lib/libc/include/runetype.h 2019-04-16 11:51:53.346901123 +0200
|
||||
@@ -88,19 +88,7 @@
|
||||
__BEGIN_DECLS
|
||||
extern const _RuneLocale _DefaultRuneLocale;
|
||||
extern const _RuneLocale *_CurrentRuneLocale;
|
||||
-#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
|
||||
-extern const _RuneLocale *__getCurrentRuneLocale(void);
|
||||
-#else
|
||||
-extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
|
||||
-static __inline const _RuneLocale *__getCurrentRuneLocale(void)
|
||||
-{
|
||||
-
|
||||
- if (_ThreadRuneLocale)
|
||||
- return _ThreadRuneLocale;
|
||||
- return _CurrentRuneLocale;
|
||||
-}
|
||||
-#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
|
||||
-#define _CurrentRuneLocale (__getCurrentRuneLocale())
|
||||
+#define _CurrentRuneLocale (&_DefaultRuneLocale)
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RUNETYPE_H_ */
|
@ -0,0 +1,63 @@
|
||||
Prevent the use of the hidden attribute for symbols. In particular,
|
||||
the attribute must not be applied to '__libc'-prefixed symbols to allow
|
||||
overwriting the dummies defined in dummies.cc by other non-weak
|
||||
implementations such as those in 'libc_noux.lib.so'.
|
||||
|
||||
This attribute is applied inconsistently in
|
||||
libc/lib/libc/include/libc_private.h anyway.
|
||||
|
||||
Also, force i386 to call __libc_sigprocmask via PLT to prevent
|
||||
R_386_PC32 relocations, which had to change the text segment. Other
|
||||
architectures do this automatically.
|
||||
|
||||
--- src/lib/libc/sys/sys/cdefs.h
|
||||
+++ src/lib/libc/sys/sys/cdefs.h
|
||||
@@ -447,7 +447,7 @@
|
||||
#if __GNUC_PREREQ__(4, 0)
|
||||
#define __null_sentinel __attribute__((__sentinel__))
|
||||
#define __exported __attribute__((__visibility__("default")))
|
||||
-#define __hidden __attribute__((__visibility__("hidden")))
|
||||
+#define __hidden
|
||||
#else
|
||||
#define __null_sentinel
|
||||
#define __exported
|
||||
--- src/lib/libc/lib/libc/i386/gen/setjmp.S
|
||||
+++ src/lib/libc/lib/libc/i386/gen/setjmp.S
|
||||
@@ -54,7 +54,7 @@
|
||||
pushl %eax /* (sigset_t*)oset */
|
||||
pushl $0 /* (sigset_t*)set */
|
||||
pushl $1 /* SIG_BLOCK */
|
||||
- call __libc_sigprocmask
|
||||
+ call __i386_libc_sigprocmask
|
||||
addl $12,%esp
|
||||
movl 4(%esp),%ecx
|
||||
movl 0(%esp),%edx
|
||||
@@ -76,7 +76,7 @@
|
||||
leal 28(%edx), %eax
|
||||
pushl %eax /* (sigset_t*)set */
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
- call __libc_sigprocmask
|
||||
+ call __i386_libc_sigprocmask
|
||||
addl $12,%esp
|
||||
movl 4(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
--- src/lib/libc/lib/libc/i386/gen/sigsetjmp.S
|
||||
+++ src/lib/libc/lib/libc/i386/gen/sigsetjmp.S
|
||||
@@ -63,7 +63,7 @@
|
||||
pushl %eax /* (sigset_t*)oset */
|
||||
pushl $0 /* (sigset_t*)set */
|
||||
pushl $1 /* SIG_BLOCK */
|
||||
- call __libc_sigprocmask
|
||||
+ call __i386_libc_sigprocmask
|
||||
addl $12,%esp
|
||||
movl 4(%esp),%ecx
|
||||
2: movl 0(%esp),%edx
|
||||
@@ -87,7 +87,7 @@
|
||||
leal 28(%edx), %eax
|
||||
pushl %eax /* (sigset_t*)set */
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
- call __libc_sigprocmask
|
||||
+ call __i386_libc_sigprocmask
|
||||
addl $12,%esp
|
||||
movl 4(%esp),%edx
|
||||
2: movl 8(%esp),%eax
|
@ -0,0 +1,88 @@
|
||||
{ stdenv, fetchgit, fetchurl, genodeHeaders, bison, flex, glibc }:
|
||||
|
||||
let
|
||||
archInfo = with stdenv.hostPlatform;
|
||||
if isAarch32 then {
|
||||
inherit isArm isAarch32;
|
||||
} else if isAarch64 then {
|
||||
inherit isArm isAarch64;
|
||||
} else if isx86_32 then {
|
||||
inherit isx86 isx86_32;
|
||||
} else if isx86_64 then {
|
||||
inherit isx86 isx86_64;
|
||||
} else
|
||||
{ };
|
||||
in stdenv.mkDerivation (archInfo // {
|
||||
name = "genodelibc-12.0.0";
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
builder = ./libc-builder.sh;
|
||||
|
||||
inherit genodeHeaders;
|
||||
|
||||
depsBuildBuild = [
|
||||
bison
|
||||
flex
|
||||
glibc # provides rpcgen
|
||||
];
|
||||
|
||||
src = fetchurl {
|
||||
url =
|
||||
"http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/src.txz";
|
||||
sha256 = "0da393ac2174168a71c1c527d1453e07372295187d05c288250800cb152a889b";
|
||||
};
|
||||
|
||||
unpackPhase = "tar xf $src $tarFlags";
|
||||
|
||||
tarFlags = [
|
||||
"--strip-components=2"
|
||||
"usr/src/contrib/gdtoa"
|
||||
"usr/src/contrib/libc-vis"
|
||||
"usr/src/contrib/tzcode/stdtime"
|
||||
"usr/src/include"
|
||||
"usr/src/lib/libc"
|
||||
"usr/src/lib/msun"
|
||||
"usr/src/sys/amd64"
|
||||
"usr/src/sys/arm"
|
||||
"usr/src/sys/arm64"
|
||||
"usr/src/sys/bsm"
|
||||
"usr/src/sys/crypto/chacha20"
|
||||
"usr/src/sys/i386"
|
||||
"usr/src/sys/libkern"
|
||||
"usr/src/sys/net"
|
||||
"usr/src/sys/netinet"
|
||||
"usr/src/sys/netinet6"
|
||||
"usr/src/sys/riscv"
|
||||
"usr/src/sys/rpc"
|
||||
"usr/src/sys/sys"
|
||||
"usr/src/sys/vm"
|
||||
"usr/src/sys/x86"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./cdefs_no_hidden.patch
|
||||
./_CurrentRuneLocale.patch
|
||||
./gdtoa.patch
|
||||
./log2.patch
|
||||
./MB_CUR_MAX.patch
|
||||
./mktime.patch
|
||||
./printfcommon.patch
|
||||
./rcmd.patch
|
||||
./res_init_c.patch
|
||||
./runetype.patch
|
||||
./semaphore.patch
|
||||
./thread_local.patch
|
||||
./types.patch
|
||||
./vfwprintf_c_warn.patch
|
||||
./xlocale.patch
|
||||
./xlocale_private.patch
|
||||
./xprintf_float.patch
|
||||
];
|
||||
|
||||
patchFlags = "-p0 --strip 3";
|
||||
|
||||
ldScriptSo = ./genode_rel.ld;
|
||||
|
||||
libcPcIn = ./libc.pc.in;
|
||||
libcSymbols = ./libc.symbols;
|
||||
})
|
@ -0,0 +1,43 @@
|
||||
--- src/lib/libc/contrib/gdtoa/gdtoaimp.h.orig 2019-04-16 11:11:02.420833030 +0200
|
||||
+++ src/lib/libc/contrib/gdtoa/gdtoaimp.h 2019-04-16 11:11:17.704278981 +0200
|
||||
@@ -506,40 +506,6 @@
|
||||
#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
|
||||
#endif /* NO_STRING_H */
|
||||
|
||||
-/*
|
||||
- * Paranoia: Protect exported symbols, including ones in files we don't
|
||||
- * compile right now. The standard strtof and strtod survive.
|
||||
- */
|
||||
-#define dtoa __dtoa
|
||||
-#define gdtoa __gdtoa
|
||||
-#define freedtoa __freedtoa
|
||||
-#define strtodg __strtodg
|
||||
-#define g_ddfmt __g_ddfmt
|
||||
-#define g_dfmt __g_dfmt
|
||||
-#define g_ffmt __g_ffmt
|
||||
-#define g_Qfmt __g_Qfmt
|
||||
-#define g_xfmt __g_xfmt
|
||||
-#define g_xLfmt __g_xLfmt
|
||||
-#define strtoId __strtoId
|
||||
-#define strtoIdd __strtoIdd
|
||||
-#define strtoIf __strtoIf
|
||||
-#define strtoIQ __strtoIQ
|
||||
-#define strtoIx __strtoIx
|
||||
-#define strtoIxL __strtoIxL
|
||||
-#define strtord_l __strtord_l
|
||||
-#define strtordd __strtordd
|
||||
-#define strtorf __strtorf
|
||||
-#define strtorQ_l __strtorQ_l
|
||||
-#define strtorx_l __strtorx_l
|
||||
-#define strtorxL __strtorxL
|
||||
-#define strtodI __strtodI
|
||||
-#define strtopd __strtopd
|
||||
-#define strtopdd __strtopdd
|
||||
-#define strtopf __strtopf
|
||||
-#define strtopQ __strtopQ
|
||||
-#define strtopx __strtopx
|
||||
-#define strtopxL __strtopxL
|
||||
-
|
||||
/* Protect gdtoa-internal symbols */
|
||||
#define Balloc __Balloc_D2A
|
||||
#define Bfree __Bfree_D2A
|
@ -0,0 +1,261 @@
|
||||
/*
|
||||
* \brief Linker script for libraries
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2009-11-05
|
||||
*
|
||||
* Script for --shared -z combreloc: shared library, combine & sort relocs
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
PHDRS
|
||||
{
|
||||
ro PT_LOAD;
|
||||
rw PT_LOAD;
|
||||
dynamic PT_DYNAMIC;
|
||||
eh_frame PT_GNU_EH_FRAME;
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.note.gnu.build-id : { *(.note.gnu.build-id) } : ro
|
||||
.hash : { *(.hash) }
|
||||
.gnu.hash : { *(.gnu.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.dyn :
|
||||
{
|
||||
*(.rel.init)
|
||||
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
|
||||
*(.rel.fini)
|
||||
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
|
||||
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
|
||||
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
|
||||
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
|
||||
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
|
||||
*(.rel.ctors)
|
||||
*(.rel.dtors)
|
||||
*(.rel.got)
|
||||
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
|
||||
}
|
||||
.rela.dyn :
|
||||
{
|
||||
*(.rela.init)
|
||||
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
||||
*(.rela.fini)
|
||||
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
||||
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
||||
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
|
||||
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
|
||||
*(.rela.ctors)
|
||||
*(.rela.dtors)
|
||||
*(.rela.got)
|
||||
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
||||
}
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} = 0x0
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
} = 0x0
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} =0x0
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
|
||||
.eh_frame_hdr : { *(.eh_frame_hdr) } : eh_frame : ro
|
||||
.gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
|
||||
|
||||
/*
|
||||
* Adjust the address for the data segment. We want to adjust up to
|
||||
* the same address within the page on the next page up.
|
||||
*/
|
||||
. = ALIGN(0x1000);
|
||||
|
||||
.data :
|
||||
{
|
||||
/*
|
||||
* Leave space for parent capability parameters at start of data
|
||||
* section. The protection domain creator is reponsible for storing
|
||||
* sane values here.
|
||||
*/
|
||||
_parent_cap = .;
|
||||
_parent_cap_thread_id = .;
|
||||
LONG(0xffffffff);
|
||||
_parent_cap_local_name = .;
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
LONG(0xffffffff);
|
||||
|
||||
/*
|
||||
* Platform-specific entry for Fiasco.OC.
|
||||
*
|
||||
* PIC-code compiled for Fiasco.OC, needs some PIC-compatible
|
||||
* way to enter the kernel, the fixed address of the kernel
|
||||
* entry code address needs to be found here.
|
||||
*/
|
||||
__l4sys_invoke_indirect = .;
|
||||
LONG(0xeacff000);
|
||||
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
SORT(CONSTRUCTORS)
|
||||
} : rw
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section */
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
}
|
||||
__exidx_start = .;
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
}
|
||||
__exidx_end = .;
|
||||
|
||||
/* Thread Local Storage sections */
|
||||
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
||||
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
KEEP (*(.preinit_array))
|
||||
}
|
||||
.fini_array :
|
||||
{
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
}
|
||||
.ctors :
|
||||
{
|
||||
/*
|
||||
* gcc uses crtbegin.o to find the start of the constructors, so we make
|
||||
* sure it is first. Because this is a wildcard, it doesn't matter if the
|
||||
* user does not actually link against crtbegin.o; the linker won't look
|
||||
* for a file to match a wildcard. The wildcard also means that it
|
||||
* doesn't matter which directory crtbegin.o is in.
|
||||
* */
|
||||
/* KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))*/
|
||||
/*
|
||||
* We don't want to include the .ctor section from the crtend.o file until
|
||||
* after the sorted ctors. The .ctor section from the crtend file contains
|
||||
* the end of ctors marker and it must be last
|
||||
*/
|
||||
KEEP(*(_mark_ctors_start));
|
||||
_ctors_start = .;
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*(.init_array)) /* list of constructors specific for ARM eabi */
|
||||
_ctors_end = .;
|
||||
KEEP(*(_mark_ctors_end));
|
||||
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
PROVIDE(_dtors_start = .);
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
PROVIDE(_dtors_end = .);
|
||||
}
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
|
||||
|
||||
.data1 : { *(.data1) }
|
||||
.dynamic : { *(.dynamic) } : dynamic : rw
|
||||
/* See: genode_dyn.ld */
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
/* Exception handling */
|
||||
.eh_frame :
|
||||
{
|
||||
__eh_frame_start__ = .;
|
||||
KEEP (*(.eh_frame))
|
||||
LONG(0)
|
||||
}
|
||||
_edata = .; PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
|
||||
/*
|
||||
* Align here to ensure that the .bss section occupies space up to
|
||||
* _end. Align after .bss to ensure correct alignment even if the
|
||||
* .bss section disappears because there are no input sections.
|
||||
*
|
||||
* FIXME: Why do we need it? When there is no .bss section, we don't
|
||||
* pad the .data section.
|
||||
*/
|
||||
. = ALIGN(. != 0 ? 32 / 8 : 1);
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
. = ALIGN(32 / 8);
|
||||
_end = .; PROVIDE (end = .);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
|
||||
}
|
@ -0,0 +1,287 @@
|
||||
source $stdenv/setup
|
||||
|
||||
export includedir=${dev}/include
|
||||
export pkgconfigdir=${out}/lib/pkgconfig
|
||||
|
||||
compileStub() {
|
||||
local ASM_SYM_DEPENDENCY="movq \1@GOTPCREL(%rip), %rax"
|
||||
# TODO: .long \1
|
||||
|
||||
sed \
|
||||
-e "s/^\(\w\+\) D \(\w\+\)\$/.data; .global \1; .type \1,%object; .size \1,\2; \1:/" \
|
||||
-e "s/^\(\w\+\) V/.data; .weak \1; .type \1,%object; \1:/" \
|
||||
-e "s/^\(\w\+\) T/.text; .global \1; .type \1,%function; \1:/" \
|
||||
-e "s/^\(\w\+\) R \(\w\+\)\$/.section .rodata; .global \1; .type \1,%object; .size \1,\2; \1:/" \
|
||||
-e "s/^\(\w\+\) W/.text; .weak \1; .type \1,%function; \1:/" \
|
||||
-e "s/^\(\w\+\) B \(\w\+\)\$/.bss; .global \1; .type \1,%object; .size \1,\2; \1:/" \
|
||||
-e "s/^\(\w\+\) U/.text; .global \1; ${ASM_SYM_DEPENDENCY}/" \
|
||||
$1 > symbols.s
|
||||
|
||||
$CC -x assembler -c symbols.s -o tmp.o
|
||||
|
||||
$LD -o $2 \
|
||||
-shared \
|
||||
-T$ldScriptSo \
|
||||
tmp.o
|
||||
|
||||
rm tmp.o symbols.s
|
||||
}
|
||||
|
||||
|
||||
# Add a prefix to the following arguments
|
||||
#
|
||||
addPrefix() {
|
||||
local prefix=$1
|
||||
local files=""
|
||||
|
||||
for (( i = 2; i <= $#; i++)); do
|
||||
files="$files $prefix${!i}"
|
||||
done
|
||||
echo -n $files
|
||||
}
|
||||
|
||||
#
|
||||
# Copy into dest the following arguments,
|
||||
# rooted at $includedir
|
||||
#
|
||||
copyIncludes() {
|
||||
local to=$1; shift
|
||||
local from=$1; shift
|
||||
|
||||
mkdir -p $to
|
||||
for i in $*; do
|
||||
cp $from/$i $to/
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# CPU-architecture-specific headers
|
||||
#
|
||||
# The 'common_include_*_content' functions take the CPU architecture as first
|
||||
# argument.
|
||||
#
|
||||
|
||||
common_include_libc_arch_content() {
|
||||
local content
|
||||
for i in stdarg.h float.h
|
||||
do content="$content sys/$1/include/$i"; done
|
||||
|
||||
for i in arith.h _fpmath.h SYS.h gd_qnan.h
|
||||
do content="$content lib/libc/$2/$i"; done
|
||||
|
||||
echo -n $content
|
||||
}
|
||||
|
||||
common_include_libc_arch_machine_content() {
|
||||
for i in \
|
||||
_types.h endian.h _limits.h signal.h trap.h _stdint.h \
|
||||
sysarch.h ieeefp.h frame.h vm.h \
|
||||
cpufunc.h vmparam.h atomic.h elf.h exec.h reloc.h pmap.h \
|
||||
ucontext.h setjmp.h asm.h param.h _inttypes.h _align.h float.h
|
||||
do echo sys/$1/include/$i; done
|
||||
}
|
||||
|
||||
rpcgen_() {
|
||||
rpcgen -C -h -DWANT_NFS3 $1 -o $2
|
||||
}
|
||||
|
||||
|
||||
installPhase() {
|
||||
mkdir -p $includedir/machine
|
||||
|
||||
#
|
||||
# CPU-architecture-specific headers
|
||||
#
|
||||
|
||||
#
|
||||
# x86-specific headers
|
||||
#
|
||||
if [ -n "${isx86:-}" ]; then
|
||||
cp lib/msun/x86/fenv.h $includedir
|
||||
cp -r sys/x86/include $includedir/x86
|
||||
fi
|
||||
|
||||
#
|
||||
# i386-specific headers
|
||||
#
|
||||
if [ -n "${isx86_32:-}" ]; then
|
||||
cp \
|
||||
$(common_include_libc_arch_content i386 i386) \
|
||||
$includedir
|
||||
|
||||
cp \
|
||||
$(common_include_libc_arch_machine_content i386) \
|
||||
sys/i386/include/specialreg.h \
|
||||
sys/i386/include/npx.h \
|
||||
$includedir/machine
|
||||
fi
|
||||
|
||||
#
|
||||
# AMD64-specific headers
|
||||
#
|
||||
if [ -n "${isx86_64:-}" ]; then
|
||||
cp \
|
||||
$(common_include_libc_arch_content amd64 amd64) \
|
||||
$includedir
|
||||
|
||||
cp \
|
||||
$(common_include_libc_arch_machine_content amd64) \
|
||||
sys/amd64/include/specialreg.h \
|
||||
sys/amd64/include/fpu.h \
|
||||
$includedir/machine
|
||||
fi
|
||||
|
||||
#
|
||||
# ARM-specific headers
|
||||
#
|
||||
if [ -n "${isAarch32:-}" ]; then
|
||||
cp \
|
||||
$(common_include_libc_arch_content arm arm) \
|
||||
lib/msun/arm/fenv.h \
|
||||
$includedir
|
||||
|
||||
cp \
|
||||
$(common_include_libc_arch_machine_content arm) \
|
||||
$includedir/machine
|
||||
|
||||
copyIncludes $includedir/machine sys/arm/include \
|
||||
armreg.h atomic-v6.h ieee.h sysreg.h
|
||||
fi
|
||||
|
||||
#
|
||||
# ARM64-specific headers
|
||||
#
|
||||
if [ -n "${isAarch32:-}" ]; then
|
||||
cp \
|
||||
$(common_include_libc_arch_content arm64 aarch64) \
|
||||
lib/msun/aarch64/fenv.h \
|
||||
$includedir
|
||||
|
||||
cp \
|
||||
$(common_include_libc_arch_machine_content arm64) \
|
||||
$includedir/machine
|
||||
|
||||
copyIncludes $includedir/machine sys/arm64/include/ \
|
||||
armreg.h
|
||||
fi
|
||||
|
||||
|
||||
##############################################################
|
||||
|
||||
flex -P_nsyy -t lib/libc/net/nslexer.l \
|
||||
| sed -e '/YY_BUF_SIZE/s/16384/1024/' \
|
||||
> lib/libc/net/nslexer.c
|
||||
|
||||
bison -d -p_nsyy lib/libc/net/nsparser.y \
|
||||
--defines=lib/libc/net/nsparser.h \
|
||||
--output=lib/libc/net/nsparser.c
|
||||
|
||||
local generated_files="include/rpc/rpcb_prot.h"
|
||||
for h in \
|
||||
bootparam_prot.h nfs_prot.h nlm_prot.h rstat.h ypupdate_prot.h \
|
||||
crypt.h nis_cache.h pmap_prot.h rwall.h yp.h \
|
||||
key_prot.h nis_callback.h rex.h sm_inter.h ypxfrd.h \
|
||||
klm_prot.h nis_object.h rnusers.h spray.h \
|
||||
mount.h nis.h rquota.h yppasswd.h
|
||||
do generated_files="$generated_files include/rpcsvc/$h"; done
|
||||
|
||||
for file in $generated_files; do
|
||||
rpcgen -C -h -DWANT_NFS3 ${file%h}x -o $file
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Generic headers
|
||||
#
|
||||
copyIncludes $includedir include \
|
||||
strings.h limits.h string.h ctype.h _ctype.h \
|
||||
stdlib.h stdio.h signal.h unistd.h wchar.h time.h sysexits.h \
|
||||
resolv.h wctype.h locale.h langinfo.h regex.h paths.h ieeefp.h \
|
||||
inttypes.h fstab.h netdb.h ar.h memory.h res_update.h \
|
||||
netconfig.h ifaddrs.h pthread.h err.h getopt.h search.h \
|
||||
varargs.h stddef.h stdbool.h assert.h monetary.h printf.h \
|
||||
libgen.h dirent.h dlfcn.h link.h fmtmsg.h fnmatch.h fts.h ftw.h \
|
||||
db.h grp.h nsswitch.h pthread_np.h pwd.h ttyent.h \
|
||||
stringlist.h glob.h a.out.h elf-hints.h nlist.h spawn.h \
|
||||
readpassphrase.h setjmp.h elf.h ulimit.h utime.h wordexp.h \
|
||||
complex.h semaphore.h uchar.h iconv.h termios.h \
|
||||
xlocale.h runetype.h \
|
||||
|
||||
copyIncludes $includedir sys/sys \
|
||||
syslog.h fcntl.h stdint.h sched.h ktrace.h _semaphore.h ucontext.h errno.h
|
||||
|
||||
cp lib/msun/src/math.h $includedir
|
||||
cp contrib/libc-vis/vis.h $includedir
|
||||
|
||||
copyIncludes $includedir/rpc include/rpc \
|
||||
rpc.h xdr.h auth.h clnt_stat.h clnt.h clnt_soc.h rpc_msg.h \
|
||||
auth_unix.h auth_des.h svc.h svc_soc.h svc_auth.h pmap_clnt.h \
|
||||
pmap_prot.h rpcb_clnt.h rpcent.h des_crypt.h des.h nettype.h \
|
||||
rpcsec_gss.h raw.h rpc_com.h
|
||||
|
||||
cp sys/rpc/rpcb_prot.h $includedir/rpc
|
||||
|
||||
copyIncludes $includedir/rpcsvc include/rpcsvc \
|
||||
yp_prot.h ypclnt.h nis_tags.h nislib.h
|
||||
|
||||
rpcgen_ include/rpcsvc/nis.x $includedir/rpcsvc/nis.h
|
||||
rpcgen_ include/rpcsvc/crypt.x $includedir/rpcsvc/crypt.h
|
||||
|
||||
mkdir $includedir/gssapi
|
||||
cp include/gssapi/gssapi.h $includedir/gssapi
|
||||
|
||||
copyIncludes $includedir/arpa include/arpa \
|
||||
inet.h ftp.h nameser.h nameser_compat.h telnet.h tftp.h
|
||||
|
||||
copyIncludes $includedir/vm sys/vm vm_param.h vm.h pmap.h
|
||||
|
||||
copyIncludes $includedir/net sys/net \
|
||||
if.h if_dl.h if_tun.h if_types.h radix.h route.h
|
||||
|
||||
copyIncludes $includedir/netinet sys/netinet \
|
||||
in.h in_systm.h ip.h tcp.h
|
||||
|
||||
mkdir -p $includedir/netinet6
|
||||
cp sys/netinet6/in6.h $includedir/netinet6
|
||||
|
||||
mkdir -p $includedir/bsm
|
||||
cp sys/bsm/audit.h $includedir/bsm
|
||||
|
||||
copyIncludes $includedir/sys sys/sys \
|
||||
_types.h limits.h cdefs.h _null.h types.h _pthreadtypes.h \
|
||||
syslimits.h select.h _sigset.h _timeval.h timespec.h \
|
||||
_timespec.h stat.h signal.h unistd.h time.h param.h stdint.h \
|
||||
event.h eventhandler.h disk.h errno.h poll.h queue.h mman.h \
|
||||
stddef.h sysctl.h uio.h _iovec.h ktrace.h ioctl.h ttycom.h \
|
||||
ioccom.h filio.h sockio.h wait.h file.h fcntl.h resource.h \
|
||||
disklabel.h link_elf.h endian.h mount.h ucred.h dirent.h \
|
||||
cpuset.h socket.h un.h ttydefaults.h imgact_aout.h elf32.h \
|
||||
elf64.h elf_generic.h elf_common.h nlist_aout.h ipc.h sem.h \
|
||||
exec.h _lock.h _mutex.h statvfs.h ucontext.h syslog.h times.h \
|
||||
utsname.h elf.h mtio.h _stdint.h atomic_common.h _ucontext.h \
|
||||
_cpuset.h _bitset.h bitset.h _stdarg.h _uio.h auxv.h random.h \
|
||||
_sockaddr_storage.h termios.h _termios.h _umtx.h kerneldump.h \
|
||||
conf.h disk_zone.h counter.h time.h \
|
||||
|
||||
mkdir $includedir/sys/rpc
|
||||
cp sys/rpc/types.h $includedir/sys/rpc
|
||||
|
||||
cp -r include/xlocale $includedir/
|
||||
|
||||
ln -s sys/poll.h $includedir/poll.h
|
||||
|
||||
rm -r include # Don't need this anymore
|
||||
|
||||
cp -r $genodeHeaders/include/* $includedir/
|
||||
|
||||
mkdir -p $pkgconfigdir
|
||||
substituteAll $libcPcIn $pkgconfigdir/libc.pc
|
||||
compileStub $libcSymbols $out/lib/libc.lib.so
|
||||
ln -s $out/lib/libc.lib.so $out/lib/libc.so
|
||||
ln -s $out/lib $out/lib64
|
||||
|
||||
}
|
||||
|
||||
|
||||
genericBuild
|
@ -0,0 +1,8 @@
|
||||
Name: libc
|
||||
Description: Genode C runtime library
|
||||
URL: https://genode.org/
|
||||
Version: @version@
|
||||
Requires: genode-libports
|
||||
Requires.private: vfs
|
||||
Cflags: -D__FreeBSD__=12 -D__GENODE__ -fno-builtin-sin -fno-builtin-cos -fno-builtin-sinf -fno-builtin-cosf -I@includedir@
|
||||
Libs: -l:libc.lib.so
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,20 @@
|
||||
- add 'log2()' and 'log2f()' declarations
|
||||
- this patch is only needed for FreeBSD libc versions < 9
|
||||
|
||||
+++ src/lib/libc/lib/msun/src/math.h
|
||||
@@ -204,6 +204,7 @@
|
||||
double ldexp(double, int);
|
||||
double log(double);
|
||||
double log10(double);
|
||||
+double log2(double);
|
||||
double modf(double, double *); /* fundamentally !__pure2 */
|
||||
|
||||
double pow(double, double);
|
||||
@@ -317,6 +318,7 @@
|
||||
int ilogbf(float) __pure2;
|
||||
float ldexpf(float, int);
|
||||
float log10f(float);
|
||||
+float log2f(float);
|
||||
float log1pf(float);
|
||||
float logf(float);
|
||||
float modff(float, float *); /* fundamentally !__pure2 */
|
@ -0,0 +1,44 @@
|
||||
diff --git a/src/lib/libc/contrib/tzcode/stdtime/localtime.c b/src/lib/libc/contrib/tzcode/stdtime/localtime.c
|
||||
index 3c66924..05c01ae 100644
|
||||
--- src/lib/libc/contrib/tzcode/stdtime/localtime.c
|
||||
+++ src/lib/libc/contrib/tzcode/stdtime/localtime.c
|
||||
@@ -1935,6 +1935,10 @@ time2sub(struct tm *const tmp,
|
||||
lo *= 2;
|
||||
hi = -(lo + 1);
|
||||
}
|
||||
+
|
||||
+ lo = TIME_T_MIN;
|
||||
+ hi = TIME_T_MAX;
|
||||
+
|
||||
for ( ; ; ) {
|
||||
t = lo / 2 + hi / 2;
|
||||
if (t < lo)
|
||||
diff --git a/src/lib/libc/contrib/tzcode/stdtime/private.h b/src/lib/libc/contrib/tzcode/stdtime/private.h
|
||||
index 354a78b..8300ba0 100644
|
||||
--- src/lib/libc/contrib/tzcode/stdtime/private.h
|
||||
+++ src/lib/libc/contrib/tzcode/stdtime/private.h
|
||||
@@ -251,6 +251,24 @@ const char * scheck(const char * string, const char * format);
|
||||
1 + TYPE_SIGNED(type))
|
||||
#endif /* !defined INT_STRLEN_MAXIMUM */
|
||||
|
||||
+#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
|
||||
+
|
||||
+/* Max and min values of the integer type T, of which only the bottom
|
||||
+ B bits are used, and where the highest-order used bit is considered
|
||||
+ to be a sign bit if T is signed. */
|
||||
+#define MAXVAL(t, b) \
|
||||
+ ((t) (((t) 1 << ((b) - 1 - TYPE_SIGNED(t))) \
|
||||
+ - 1 + ((t) 1 << ((b) - 1 - TYPE_SIGNED(t)))))
|
||||
+#define MINVAL(t, b) \
|
||||
+ ((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
|
||||
+
|
||||
+/* The extreme time values, assuming no padding. */
|
||||
+#define TIME_T_MIN_NO_PADDING MINVAL(time_t, TYPE_BIT(time_t))
|
||||
+#define TIME_T_MAX_NO_PADDING MAXVAL(time_t, TYPE_BIT(time_t))
|
||||
+
|
||||
+# define TIME_T_MIN TIME_T_MIN_NO_PADDING
|
||||
+# define TIME_T_MAX TIME_T_MAX_NO_PADDING
|
||||
+
|
||||
/*
|
||||
** INITIALIZE(x)
|
||||
*/
|
@ -0,0 +1,12 @@
|
||||
--- src/lib/libc/lib/libc/stdio/printfcommon.h.orig 2019-04-16 12:35:21.549592905 +0200
|
||||
+++ src/lib/libc/lib/libc/stdio/printfcommon.h 2019-04-16 12:35:34.163738398 +0200
|
||||
@@ -47,9 +47,6 @@
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
|
||||
-#define dtoa __dtoa
|
||||
-#define freedtoa __freedtoa
|
||||
-
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "floatio.h"
|
@ -0,0 +1,32 @@
|
||||
--- src/lib/libc/include/unistd.h
|
||||
+++ src/lib/libc/include/unistd.h
|
||||
@@ -510,8 +510,6 @@
|
||||
int getresuid(uid_t *, uid_t *, uid_t *);
|
||||
char *getusershell(void);
|
||||
int initgroups(const char *, gid_t);
|
||||
-int iruserok(unsigned long, int, const char *, const char *);
|
||||
-int iruserok_sa(const void *, int, int, const char *, const char *);
|
||||
int issetugid(void);
|
||||
long lpathconf(const char *, int);
|
||||
#ifndef _MKDTEMP_DECLARED
|
||||
@@ -533,20 +531,12 @@
|
||||
#endif
|
||||
int nfssvc(int, void *);
|
||||
int profil(char *, size_t, vm_offset_t, int);
|
||||
-int rcmd(char **, int, const char *, const char *, const char *, int *);
|
||||
-int rcmd_af(char **, int, const char *,
|
||||
- const char *, const char *, int *, int);
|
||||
-int rcmdsh(char **, int, const char *,
|
||||
- const char *, const char *, const char *);
|
||||
char *re_comp(const char *);
|
||||
int re_exec(const char *);
|
||||
int reboot(int);
|
||||
int revoke(const char *);
|
||||
pid_t rfork(int);
|
||||
pid_t rfork_thread(int, void *, int (*)(void *), void *);
|
||||
-int rresvport(int *);
|
||||
-int rresvport_af(int *, int);
|
||||
-int ruserok(const char *, int, const char *, const char *);
|
||||
#if __BSD_VISIBLE
|
||||
#ifndef _SELECT_DECLARED
|
||||
#define _SELECT_DECLARED
|
@ -0,0 +1,125 @@
|
||||
--- src/lib/libc/lib/libc/resolv/res_init.c.old 2019-05-07 11:26:07.854155106 +0200
|
||||
+++ src/lib/libc/lib/libc/resolv/res_init.c 2019-05-07 11:26:18.499341340 +0200
|
||||
@@ -93,18 +93,7 @@
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
|
||||
-#ifndef HAVE_MD5
|
||||
-# include "../dst/md5.h"
|
||||
-#else
|
||||
-# ifdef SOLARIS2
|
||||
-# include <sys/md5.h>
|
||||
-# elif _LIBC
|
||||
-# include <md5.h>
|
||||
-# endif
|
||||
-#endif
|
||||
-#ifndef _MD5_H_
|
||||
-# define _MD5_H_ 1 /*%< make sure we do not include rsaref md5.h file */
|
||||
-#endif
|
||||
+#include <sys/random.h>
|
||||
|
||||
#include "un-namespace.h"
|
||||
|
||||
@@ -169,6 +158,10 @@
|
||||
return (__res_vinit(statp, 0));
|
||||
}
|
||||
|
||||
+
|
||||