Changes in directory llvm-test:

Makefile.programs updated: 1.245 -> 1.246
---
Log message:

Add a facility for linking test programs against the llvm-gcc libraries
that it was produced with. Some programs will use libstdc++.a or libgcc.a
in such a way that it matters which version of those libraries is linked
into the program. Leaving it to the system compiler's discretion can
lead to runtime failures in the test program. So, to ensure that your
test programs link with the right libraries, enable the make variable
LINK_WITH_LLVMGCC_LIBS


---
Diffs of the changes:  (+17 -3)

 Makefile.programs |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.245 llvm-test/Makefile.programs:1.246
--- llvm-test/Makefile.programs:1.245   Tue Nov 28 01:18:25 2006
+++ llvm-test/Makefile.programs Thu Nov 30 17:00:41 2006
@@ -94,6 +94,18 @@
 RUNSAFELY := $(PROGDIR)/RunSafelyAndStable.sh $(RUNTIMELIMIT) $(EXIT_OK)
 endif
 
+# LLVMGCCLD - This sets up the command to use for linking test programs
+# that were generated with llvm-gcc. Usually $(CC) is sufficient but, 
+# depending on libstdc++ and libgcc.a usage, it may be necessary to ensure
+# that the link is done against llvm-gcc's version of those libraries. If
+# the LINK_WITH_LLVMGCC_LIBS variable is set, then the link is done that
+# way. Unfortunately, this can't help JIT because it is always linked with
+# the libraries of lli.
+LLVMGCCLD := $(CC)
+ifdef LINK_WITH_LLVMGCC_LIBS
+LLVMGCCLD := $(CC) -L$(LLVMGCCDIR)/lib/gcc/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib
+endif
+
 ifndef STDIN_FILENAME
 STDIN_FILENAME := /dev/null
 endif
@@ -295,7 +307,7 @@
 
 $(PROGRAMS_TO_TEST:%=Output/%.cbe): \
 Output/%.cbe: Output/%.cbe.c
-       -$(CC) $< $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O2 -fno-inline 
$(TARGET_FLAGS) -o $@
+       -$(LLVMGCCLD) $< $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O2 
-fno-inline $(TARGET_FLAGS) -o $@
 
 #
 # Compile a linked program to machine code with LLC.
@@ -321,11 +333,13 @@
 #
 $(PROGRAMS_TO_TEST:%=Output/%.llc): \
 Output/%.llc: Output/%.llc.s
-       -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS) -o $@
+       -$(LLVMGCCLD) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
+         $(TARGET_FLAGS) $(LDFLAGS) -o $@
 
 $(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
 Output/%.llc-beta: Output/%.llc-beta.s
-       -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS) -o $@
+       -$(LLVMGCCLD) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
+         $(TARGET_FLAGS) $(LDFLAGS) -o $@
 
 
 #



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to