Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBernhard Urban-Forster <lewurm@gmail.com>2020-02-11 11:49:21 +0300
committerGitHub <noreply@github.com>2020-02-11 11:49:21 +0300
commit4cd05a7be4f0ef79d47e0674a939a41d28427f1e (patch)
tree9906fb2736e177c2e4600b43c5a9466197fcfd8e /tools
parentb0c434280d60f9bb2f14f8369d0c09e2ad329f23 (diff)
[cross] support arm-linux-gnueabihf cross compiling with netcore (#18714)
* [cross] support arm-linux-gnueabihf cross compiling with netcore Some notes on usage: ```console $ sudo apt install g{++,cc}-gnu-linux-gnueabihf python3-pip $ ./autogen.sh --disable-boehm --target=arm-linux-gnueabihf \ --with-cross-offsets=arm-linux-gnueabihf-cross-offsets.h \ --with-core=only \ CFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer" \ CXXFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer" $ make -C tools/offsets-tool-py/ $ python3 tools/offsets-tool-py/offsets-tool.py \ --targetdir=/home/lewurm/work/mono \ --abi=arm-linux-gnueabihf \ --monodir=/home/lewurm/work/mono \ --outfile=arm-linux-gnueabihf-cross-offsets.h \ --libclang=/usr/lib/x86_64-linux-gnu/libclang-7.so.1 \ --sysroot=/usr/arm-linux-gnueabihf \ --netcore ``` * better include path guessing
Diffstat (limited to 'tools')
-rw-r--r--tools/offsets-tool-py/offsets-tool.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/offsets-tool-py/offsets-tool.py b/tools/offsets-tool-py/offsets-tool.py
index f568a132b7e..d44e436e229 100644
--- a/tools/offsets-tool-py/offsets-tool.py
+++ b/tools/offsets-tool-py/offsets-tool.py
@@ -9,6 +9,7 @@ import clang.cindex
IOS_DEFINES = ["HOST_DARWIN", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "_XOPEN_SOURCE"]
ANDROID_DEFINES = ["HOST_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"]
+LINUX_DEFINES = ["HOST_LINUX", "MONO_CROSS_COMPILE", "USE_MONO_CTX"]
class Target:
def __init__(self, arch, platform, others):
@@ -61,6 +62,8 @@ class OffsetsTool:
parser.add_argument ('--targetdir', dest='target_path', help='path to mono tree configured for target', required=True)
parser.add_argument ('--abi=', dest='abi', help='ABI triple to generate', required=True)
parser.add_argument ('--sysroot=', dest='sysroot', help='path to sysroot headers of target')
+ parser.add_argument ('--include-prefix=', dest='include_prefix', help='prefix path to include directory of target')
+ parser.add_argument ('--netcore', dest='netcore', help='target runs with netcore', action='store_true')
args = parser.parse_args ()
if not args.libclang or not os.path.isfile (args.libclang):
@@ -84,6 +87,33 @@ class OffsetsTool:
self.target = Target ("TARGET_WASM", None, [])
self.target_args += ["-target", args.abi]
+ # Linux
+ elif "arm-linux-gnueabihf" == args.abi:
+ self.target = Target ("TARGET_ARM", None, ["ARM_FPU_VFP", "HAVE_ARMV5", "HAVE_ARMV6", "HAVE_ARMV7"] + LINUX_DEFINES)
+ self.target_args += ["--target=arm---gnueabihf"]
+ self.target_args += ["-I", args.sysroot + "/include"]
+
+ if args.include_prefix:
+ if not os.path.isdir (args.include_prefix):
+ print ("provided path via --include-prefix (\"" + args.include_prefix + "\") doesn't exist.", file=sys.stderr)
+ sys.exit (1)
+ self.target_args += ["-I", args.include_prefix + "/include"]
+ self.target_args += ["-I", args.include_prefix + "/include-fixed"]
+ else:
+ found = False
+ for i in range (11, 5, -1):
+ prefix = "/usr/lib/gcc-cross/" + args.abi + "/" + str (i)
+ if not os.path.isdir (prefix):
+ continue
+ found = True
+ self.target_args += ["-I", prefix + "/include"]
+ self.target_args += ["-I", prefix + "/include-fixed"]
+ break
+
+ if not found:
+ print ("could not find a valid include path for target, provide one via --include-prefix=<path>.", file=sys.stderr)
+ sys.exit (1)
+
# iOS
elif "arm-apple-darwin10" == args.abi:
require_sysroot (args)
@@ -138,6 +168,9 @@ class OffsetsTool:
print ("ABI '" + args.abi + "' is not supported.", file=sys.stderr)
sys.exit (1)
+ if args.netcore:
+ self.target_args += ["-DENABLE_NETCORE"]
+
self.args = args
#