From 88b822671057446b0481ca32d10755e0f776a140 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sat, 10 Jan 2015 15:28:00 -0500 Subject: [PATCH] compiler: add `Platform::supports_linker_script` Signed-off-by: Jean Privat --- src/compiler/android_platform.nit | 2 ++ src/compiler/emscripten_platform.nit | 1 + src/compiler/separate_compiler.nit | 2 +- src/platform.nit | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/android_platform.nit b/src/compiler/android_platform.nit index 5d6d312..950125d 100644 --- a/src/compiler/android_platform.nit +++ b/src/compiler/android_platform.nit @@ -36,6 +36,8 @@ class AndroidPlatform redef fun supports_libunwind do return false + redef fun supports_linker_script do return false + redef fun toolchain(toolcontext) do return new AndroidToolchain(toolcontext) end diff --git a/src/compiler/emscripten_platform.nit b/src/compiler/emscripten_platform.nit index 0a262fc..6332098 100644 --- a/src/compiler/emscripten_platform.nit +++ b/src/compiler/emscripten_platform.nit @@ -33,6 +33,7 @@ class EmscriptenPlatform redef fun supports_libunwind do return false redef fun supports_libgc do return false + redef fun supports_linker_script do return false redef fun toolchain(toolcontext) do return new EnscriptenToolchain(toolcontext) end diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index cf6a516..2d98fb6 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -258,7 +258,7 @@ class SeparateCompiler if m isa MEntity then if modelbuilder.toolcontext.opt_inline_coloring_numbers.value then self.provide_declaration(m.const_color, "#define {m.const_color} {color}") - else if not modelbuilder.toolcontext.opt_colors_are_symbols.value then + else if not modelbuilder.toolcontext.opt_colors_are_symbols.value or not v.compiler.target_platform.supports_linker_script then self.provide_declaration(m.const_color, "extern const int {m.const_color};") v.add("const int {m.const_color} = {color};") else diff --git a/src/platform.nit b/src/platform.nit index 54a9eaa..5b7f7a5 100644 --- a/src/platform.nit +++ b/src/platform.nit @@ -112,4 +112,7 @@ class Platform # Does this platform declare its own main function? If so, we won't generate one in Nit. fun no_main: Bool do return false + + # Does the platform accepts linker scripts? + fun supports_linker_script: Bool do return true end -- 1.7.9.5