Browse Source

Don't change function linkage for library profile.

Xiang Li 8 years ago
parent
commit
b6e876bf39
2 changed files with 8 additions and 6 deletions
  1. 1 1
      lib/DxcSupport/HLSLOptions.cpp
  2. 7 5
      tools/clang/lib/CodeGen/CGHLSLMS.cpp

+ 1 - 1
lib/DxcSupport/HLSLOptions.cpp

@@ -119,7 +119,7 @@ bool DxcOpts::IsRootSignatureProfile() {
 }
 
 bool DxcOpts::IsLibraryProfile() {
-  return TargetProfile == "lib_6_1";
+  return TargetProfile.startswith("lib_");
 }
 
 MainArgs::MainArgs(int argc, const wchar_t **argv, int skipArgCount) {

+ 7 - 5
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -3851,11 +3851,13 @@ void CGMSHLSLRuntime::FinishCodeGen() {
 
   // Pin entry point and constant buffers, mark everything else internal.
   for (Function &f : m_pHLModule->GetModule()->functions()) {
-    if (&f == m_pHLModule->GetEntryFunction() || IsPatchConstantFunction(&f) ||
-        f.isDeclaration()) {
-      f.setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
-    } else {
-      f.setLinkage(GlobalValue::LinkageTypes::InternalLinkage);
+    if (!m_bIsLib) {
+      if (&f == m_pHLModule->GetEntryFunction() ||
+          IsPatchConstantFunction(&f) || f.isDeclaration()) {
+        f.setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
+      } else {
+        f.setLinkage(GlobalValue::LinkageTypes::InternalLinkage);
+      }
     }
     // Skip no inline functions.
     if (f.hasFnAttribute(llvm::Attribute::NoInline))