Add an early arm toolchain
This isn't fully functionnal yet
This commit is contained in:
commit
4808f05671
10 files changed
+580
No files matched your search
+130
@@ -0,0 +1,130 @@
|
||||
FROM videolan-base-sid:latest
|
||||
|
||||
MAINTAINER Hugo Beauzée-Luyssen <hugo@beauzee.fr>
|
||||
|
||||
RUN apt-get update -qq && apt-get install -qqy \
|
||||
git wget bzip2 file libwine-dev unzip libtool pkg-config cmake \
|
||||
build-essential automake texinfo ragel yasm p7zip-full gettext autopoint
|
||||
|
||||
|
||||
RUN git config --global user.name "VideoLAN Buildbot" && \
|
||||
git config --global user.email buildbot@videolan.org
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY patches/ /build/patches
|
||||
|
||||
RUN git clone -b release_38 https://github.com/llvm-mirror/llvm.git --depth=1
|
||||
RUN cd llvm/tools && \
|
||||
git clone -b release_38 --depth=1 https://github.com/llvm-mirror/clang.git && \
|
||||
git clone --depth=1 -b release_38 https://github.com/llvm-mirror/lld.git --depth=1
|
||||
|
||||
RUN cd llvm/projects && \
|
||||
git clone -b release_38 --depth=1 https://github.com/llvm-mirror/libcxx.git && \
|
||||
git clone -b release_38 --depth=1 https://github.com/llvm-mirror/libcxxabi.git && \
|
||||
git clone https://github.com/llvm-mirror/libunwind.git -b release_38 --depth=1
|
||||
|
||||
RUN cd llvm/tools/clang && \
|
||||
git am /build/patches/clang-0001.patch && \
|
||||
git am /build/patches/clang-0002.patch
|
||||
|
||||
RUN cd llvm/tools/lld && \
|
||||
git am /build/patches/lld-0001.patch
|
||||
|
||||
RUN cd llvm/projects/libcxx && git am /build/patches/libcxx-0001.patch
|
||||
|
||||
RUN git clone --depth=1 git://git.code.sf.net/p/mingw-w64/mingw-w64
|
||||
RUN cd mingw-w64 && \
|
||||
git am /build/patches/mingw-0001.patch && \
|
||||
git am /build/patches/mingw-0002.patch
|
||||
|
||||
RUN git clone -b release_38 --depth=1 https://github.com/llvm-mirror/compiler-rt.git
|
||||
|
||||
RUN mkdir /build/prefix
|
||||
|
||||
# Build LLVM
|
||||
RUN cd llvm && mkdir build && cd build && cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="/build/prefix" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_TARGETS_TO_BUILD="ARM;CppBackend;X86" \
|
||||
-DLLVM_ENABLE_ASSERTIONS=OFF \
|
||||
-DLLVM_ENABLE_EH=ON \
|
||||
-DLLVM_ENABLE_THREADS=ON \
|
||||
-DLLVM_ENABLE_RTTI=ON \
|
||||
-DLLVM_ENABLE_FFI=OFF \
|
||||
-DLLVM_ENABLE_SPHINX=OFF \
|
||||
-DCMAKE_CXX_FLAGS="-D_GNU_SOURCE -D_LIBCPP_HAS_NO_CONSTEXPR" \
|
||||
../ && \
|
||||
make -j4 && \
|
||||
make install
|
||||
|
||||
#FIXME: Move this UP!
|
||||
ENV TOOLCHAIN_PREFIX=/build/prefix
|
||||
ENV TARGET_TUPLE=armv7-w64-mingw32
|
||||
ENV MINGW_PREFIX=$TOOLCHAIN_PREFIX/$TARGET_TUPLE
|
||||
ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH
|
||||
|
||||
RUN mkdir $MINGW_PREFIX
|
||||
RUN ln -s $MINGW_PREFIX $TOOLCHAIN_PREFIX/mingw
|
||||
|
||||
RUN cd mingw-w64/mingw-w64-tools/genlib && \
|
||||
mkdir build && cd build && \
|
||||
../configure --prefix=$TOOLCHAIN_PREFIX \
|
||||
--target=$TARGET_TUPLE && \
|
||||
make -j4 && \
|
||||
make install
|
||||
|
||||
RUN cd mingw-w64/mingw-w64-headers && mkdir build && cd build && \
|
||||
../configure --host=$TARGET_TUPLE --prefix=$MINGW_PREFIX && \
|
||||
make install
|
||||
|
||||
# Install the usual $TUPLE-clang binary
|
||||
COPY wrappers/* $TOOLCHAIN_PREFIX/bin/
|
||||
|
||||
ENV CC=armv7-w64-mingw32-clang
|
||||
ENV CXX=armv7-w64-mingw32-clang++
|
||||
ENV AR=llvm-ar
|
||||
ENV RANLIB=llvm-ranlib
|
||||
ENV LD=lld
|
||||
ENV AS=llvm-as
|
||||
|
||||
# Build mingw with our freshly built cross compiler
|
||||
RUN cd mingw-w64/mingw-w64-crt && \
|
||||
autoreconf -vif && \
|
||||
mkdir build && cd build && \
|
||||
../configure --host=$TARGET_TUPLE --prefix=$MINGW_PREFIX \
|
||||
--disable-lib32 --disable-lib64 --enable-libarm32 \
|
||||
--enable-secure-api \
|
||||
--with-genlib && \
|
||||
make -j4 && \
|
||||
make install
|
||||
|
||||
RUN cp /build/mingw-w64/mingw-w64-libraries/winpthreads/include/* $MINGW_PREFIX/include/
|
||||
|
||||
#Work around upstream issue with capital W windows.h
|
||||
RUN ln -s /build/prefix/armv7-w64-mingw32/include/windows.h /build/prefix/armv7-w64-mingw32/include/Windows.h
|
||||
|
||||
# Manually build compiler-rt as a standalone project
|
||||
RUN cd compiler-rt && \
|
||||
make clang_mingw-builtins-arm
|
||||
|
||||
RUN mkdir -p /build/prefix/lib/clang/3.8.1/lib/windows && \
|
||||
cp /build/compiler-rt/clang_mingw/builtins-arm/libcompiler_rt.a /build/prefix/lib/clang/3.8.1/lib/windows/libclang_rt.builtins-arm.a
|
||||
|
||||
RUN cd mingw-w64/mingw-w64-libraries && cd winstorecompat && \
|
||||
autoreconf -vif && \
|
||||
mkdir build && cd build && \
|
||||
../configure --host=$TARGET_TUPLE --prefix=$MINGW_PREFIX && make && make install
|
||||
|
||||
RUN cd /build/mingw-w64/mingw-w64-tools/widl && \
|
||||
mkdir build && cd build && \
|
||||
CC=gcc \
|
||||
../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE && \
|
||||
make -j4 && \
|
||||
make install
|
||||
|
||||
#RUN cd libunwind && mkdir build && cd build && \
|
||||
# CXXFLAGS="-nodefaultlibs" \
|
||||
# LDFLAGS="/build/prefix/armv7-w64-mingw32/lib/crt2.o /build/prefix/armv7-w64-mingw32/lib/crtbegin.o -lmingw32 /build/prefix/bin/../lib/clang/3.8.1/lib/windows/libclang_rt.builtins-arm.a -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 /build/prefix/armv7-w64-mingw32/lib/crtend.o" \
|
||||
# cmake -DCMAKE_CXX_COMPILER_WORKS=TRUE -DLLVM_ENABLE_LIBCXX=TRUE ..
|
||||
#
|
||||
@@ -0,0 +1,4 @@
|
||||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t jenkins-vlc-winrt-arm:latest .
|
||||
@@ -0,0 +1,37 @@
|
||||
From de8c959c54b4591b13d7ab0c348bac8d25cc856a Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Wed, 16 Dec 2015 02:07:06 -0800
|
||||
Subject: [PATCH] use lld and compiler-rt by default
|
||||
|
||||
|
||||
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
|
||||
index 257750e..831b7ab 100644
|
||||
--- a/lib/Driver/ToolChains.h
|
||||
+++ b/lib/Driver/ToolChains.h
|
||||
@@ -649,6 +649,10 @@ public:
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
|
||||
+ RuntimeLibType GetDefaultRuntimeLibType() const override {
|
||||
+ return RuntimeLibType::RLT_CompilerRT;
|
||||
+ }
|
||||
+
|
||||
protected:
|
||||
Tool *getTool(Action::ActionClass AC) const override;
|
||||
Tool *buildLinker() const override;
|
||||
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
|
||||
index 20a1035..ec3e42d 100644
|
||||
--- a/lib/Driver/Tools.cpp
|
||||
+++ b/lib/Driver/Tools.cpp
|
||||
@@ -9600,7 +9600,7 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
// handled somewhere else.
|
||||
Args.ClaimAllArgs(options::OPT_w);
|
||||
|
||||
- StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
|
||||
+ StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "lld");
|
||||
if (LinkerName.equals_lower("lld")) {
|
||||
CmdArgs.push_back("-flavor");
|
||||
CmdArgs.push_back("gnu");
|
||||
--
|
||||
2.6.3
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From a6ab1bd3b1a1f1e4eb8b8490dac5f1b5b4b72e6a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
|
||||
Date: Mon, 2 May 2016 15:58:31 +0200
|
||||
Subject: [PATCH] Manually revert 0e2452f3055e2e2cad06a55c5ca9c2be13404781
|
||||
|
||||
This re-enables mingw detection
|
||||
---
|
||||
lib/Driver/MinGWToolChain.cpp | 14 ++++----------
|
||||
1 file changed, 4 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lib/Driver/MinGWToolChain.cpp b/lib/Driver/MinGWToolChain.cpp
|
||||
index 938440b..a1dc25b 100644
|
||||
--- a/lib/Driver/MinGWToolChain.cpp
|
||||
+++ b/lib/Driver/MinGWToolChain.cpp
|
||||
@@ -66,23 +66,17 @@ MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
: ToolChain(D, Triple, Args) {
|
||||
getProgramPaths().push_back(getDriver().getInstalledDir());
|
||||
|
||||
-// In Windows there aren't any standard install locations, we search
|
||||
-// for gcc on the PATH. In Linux the base is always /usr.
|
||||
-#ifdef LLVM_ON_WIN32
|
||||
+ // On Windows if there is no sysroot we search for gcc on the PATH.
|
||||
if (getDriver().SysRoot.size())
|
||||
Base = getDriver().SysRoot;
|
||||
+#ifdef LLVM_ON_WIN32
|
||||
else if (llvm::ErrorOr<std::string> GPPName =
|
||||
llvm::sys::findProgramByName("gcc"))
|
||||
Base = llvm::sys::path::parent_path(
|
||||
llvm::sys::path::parent_path(GPPName.get()));
|
||||
- else
|
||||
- Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
|
||||
-#else
|
||||
- if (getDriver().SysRoot.size())
|
||||
- Base = getDriver().SysRoot;
|
||||
- else
|
||||
- Base = "/usr";
|
||||
#endif
|
||||
+ if (!Base.size())
|
||||
+ Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
|
||||
|
||||
Base += llvm::sys::path::get_separator();
|
||||
findGccLibDir();
|
||||
--
|
||||
2.8.1
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
Index: include/type_traits
|
||||
===================================================================
|
||||
--- include/type_traits
|
||||
+++ include/type_traits
|
||||
@@ -1147,10 +1147,10 @@
|
||||
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
|
||||
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
|
||||
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
|
||||
-// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
|
||||
-#if !defined(_LIBCPP_MSVC)
|
||||
+// PE COFF does not support alignment beyond 8192 (=0x2000)
|
||||
+#if !defined(_WIN32)
|
||||
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
|
||||
-#endif // !_LIBCPP_MSVC
|
||||
+#endif // !_WIN32
|
||||
|
||||
#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
From 38ed8e461edd6df0c7f2ba2d0e8d36f6288d231e Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Wed, 28 Oct 2015 19:32:16 +0000
|
||||
Subject: [PATCH] add support for gnu arguments in lld coff
|
||||
|
||||
|
||||
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
|
||||
index f528daf..34f422c 100644
|
||||
--- a/COFF/Driver.cpp
|
||||
+++ b/COFF/Driver.cpp
|
||||
@@ -119,6 +119,7 @@ void LinkerDriver::parseDirectives(StringRef S) {
|
||||
case OPT_editandcontinue:
|
||||
case OPT_guardsym:
|
||||
case OPT_throwingnew:
|
||||
+ case OPT_aligncomm:
|
||||
break;
|
||||
default:
|
||||
error(Twine(Arg->getSpelling()) + " is not allowed in .drectve");
|
||||
@@ -147,6 +148,31 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) {
|
||||
return Filename;
|
||||
}
|
||||
|
||||
+// Searches a given library from input search paths, which are filled
|
||||
+// from -L command line switches. Returns a path to an existent library file.
|
||||
+StringRef LinkerDriver::searchLibrary(StringRef Filename) {
|
||||
+// error("Unable to find library -l" + Filename);
|
||||
+
|
||||
+ std::vector<std::string> Names;
|
||||
+ if (Filename[0] == ':') {
|
||||
+ Names.push_back(Filename.drop_front());
|
||||
+ } else {
|
||||
+ //if (!Config->Static)
|
||||
+ Names.push_back(("lib" + Filename + ".dll.a").str());
|
||||
+ Names.push_back(("lib" + Filename + ".a").str());
|
||||
+ }
|
||||
+
|
||||
+ for (const std::string &Name : Names) {
|
||||
+ for (StringRef Dir : SearchPaths) {
|
||||
+ SmallString<128> Path = Dir;
|
||||
+ llvm::sys::path::append(Path, Name.c_str());
|
||||
+ if (llvm::sys::fs::exists(Path.str()))
|
||||
+ return Alloc.save(Path.str());
|
||||
+ }
|
||||
+ }
|
||||
+ error("Unable to find library -l" + Filename);
|
||||
+}
|
||||
+
|
||||
// Resolves a file path. This never returns the same path
|
||||
// (in that case, it returns None).
|
||||
Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
|
||||
@@ -438,6 +464,9 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
// for /defaultlib option.
|
||||
std::vector<StringRef> Paths;
|
||||
std::vector<MemoryBufferRef> MBs;
|
||||
+ for (auto *Arg : Args.filtered(OPT_l))
|
||||
+ if (Optional<StringRef> Path = searchLibrary(Arg->getValue()))
|
||||
+ Paths.push_back(*Path);
|
||||
for (auto *Arg : Args.filtered(OPT_INPUT))
|
||||
if (Optional<StringRef> Path = findFile(Arg->getValue()))
|
||||
Paths.push_back(*Path);
|
||||
@@ -559,7 +588,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
if (Config->ImageBase == uint64_t(-1))
|
||||
Config->ImageBase = getDefaultImageBase();
|
||||
|
||||
- Symtab.addRelative(mangle("__ImageBase"), 0);
|
||||
+ Symtab.addRelative(mangle("__image_base__"), 0);
|
||||
if (Config->Machine == I386) {
|
||||
Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
|
||||
Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
|
||||
diff --git a/COFF/Driver.h b/COFF/Driver.h
|
||||
index e50da20..c716678 100644
|
||||
--- a/COFF/Driver.h
|
||||
+++ b/COFF/Driver.h
|
||||
@@ -87,6 +87,9 @@ private:
|
||||
StringRef doFindFile(StringRef Filename);
|
||||
StringRef doFindLib(StringRef Filename);
|
||||
|
||||
+ // Searches for a gnu library
|
||||
+ StringRef searchLibrary(StringRef Path);
|
||||
+
|
||||
// Parses LIB environment which contains a list of search paths.
|
||||
void addLibSearchPaths();
|
||||
|
||||
diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp
|
||||
index 391a8ab..e876de3 100644
|
||||
--- a/COFF/DriverUtils.cpp
|
||||
+++ b/COFF/DriverUtils.cpp
|
||||
@@ -650,7 +650,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
|
||||
|
||||
class COFFOptTable : public llvm::opt::OptTable {
|
||||
public:
|
||||
- COFFOptTable() : OptTable(infoTable, true) {}
|
||||
+ COFFOptTable() : OptTable(infoTable) {}
|
||||
};
|
||||
|
||||
// Parses a given list of options.
|
||||
diff --git a/COFF/Options.td b/COFF/Options.td
|
||||
index a21b8de..3418de5 100644
|
||||
--- a/COFF/Options.td
|
||||
+++ b/COFF/Options.td
|
||||
@@ -92,6 +92,26 @@ def nosymtab : F<"nosymtab">;
|
||||
// Flags for debugging
|
||||
def lldmap : Joined<["/", "-"], "lldmap:">;
|
||||
|
||||
+
|
||||
+def output : Separate<["-"], "o">, Alias<out>;
|
||||
+def L : Joined<["-"], "L">, Alias<libpath>;
|
||||
+def e : Separate<["-"], "e">, Alias<entry>;
|
||||
+def subs : Separate<["--"], "subsystem">, Alias<subsystem>;
|
||||
+
|
||||
+def l : JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">;
|
||||
+
|
||||
+// Used to silence some gnu warnings
|
||||
+def aligncomm : P<"aligncomm", "Comm Alignment">;
|
||||
+def Bdynamic: Flag<["-"], "Bdynamic">;
|
||||
+
|
||||
+// Used to override gnu pe targets
|
||||
+def m : Separate<["-"], "m">, MetaVarName<"<emulation>">,
|
||||
+ HelpText<"Select target emulation">;
|
||||
+
|
||||
+// Select an optional flavor
|
||||
+def flavor: Separate<["-"], "flavor">,
|
||||
+ HelpText<"Flavor for linking, options are gnu/darwin/link">;
|
||||
+
|
||||
//==============================================================================
|
||||
// The flags below do nothing. They are defined only for link.exe compatibility.
|
||||
//==============================================================================
|
||||
diff --git a/lib/Driver/UniversalDriver.cpp b/lib/Driver/UniversalDriver.cpp
|
||||
index 3dea7eb..268dafb 100644
|
||||
--- a/lib/Driver/UniversalDriver.cpp
|
||||
+++ b/lib/Driver/UniversalDriver.cpp
|
||||
@@ -95,6 +95,21 @@ static Flavor strToFlavor(StringRef str) {
|
||||
.Default(Flavor::invalid);
|
||||
}
|
||||
|
||||
+//std::pair<llvm::Triple::ObjectFileFormat, IMAGE_FILE_MACHINE_TYPE> getTargetFromEmulation
|
||||
+
|
||||
+static bool isPETarget(const llvm::opt::InputArgList &parsedArgs) {
|
||||
+ llvm::opt::Arg *argMachine = parsedArgs.getLastArg(OPT_m);
|
||||
+ if (!argMachine)
|
||||
+ return false;
|
||||
+ if (argMachine->containsValue("i386pe"))
|
||||
+ return true;
|
||||
+ if (argMachine->containsValue("i386pep"))
|
||||
+ return true;
|
||||
+ if (argMachine->containsValue("thumb2pe"))
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static ProgramNameParts parseProgramName(StringRef programName) {
|
||||
SmallVector<StringRef, 3> components;
|
||||
llvm::SplitString(programName, components, "-");
|
||||
@@ -198,6 +213,12 @@ bool UniversalDriver::link(llvm::MutableArrayRef<const char *> args,
|
||||
return true;
|
||||
}
|
||||
|
||||
+ //Override gnu for pe targets to use coff
|
||||
+ if(isPETarget(parsedArgs)) {
|
||||
+ coff::link(args);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
Flavor flavor = getFlavor(args, parsedArgs);
|
||||
|
||||
// Switch to appropriate driver.
|
||||
diff --git a/lib/Driver/UniversalDriverOptions.td b/lib/Driver/UniversalDriverOptions.td
|
||||
index 14abc9c..38e620b 100644
|
||||
--- a/lib/Driver/UniversalDriverOptions.td
|
||||
+++ b/lib/Driver/UniversalDriverOptions.td
|
||||
@@ -11,6 +11,10 @@ def core : Flag<["-"], "core">,
|
||||
def target: Separate<["-"], "target">,
|
||||
HelpText<"Select the target">;
|
||||
|
||||
+// Used to override gnu pe targets
|
||||
+def m : Separate<["-"], "m">, MetaVarName<"<emulation>">,
|
||||
+ HelpText<"Select target emulation">;
|
||||
+
|
||||
def version: Flag<["-"], "version">,
|
||||
HelpText<"Display the version">;
|
||||
|
||||
--
|
||||
2.6.3
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From ca451a7a45d4876065edc6755f8aab8095914b04 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sat, 21 Nov 2015 18:43:46 -0800
|
||||
Subject: [PATCH] Handle __CTOR_LIST__ internally within mingw-w64
|
||||
|
||||
---
|
||||
mingw-w64-crt/crt/gccmain.c | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/mingw-w64-crt/crt/gccmain.c b/mingw-w64-crt/crt/gccmain.c
|
||||
index fc0e350..ba50691 100644
|
||||
--- a/mingw-w64-crt/crt/gccmain.c
|
||||
+++ b/mingw-w64-crt/crt/gccmain.c
|
||||
@@ -9,8 +9,15 @@
|
||||
#include <setjmp.h>
|
||||
|
||||
typedef void (*func_ptr) (void);
|
||||
-extern func_ptr __CTOR_LIST__[];
|
||||
-extern func_ptr __DTOR_LIST__[];
|
||||
+#define STATIC static
|
||||
+
|
||||
+STATIC func_ptr __MINGW_CTOR_LIST__[1]
|
||||
+ __attribute__ ((__used__, section(".ctors"), aligned(sizeof(func_ptr))))
|
||||
+ = { (func_ptr) (-1) };
|
||||
+
|
||||
+STATIC func_ptr __MINGW_DTOR_LIST__[1]
|
||||
+ __attribute__((section(".dtors"), aligned(sizeof(func_ptr))))
|
||||
+ = { (func_ptr) (-1) };
|
||||
|
||||
void __do_global_dtors (void);
|
||||
void __do_global_ctors (void);
|
||||
@@ -19,7 +26,7 @@ void __main (void);
|
||||
void
|
||||
__do_global_dtors (void)
|
||||
{
|
||||
- static func_ptr *p = __DTOR_LIST__ + 1;
|
||||
+ static func_ptr *p = __MINGW_DTOR_LIST__ + 1;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
@@ -31,17 +38,17 @@ __do_global_dtors (void)
|
||||
void
|
||||
__do_global_ctors (void)
|
||||
{
|
||||
- unsigned long nptrs = (unsigned long) (ptrdiff_t) __CTOR_LIST__[0];
|
||||
+ unsigned long nptrs = (unsigned long) (ptrdiff_t) __MINGW_CTOR_LIST__[0];
|
||||
unsigned long i;
|
||||
|
||||
if (nptrs == (unsigned long) -1)
|
||||
{
|
||||
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
|
||||
+ for (nptrs = 0; __MINGW_CTOR_LIST__[nptrs + 1] != 0; nptrs++);
|
||||
}
|
||||
|
||||
for (i = nptrs; i >= 1; i--)
|
||||
{
|
||||
- __CTOR_LIST__[i] ();
|
||||
+ __MINGW_CTOR_LIST__[i] ();
|
||||
}
|
||||
|
||||
atexit (__do_global_dtors);
|
||||
@@ -0,0 +1,95 @@
|
||||
From df4015f5dff1d2baa8fa3b258ea1c2866d1667a2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
|
||||
Date: Tue, 3 May 2016 17:43:59 +0200
|
||||
Subject: [PATCH] crt: Add libruntimeobject to arm lib
|
||||
|
||||
---
|
||||
mingw-w64-crt/Makefile.am | 6 ++++++
|
||||
.../libarm32/api-ms-win-core-winrt-l1-1-0.def | 9 ++++++++
|
||||
.../api-ms-win-core-winrt-string-l1-1-0.def | 25 ++++++++++++++++++++++
|
||||
mingw-w64-crt/libarm32/runtimeobject.mri | 5 +++++
|
||||
4 files changed, 45 insertions(+)
|
||||
create mode 100644 mingw-w64-crt/libarm32/api-ms-win-core-winrt-l1-1-0.def
|
||||
create mode 100644 mingw-w64-crt/libarm32/api-ms-win-core-winrt-string-l1-1-0.def
|
||||
create mode 100644 mingw-w64-crt/libarm32/runtimeobject.mri
|
||||
|
||||
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
|
||||
index daf25b0..aa198bd 100644
|
||||
--- a/mingw-w64-crt/Makefile.am
|
||||
+++ b/mingw-w64-crt/Makefile.am
|
||||
@@ -1426,9 +1426,15 @@ libarm32/libvfw32.a: libarm32/vfw32.mri libarm32/libmsvfw32.a libarm32/libavifil
|
||||
$(AR) -M < $<
|
||||
$(RANLIB) $@
|
||||
|
||||
+libarm32/libruntimeobject.a: libarm32/runtimeobject.mri libarm32/libapi-ms-win-core-winrt-string-l1-1-0.a libarm32/libapi-ms-win-core-winrt-l1-1-0.a
|
||||
+ rm -f $@
|
||||
+ $(AR) -M < $<
|
||||
+ $(RANLIB) $@
|
||||
+
|
||||
dx32_DATA =
|
||||
dx32_DATA += libarm32/libxinput.a
|
||||
dx32_DATA += libarm32/libd3dcompiler.a
|
||||
+libarm32_DATA += libarm32/libruntimeobject.a
|
||||
|
||||
libarm32/libxinput.a: libarm32/xinput1_4.def
|
||||
$(DTDEFARM32) $<
|
||||
diff --git a/mingw-w64-crt/libarm32/api-ms-win-core-winrt-l1-1-0.def b/mingw-w64-crt/libarm32/api-ms-win-core-winrt-l1-1-0.def
|
||||
new file mode 100644
|
||||
index 0000000..3c66e9b
|
||||
--- /dev/null
|
||||
+++ b/mingw-w64-crt/libarm32/api-ms-win-core-winrt-l1-1-0.def
|
||||
@@ -0,0 +1,9 @@
|
||||
+LIBRARY "api-ms-win-core-winrt-l1-1-0.dll"
|
||||
+EXPORTS
|
||||
+RoActivateInstance@8
|
||||
+RoGetActivationFactory@12
|
||||
+RoGetApartmentIdentifier@4
|
||||
+RoInitialize@4
|
||||
+RoRegisterActivationFactories@16
|
||||
+RoRevokeActivationFactories@4
|
||||
+RoUninitialize
|
||||
diff --git a/mingw-w64-crt/libarm32/api-ms-win-core-winrt-string-l1-1-0.def b/mingw-w64-crt/libarm32/api-ms-win-core-winrt-string-l1-1-0.def
|
||||
new file mode 100644
|
||||
index 0000000..c49fc51
|
||||
--- /dev/null
|
||||
+++ b/mingw-w64-crt/libarm32/api-ms-win-core-winrt-string-l1-1-0.def
|
||||
@@ -0,0 +1,25 @@
|
||||
+LIBRARY "api-ms-win-core-winrt-string-l1-1-0.dll"
|
||||
+EXPORTS
|
||||
+HSTRING_UserFree@8
|
||||
+HSTRING_UserMarshal@12
|
||||
+HSTRING_UserSize@12
|
||||
+HSTRING_UserUnmarshal@12
|
||||
+WindowsCompareStringOrdinal@12
|
||||
+WindowsConcatString@12
|
||||
+WindowsCreateString@12
|
||||
+WindowsCreateStringReference@16
|
||||
+WindowsDeleteString@4
|
||||
+WindowsDeleteStringBuffer@4
|
||||
+WindowsDuplicateString@8
|
||||
+WindowsGetStringLen@4
|
||||
+WindowsGetStringRawBuffer@8
|
||||
+WindowsInspectString@24
|
||||
+WindowsIsStringEmpty@4
|
||||
+WindowsPreallocateStringBuffer@12
|
||||
+WindowsPromoteStringBuffer@8
|
||||
+WindowsReplaceString@16
|
||||
+WindowsStringHasEmbeddedNull@8
|
||||
+WindowsSubstring@12
|
||||
+WindowsSubstringWithSpecifiedLength@16
|
||||
+WindowsTrimStringEnd@12
|
||||
+WindowsTrimStringStart@12
|
||||
diff --git a/mingw-w64-crt/libarm32/runtimeobject.mri b/mingw-w64-crt/libarm32/runtimeobject.mri
|
||||
new file mode 100644
|
||||
index 0000000..73c6bce
|
||||
--- /dev/null
|
||||
+++ b/mingw-w64-crt/libarm32/runtimeobject.mri
|
||||
@@ -0,0 +1,5 @@
|
||||
+CREATE libarm32/libruntimeobject.a
|
||||
+ADDLIB libarm32/libapi-ms-win-core-winrt-string-l1-1-0.a
|
||||
+ADDLIB libarm32/libapi-ms-win-core-winrt-l1-1-0.a
|
||||
+SAVE
|
||||
+END
|
||||
--
|
||||
2.8.1
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
$DIR/clang -target armv7-windows-gnu "$@"
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
$DIR/clang++ -target armv7-windows-gnu "$@"
|
||||
Reference in new issue
Block a user