Rewrite makefile logic to build an archive instead of a .o file. This is
authorChris Lattner <sabre@nondot.org>
Sat, 29 Nov 2003 10:05:30 +0000 (10:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 29 Nov 2003 10:05:30 +0000 (10:05 +0000)
intended to address PR142

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10257 91177308-0d34-0410-b5e6-96231b3b80d8

runtime/GCCLibraries/crtend/Makefile
runtime/GCCLibraries/crtend/comp_cxxeh.lst [new file with mode: 0644]
runtime/GCCLibraries/crtend/comp_genericeh.lst [new file with mode: 0644]
runtime/GCCLibraries/crtend/comp_main.lst [new file with mode: 0644]
runtime/GCCLibraries/crtend/comp_sjljeh.lst [new file with mode: 0644]
runtime/GCCLibraries/crtend/exported_symbol_list.lst [deleted file]

index 361bad002b03bebba8233d4bc128c758eb3370f5..64d4d00d9f5635b6b55658274c86cd8c09f596be 100644 (file)
@@ -8,25 +8,64 @@
 ##===----------------------------------------------------------------------===##
 #
 # This directory contains the C and C++ runtime libraries for the LLVM GCC
-# front-ends.
+# front-ends.  See the README.txt file for more details.
+#
+# Since this archive has strange requirements, we use almost all custom rules
+# for building it.
 #
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../../..
-BYTECODE_LIBRARY=1
 DONT_BUILD_RELINKED=1
-LIBRARYNAME=crtend
-
-Source = $(notdir $(wildcard $(SourceDir)/*.cpp $(SourceDir)/*.c)) listend.ll
 
-EXPORTED_SYMBOL_FILE = $(SourceDir)/exported_symbol_list.lst
+MainSrc      := crtend.c listend.ll
+GenericEHSrc := Exception.cpp
+SJLJEHSrc    := SJLJ-Exception.cpp
+CXXEHSrc     := C++-Exception.cpp
+Source       := $(MainSrc) $(GenericEHSrc) $(SJLJEHSrc) $(CXXEHSrc)
 
 include $(LEVEL)/Makefile.common
 
+# CRTEND_A - The result of making 'all' - the final archive file.
+CRTEND_A   = $(DESTLIBBYTECODE)/crtend.a
+all:: $(CRTEND_A)
+
+# Installation simply requires copying the archive to it's new home.
+$(LLVMGCCDIR)/bytecode-libs/crtend.a: $(CRTEND_A)
+       cp $< $@
+
+install:: $(LLVMGCCDIR)/bytecode-libs/crtend.a
+
+
+# The four components described in the README
+Components := main genericeh sjljeh cxxeh
+ComponentLibs := $(Components:%=$(BUILD_OBJ_DIR)/BytecodeObj/comp_%.bc)
+
+
+# We build crtend.a from the four components described in the README.
+$(CRTEND_A) : $(ComponentLibs)
+       $(AR) $@ $(ComponentLibs)
+
+MainObj      := $(BUILD_OBJ_DIR)/BytecodeObj/crtend.bc \
+                $(BUILD_OBJ_DIR)/BytecodeObj/listend.bc
+GenericEHObj := $(BUILD_OBJ_DIR)/BytecodeObj/Exception.bc
+SJLJEHObj    := $(BUILD_OBJ_DIR)/BytecodeObj/SJLJ-Exception.bc
+CXXEHObj     := $(BUILD_OBJ_DIR)/BytecodeObj/C++-Exception.bc
+
+# __main and ctor/dtor support component
+$(BUILD_OBJ_DIR)/BytecodeObj/comp_main.bc: $(MainObj)
+       $(LGCCLDPROG) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_main.lst $(MainObj) -o $@
+
+# Generic exception handling support runtime.
+$(BUILD_OBJ_DIR)/BytecodeObj/comp_genericeh.bc: $(GenericEHObj)
+       $(LGCCLDPROG) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_genericeh.lst $(GenericEHObj) -o $@
+
+# setjmp/longjmp exception handling support runtime.
+$(BUILD_OBJ_DIR)/BytecodeObj/comp_sjljeh.bc: $(SJLJEHObj)
+       $(LGCCLDPROG) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_sjljeh.lst $(SJLJEHObj) -o $@
 
-$(LLVMGCCDIR)/bytecode-libs/crtend.o: $(LIBNAME_BC)
-       @cp $< $@
+# C++ exception handling support runtime.
+$(BUILD_OBJ_DIR)/BytecodeObj/comp_cxxeh.bc: $(CXXEHObj)
+       $(LGCCLDPROG) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_cxxeh.lst $(CXXEHObj) -o $@
 
-install:: $(LLVMGCCDIR)/bytecode-libs/crtend.o
-       @rm $(LLVMGCCDIR)/bytecode-libs/libcrtend.bc
 
diff --git a/runtime/GCCLibraries/crtend/comp_cxxeh.lst b/runtime/GCCLibraries/crtend/comp_cxxeh.lst
new file mode 100644 (file)
index 0000000..e29ff96
--- /dev/null
@@ -0,0 +1,11 @@
+__llvm_cxxeh_allocate_exception
+__llvm_cxxeh_free_exception
+__llvm_cxxeh_throw
+__llvm_cxxeh_call_terminate
+__llvm_cxxeh_current_uncaught_exception_isa
+__llvm_cxxeh_begin_catch
+__llvm_cxxeh_begin_catch_if_isa
+__llvm_cxxeh_end_catch
+__llvm_cxxeh_rethrow
+__llvm_cxxeh_get_last_caught
+__llvm_cxxeh_check_eh_spec
diff --git a/runtime/GCCLibraries/crtend/comp_genericeh.lst b/runtime/GCCLibraries/crtend/comp_genericeh.lst
new file mode 100644 (file)
index 0000000..9270648
--- /dev/null
@@ -0,0 +1,9 @@
+__main
+llvm.global_ctors
+llvm.global_dtors
+
+__llvm_eh_has_uncaught_exception
+__llvm_eh_current_uncaught_exception_type
+__llvm_eh_add_uncaught_exception
+__llvm_eh_get_uncaught_exception
+__llvm_eh_pop_from_uncaught_stack
diff --git a/runtime/GCCLibraries/crtend/comp_main.lst b/runtime/GCCLibraries/crtend/comp_main.lst
new file mode 100644 (file)
index 0000000..ea953b7
--- /dev/null
@@ -0,0 +1,3 @@
+__main
+llvm.global_ctors
+llvm.global_dtors
diff --git a/runtime/GCCLibraries/crtend/comp_sjljeh.lst b/runtime/GCCLibraries/crtend/comp_sjljeh.lst
new file mode 100644 (file)
index 0000000..afcaaf0
--- /dev/null
@@ -0,0 +1,7 @@
+__llvm_sjljeh_throw_longjmp
+__llvm_sjljeh_init_setjmpmap
+__llvm_sjljeh_destroy_setjmpmap
+__llvm_sjljeh_add_setjmp_to_map
+__llvm_sjljeh_is_longjmp_exception
+__llvm_sjljeh_get_longjmp_value
+__llvm_sjljeh_try_catching_longjmp_exception
diff --git a/runtime/GCCLibraries/crtend/exported_symbol_list.lst b/runtime/GCCLibraries/crtend/exported_symbol_list.lst
deleted file mode 100644 (file)
index df12cc8..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-__main
-llvm.global_ctors
-llvm.global_dtors
-
-__llvm_eh_has_uncaught_exception
-__llvm_eh_current_uncaught_exception_type
-__llvm_eh_add_uncaught_exception
-__llvm_eh_get_uncaught_exception
-__llvm_eh_pop_from_uncaught_stack
-
-__llvm_cxxeh_allocate_exception
-__llvm_cxxeh_free_exception
-__llvm_cxxeh_throw
-__llvm_cxxeh_call_terminate
-__llvm_cxxeh_current_uncaught_exception_isa
-__llvm_cxxeh_begin_catch
-__llvm_cxxeh_begin_catch_if_isa
-__llvm_cxxeh_end_catch
-__llvm_cxxeh_rethrow
-__llvm_cxxeh_get_last_caught
-__llvm_cxxeh_check_eh_spec
-
-__llvm_sjljeh_throw_longjmp
-__llvm_sjljeh_init_setjmpmap
-__llvm_sjljeh_destroy_setjmpmap
-__llvm_sjljeh_add_setjmp_to_map
-__llvm_sjljeh_is_longjmp_exception
-__llvm_sjljeh_get_longjmp_value
-__llvm_sjljeh_try_catching_longjmp_exception