aboutsummaryrefslogtreecommitdiffstats
path: root/main/llvm/llvm-0001-fix-shared-build.patch
blob: 492c4399acafece300a3f1b64046745849953652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 0d03d2ea17b66d8cb0f6ca5f2181237228535845 Mon Sep 17 00:00:00 2001
From: Sanjoy Das <sanjoy at azulsystems.com>
Date:   Thu Jun 19 15:38:02 2014 -0700
Subject: Fix the --enable-shared build.

Currently a build configured with ./configure --enable-shared breaks
with an undefined "llvm::cl::parser<llvm::PassInfo
const*>::getOption(unsigned int) const" symbol when linking opt.  This
body for this symbol gets emitted into Pass.o (along with the destructor
for PassNameParser), but gets linked into libLLVM-3.5svn.so with local
visibility, causing the link error.

This fix uses the existing EXTERN_TEMPLATE machinery to force a globally
visible definition for the functions in parser<const PassInfo *> into
Pass.o.
---
 include/llvm/IR/LegacyPassNameParser.h | 2 ++
 lib/IR/Pass.cpp                        | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h
index e2e4912..a07e3fd 100644
--- a/include/llvm/IR/LegacyPassNameParser.h
+++ b/include/llvm/IR/LegacyPassNameParser.h
@@ -95,6 +95,8 @@ private:
   }
 };

+EXTERN_TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
+
 ///===----------------------------------------------------------------------===//
 /// FilteredPassNameParser class - Make use of the pass registration
 /// mechanism to automatically add a command line argument to opt for
diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp
index 91d86ae..00ce223 100644
--- a/lib/IR/Pass.cpp
+++ b/lib/IR/Pass.cpp
@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() {
   // attempting to remove the registration listener is an error.
 }

+TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
+
 //===----------------------------------------------------------------------===//
 //   AnalysisUsage Class Implementation
 //
--
2.1.4