[LLVMdev] RFC: Patch for Exceptions
Bill Wendling
isanbard at gmail.com
Tue Aug 28 18:31:56 PDT 2007
Hi all,
This is a (very) rough patch to fix building LLVM with exceptions on
PPC Darwin. Basically, it puts the burden of adding the "--enable-eh"
on the specific target, which is where I think it should go.
If this is okay, then I can clean the patch up and submit it.
-bw
Index: gcc/llvm-backend.cpp
===================================================================
--- gcc/llvm-backend.cpp (revision 41554)
+++ gcc/llvm-backend.cpp (working copy)
@@ -122,9 +122,6 @@
Args.push_back("--debug-pass=Structure");
if (flag_debug_pass_arguments)
Args.push_back("--debug-pass=Arguments");
-// Breaks the x86-darwin build
-// if (flag_exceptions)
-// Args.push_back("--enable-eh");
// If there are options that should be passed through to the LLVM backend
// directly from the command line, do so now. This is mainly for debugging
[bwendling:llvm-eh] svn diff gcc/config/linux.h
Index: gcc/config/linux.h
===================================================================
--- gcc/config/linux.h (revision 41554)
+++ gcc/config/linux.h (working copy)
@@ -113,8 +113,9 @@
if (flag_pic) \
argvec.push_back ("--relocation-model=pic"); \
else \
- argvec.push_back ("--relocation-model=static");
-
+ argvec.push_back ("--relocation-model=static"); \
+ if (flag_exceptions) \
+ argvec.push_back("--enable-eh")
#endif
/* APPLE LOCAL end LLVM */
[bwendling:llvm-eh] svn diff gcc/config/i386/i386.h
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h (revision 41554)
+++ gcc/config/i386/i386.h (working copy)
@@ -481,6 +481,10 @@
#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0
#endif
+#define LLVM_SET_EXCEPTION_OPTION(argvec) \
+ if (flag_exceptions) \
+ argvec.push_back("--enable-eh")
+
/* Once GDB has been enhanced to deal with functions without frame
pointers, we can change this to allow for elimination of
the frame pointer in leaf functions. */
[bwendling:llvm-eh] svn diff gcc/config/rs6000/rs6000.h
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h (revision 41554)
+++ gcc/config/rs6000/rs6000.h (working copy)
@@ -26,6 +26,8 @@
/* Definitions for the object file format. These are set at
compile-time. */
+#define LLVM_SET_EXCEPTION_OPTION(argvec)
+
#define OBJECT_XCOFF 1
#define OBJECT_ELF 2
#define OBJECT_PEF 3
[bwendling:llvm-eh] svn diff gcc/config/darwin.h
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h (revision 41554)
+++ gcc/config/darwin.h (working copy)
@@ -1712,11 +1712,13 @@
darwin_objc_llvm_implicit_target_global_var_section(decl) : 0)
const char *darwin_objc_llvm_implicit_target_global_var_section(tree);
-#define LLVM_SET_TARGET_OPTIONS(argvec) \
- if (flag_pic) \
- argvec.push_back ("--relocation-model=pic"); \
- else if (!MACHO_DYNAMIC_NO_PIC_P) \
- argvec.push_back ("--relocation-model=static")
+#define LLVM_SET_TARGET_OPTIONS(argvec) do { \
+ if (flag_pic) \
+ argvec.push_back ("--relocation-model=pic"); \
+ else if (!MACHO_DYNAMIC_NO_PIC_P) \
+ argvec.push_back ("--relocation-model=static"); \
+ LLVM_SET_EXCEPTION_OPTION(argvec); \
+ } while (0)
#endif
/* APPLE LOCAL end LLVM */
More information about the llvm-dev
mailing list