[llvm-commits] [patch] enable pic in llvm-gcc-4.2 for NetBSD

Krister Walfridsson krister.walfridsson at gmail.com
Thu Jul 17 13:51:51 PDT 2008


The PIC support in llvm works fine for NetBSD too, so the -fPIC flag
may be enabled in NetBSD's llvm-gcc-4.2 configuration as in the
attached patch.

    /Krister
-------------- next part --------------
Index: gcc/config/netbsd-elf.h
===================================================================
--- gcc/config/netbsd-elf.h	(revision 53688)
+++ gcc/config/netbsd-elf.h	(working copy)
@@ -92,3 +92,16 @@
        %{rdynamic:-export-dynamic} \
        %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
      %{static:-static}}"
+
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+
+/* Yes, we're supporting PIC codegen for NetBSD targets! */
+#define LLVM_SET_TARGET_OPTIONS(argvec)              \
+  if (flag_pic)                                      \
+    argvec.push_back ("--relocation-model=pic");     \
+  else                                               \
+    argvec.push_back ("--relocation-model=static");
+
+#endif
+/* LLVM LOCAL end */


More information about the llvm-commits mailing list