aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreao <andreao@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-30 22:29:22 +0000
committerandreao <andreao@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-30 22:29:22 +0000
commitd445ba64913f976d55b39ae07478102d0d8cead6 (patch)
treeee0a7a13b04b3c701b95dbc4660fdd592fe0f969
parent12cb1b77a28f096159eceb97d2c26c7bbd9a1664 (diff)
- check which cli binutils are used (DotGnu or Mono based)
configure automatically the compiler options for them - small changes needed when using Mono ilasm - when using binutils based on Mono always put externals in the fake assembly ExternalAssembly - add option to -mthreads to tell the Mono based linker it has to create a runtime that is thread safe git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/st/cli-be@145321 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/config.gcc3
-rw-r--r--gcc/config/cil32/cil32.h13
-rw-r--r--gcc/config/cil32/cil32.opt4
-rw-r--r--gcc/config/cil32/emit-cil.c35
-rw-r--r--gcc/config/cil32/emit-hints.c2
-rw-r--r--libgcc4net/gcc4net.cs4
6 files changed, 44 insertions, 17 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 510d578a21e..c8296bca709 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -859,6 +859,9 @@ cil32-*-*)
extra_objs="bb-layout.o bit-stream.o cil-refs.o cil-stack.o cil-stmt.o emit-cil.o emit-hints.o gimple-to-cil.o missing-protos.o peephole.o remove-convs.o remove-temps.o simp-cond.o tree-simp-cil-early.o cil-builtins.o"
tm_file="${tm_file} cil32/cil-types.h"
target_gtfiles="\$(srcdir)/config/cil32/cil-builtins.c \$(srcdir)/config/cil32/cil-refs.c \$(srcdir)/config/cil32/cil-stmt.c"
+ if ${gcc_cv_ld} -h | grep GCC4CLI > /dev/null; then
+ tm_defines="${tm_defines} MONO_BINUTILS=1"
+ fi
;;
cris-*-aout)
tm_file="dbxelf.h ${tm_file} cris/aout.h"
diff --git a/gcc/config/cil32/cil32.h b/gcc/config/cil32/cil32.h
index 03516b5c3f6..9277887ca49 100644
--- a/gcc/config/cil32/cil32.h
+++ b/gcc/config/cil32/cil32.h
@@ -42,11 +42,16 @@ Erven Rohou <erven.rohou@st.com>
#define TARGET_DECLARE_VARIABLE(STREAM,DECL) emit_cil_decl(STREAM,DECL)
/* Node: Driver */
-
-#define CC1_SPEC "%{!mgcc4net-linker:-mopensystemc}"
+#define CPP_SPEC "%{mthreads:-D_MTHREADS}"
+#if defined(MONO_BINUTILS)
+#define CC1_SPEC "-mgcc4net-linker"
+#define LIBGCC_SPEC ""
+#else
+#define CC1_SPEC "-mopensystemc"
+#define LIBGCC_SPEC "-l gcc4net.dll"
+#endif
#define LIB_SPEC "-l libstd.dll"
-#define LIBGCC_SPEC "%{!mgcc4net-linker:-l gcc4net.dll}"
-#define LINK_SPEC "%{shared:--shared}"
+#define LINK_SPEC "%{shared:--shared} %{mthreads:-mt}"
#define STARTFILE_SPEC ""
#define ENDFILE_SPEC ""
diff --git a/gcc/config/cil32/cil32.opt b/gcc/config/cil32/cil32.opt
index 3431f6a543e..75e595fbf38 100644
--- a/gcc/config/cil32/cil32.opt
+++ b/gcc/config/cil32/cil32.opt
@@ -68,3 +68,7 @@ Assume target CPU is configured as big endian
mlittle-endian
Target Report RejectNegative Mask(LITTLE_ENDIAN)
Assume target CPU is configured as little endian
+
+mthreads
+Target Report RejectNegative
+Target supports Threads
diff --git a/gcc/config/cil32/emit-cil.c b/gcc/config/cil32/emit-cil.c
index c244e38e0e8..1e5e128e41c 100644
--- a/gcc/config/cil32/emit-cil.c
+++ b/gcc/config/cil32/emit-cil.c
@@ -349,9 +349,9 @@ dump_valuetype_name (FILE *file, tree t)
gcc_assert (DECL_P (name) || TREE_CODE (name) == IDENTIFIER_NODE);
if (builtin_p)
- fprintf (file, "[gcc4net]gcc4net.");
-
- fputs ("'", file);
+ fprintf (file, "[gcc4net]'gcc4net.");
+ else
+ fputs ("'", file);
if (TREE_CODE (name) == IDENTIFIER_NODE)
str = IDENTIFIER_POINTER (name);
@@ -1150,7 +1150,7 @@ emit_prefixes (FILE *file, const_cil_stmt stmt)
|| (opcode == CIL_LDFLD) || (opcode == CIL_STFLD))
{
if (cil_prefix_unaligned (stmt) != 0)
- fprintf (file, "\n\tunaligned.%d", cil_prefix_unaligned (stmt));
+ fprintf (file, "\n\tunaligned. %d", cil_prefix_unaligned (stmt));
}
else if ((opcode == CIL_CPBLK) || (opcode == CIL_INITBLK)
|| ((opcode >= CIL_LDIND_I1) && (opcode <= CIL_LDIND_I))
@@ -1201,16 +1201,24 @@ emit_ldsflda (FILE *file, const_cil_stmt stmt)
gcc_assert (TREE_CODE (field) == VAR_DECL);
if (COMPLETE_TYPE_P (TREE_TYPE (field)))
- dump_type (file, TREE_TYPE (field), true, false);
- else
- fprintf (file, "native int");
+ {
+ dump_type (file, TREE_TYPE (field), true, false);
- fprintf (file, " ");
+ fprintf (file, " ");
- if (TARGET_GCC4NET_LINKER && DECL_EXTERNAL (field) && TREE_PUBLIC (field))
- fprintf (file, "[ExternalAssembly]ExternalAssembly::");
+ if (TARGET_GCC4NET_LINKER && DECL_EXTERNAL (field) && TREE_PUBLIC (field))
+ fprintf (file, "[ExternalAssembly]ExternalAssembly::");
- dump_decl_name (file, field);
+ dump_decl_name (file, field);
+ }
+ else
+ {
+ fprintf (file, "native int ");
+ /* Global Variable with incomplete type, consider it an External definition */
+ if (TARGET_GCC4NET_LINKER)
+ fprintf (file, "[ExternalAssembly]ExternalAssembly::");
+ dump_decl_name (file, field);
+ }
}
}
@@ -1429,7 +1437,10 @@ emit_builtin_call (FILE *file, const_cil_stmt call)
break;
case BUILT_IN_TRAP:
- fprintf (file, "\n\tcall\tvoid 'abort' ()");
+ if (TARGET_GCC4NET_LINKER)
+ fprintf (file, "\n\tcall\tvoid [ExternalAssembly]ExternalAssembly::abort ()");
+ else
+ fprintf (file, "\n\tcall\tvoid abort ()");
return true;
default:
diff --git a/gcc/config/cil32/emit-hints.c b/gcc/config/cil32/emit-hints.c
index 4f8256a2e35..cad7ff3682b 100644
--- a/gcc/config/cil32/emit-hints.c
+++ b/gcc/config/cil32/emit-hints.c
@@ -346,7 +346,7 @@ basic_block_frequency_emit (FILE *file)
dump_compressed_int (file, emitted_bbs);
for (tmp_ptr = start_bb_freq_coded; tmp_ptr < bb_freq_coded; ++tmp_ptr)
fprintf (file, "%02x ", *tmp_ptr);
- fputs ("00 00, 01 00 ", file);
+ fputs ("00 00/*,*/ 01 00 ", file);
/* Free memory for basic block frequencies bit stream */
gcc_assert (bb_freq_coded - start_bb_freq_coded <= emitted_bbs);
diff --git a/libgcc4net/gcc4net.cs b/libgcc4net/gcc4net.cs
index c2faf7eeb0c..b9f081ff4f4 100644
--- a/libgcc4net/gcc4net.cs
+++ b/libgcc4net/gcc4net.cs
@@ -313,6 +313,10 @@ namespace gcc4net {
public sealed class CDynamicLibrary : Attribute {
public CDynamicLibrary () { }
}
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class MultiThreaded : Attribute {
+ public MultiThreaded () { }
+ }
[AttributeUsage (AttributeTargets.Method)]
public sealed class Initializer : Attribute {
public Initializer () { }