summaryrefslogtreecommitdiff
path: root/ports/sysdeps/tile/tilegx/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'ports/sysdeps/tile/tilegx/Makefile')
-rw-r--r--ports/sysdeps/tile/tilegx/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/ports/sysdeps/tile/tilegx/Makefile b/ports/sysdeps/tile/tilegx/Makefile
new file mode 100644
index 0000000000..d3a0e970a7
--- /dev/null
+++ b/ports/sysdeps/tile/tilegx/Makefile
@@ -0,0 +1,18 @@
+include $(common-objpfx)cflags-mcmodel-large.mk
+
+$(common-objpfx)cflags-mcmodel-large.mk: $(common-objpfx)config.make
+ mcmodel=no; \
+ $(CC) -S -o /dev/null -xc /dev/null -mcmodel=large && mcmodel=yes; \
+ echo "cflags-mcmodel-large = $$mcmodel" > $@
+
+ifeq ($(subdir),csu)
+ifeq (yes,$(cflags-mcmodel-large))
+# elf-init.c is in libc_nonshared.o (the end of the shared object) but
+# must reach the _init symbol at the very start of the shared object.
+CFLAGS-elf-init.c += -mcmodel=large
+
+# __gmon_start__ is at the very start of the shared object when linked
+# with profiling, but calls to libc.so via the PLT at the very end.
+CFLAGS-gmon-start.c += -mcmodel=large
+endif
+endif