From ef1835df7b082c0251005d5368d2e89f8b54227c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 29 Nov 2003 10:05:30 +0000 Subject: [PATCH] Rewrite makefile logic to build an archive instead of a .o file. This is 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 | 59 +++++++++++++++---- runtime/GCCLibraries/crtend/comp_cxxeh.lst | 11 ++++ .../GCCLibraries/crtend/comp_genericeh.lst | 9 +++ runtime/GCCLibraries/crtend/comp_main.lst | 3 + runtime/GCCLibraries/crtend/comp_sjljeh.lst | 7 +++ .../crtend/exported_symbol_list.lst | 29 --------- 6 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 runtime/GCCLibraries/crtend/comp_cxxeh.lst create mode 100644 runtime/GCCLibraries/crtend/comp_genericeh.lst create mode 100644 runtime/GCCLibraries/crtend/comp_main.lst create mode 100644 runtime/GCCLibraries/crtend/comp_sjljeh.lst delete mode 100644 runtime/GCCLibraries/crtend/exported_symbol_list.lst diff --git a/runtime/GCCLibraries/crtend/Makefile b/runtime/GCCLibraries/crtend/Makefile index 361bad002b0..64d4d00d9f5 100644 --- a/runtime/GCCLibraries/crtend/Makefile +++ b/runtime/GCCLibraries/crtend/Makefile @@ -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) -$(LLVMGCCDIR)/bytecode-libs/crtend.o: $(LIBNAME_BC) - @cp $< $@ +# 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 $@ + +# 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 index 00000000000..e29ff96ea7a --- /dev/null +++ b/runtime/GCCLibraries/crtend/comp_cxxeh.lst @@ -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 index 00000000000..9270648b03e --- /dev/null +++ b/runtime/GCCLibraries/crtend/comp_genericeh.lst @@ -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 index 00000000000..ea953b7f92a --- /dev/null +++ b/runtime/GCCLibraries/crtend/comp_main.lst @@ -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 index 00000000000..afcaaf0d05d --- /dev/null +++ b/runtime/GCCLibraries/crtend/comp_sjljeh.lst @@ -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 index df12cc8a7b5..00000000000 --- a/runtime/GCCLibraries/crtend/exported_symbol_list.lst +++ /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