mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-14 21:07:01 +02:00
[svn r346] Fixed #55 - llvmdc can link as fast as dmd now!
Made runtime to compile to native by default. Changed linker.cpp to link in native runtime library. This change requires a runtime rebuild as well as a new symbolic link in lib/ to tango/lib/libtango-base-llvmdc-native.a.
This commit is contained in:
+1
-2
@@ -150,7 +150,6 @@ int linkExecutable(const char* argv0)
|
||||
}
|
||||
|
||||
// default libs
|
||||
args.push_back("-ltango-base-c-llvmdc");
|
||||
args.push_back("-lpthread");
|
||||
args.push_back("-ldl");
|
||||
args.push_back("-lm");
|
||||
@@ -167,7 +166,7 @@ int linkExecutable(const char* argv0)
|
||||
std::string runtime_path(global.params.runtimePath);
|
||||
if (*runtime_path.rbegin() != '/')
|
||||
runtime_path.append("/");
|
||||
runtime_path.append("libtango-base-llvmdc.a");
|
||||
runtime_path.append("libtango-base-llvmdc-native.a");
|
||||
args.push_back(runtime_path.c_str());
|
||||
|
||||
// print link command?
|
||||
|
||||
@@ -14,6 +14,8 @@ LIB_TARGET=libtango-base-llvmdc.a
|
||||
LIB_MASK=libtango-base-llvmdc*.a
|
||||
LIB_TARGET_C=libtango-base-c-llvmdc.a
|
||||
LIB_MASK_C=libtango-base-c-llvmdc*.a
|
||||
LIB_NAME_NATIVE=libtango-base-llvmdc-native
|
||||
LIB_TARGET_NATIVE=$(LIB_NAME_NATIVE).a
|
||||
|
||||
DIR_CC=./common/tango
|
||||
DIR_RT=./compiler/llvmdc
|
||||
@@ -28,12 +30,14 @@ CC=gcc
|
||||
LC=llvm-ar rsv
|
||||
CLC=ar rsv
|
||||
DC=llvmdc
|
||||
LLVMLINK=llvm-link
|
||||
LLC=llc
|
||||
|
||||
ADD_CFLAGS=
|
||||
ADD_DFLAGS=
|
||||
|
||||
targets : lib doc
|
||||
all : lib doc
|
||||
targets : nativelib doc
|
||||
all : nativelib lib doc
|
||||
|
||||
######################################################
|
||||
|
||||
@@ -56,6 +60,23 @@ lib : $(ALL_OBJS)
|
||||
$(CLC) $(LIB_TARGET_C) `find $(DIR_CC) -name "*.o" | xargs echo`
|
||||
$(CLC) $(LIB_TARGET_C) `find $(DIR_RT) -name "*.o" | xargs echo`
|
||||
|
||||
nativelib: $(ALL_OBJS)
|
||||
make -C $(DIR_CC) -fllvmdc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
|
||||
make -C $(DIR_RT) -fllvmdc.mak lib
|
||||
make -C $(DIR_GC) -fllvmdc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
|
||||
|
||||
$(RM) $(LIB_NAME_NATIVE)*
|
||||
|
||||
# first link all bcs together to a single bitcode file
|
||||
$(LLVMLINK) -o=$(LIB_NAME_NATIVE)-llvm.bc `find $(DIR_CC) $(DIR_RT) $(DIR_GC) -name "*.bc"`
|
||||
# then compile to assembler
|
||||
$(LLC) -o=$(LIB_NAME_NATIVE)-llvm.s $(LIB_NAME_NATIVE)-llvm.bc
|
||||
# assemble native code
|
||||
$(CC) -c -o $(LIB_NAME_NATIVE)-llvm.o $(LIB_NAME_NATIVE)-llvm.s
|
||||
# make an archive containing it and the other native object files
|
||||
$(CLC) $(LIB_TARGET_NATIVE) $(LIB_NAME_NATIVE)-llvm.o `find $(DIR_CC) $(DIR_RT) -name "*.o"`
|
||||
|
||||
|
||||
doc : $(ALL_DOCS)
|
||||
make -C $(DIR_CC) -fllvmdc.mak doc
|
||||
make -C $(DIR_RT) -fllvmdc.mak doc
|
||||
@@ -72,6 +93,7 @@ clean :
|
||||
make -C $(DIR_GC) -fllvmdc.mak clean
|
||||
$(RM) $(LIB_MASK)
|
||||
$(RM) $(LIB_MASK_C)
|
||||
$(RM) $(LIB_NAME_NATIVE)*
|
||||
|
||||
install :
|
||||
make -C $(DIR_CC) -fllvmdc.mak install
|
||||
|
||||
Reference in New Issue
Block a user