<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - using C bindings, calling LLVMSetGC("shadow-stack") fails with an unsupported error"
   href="https://llvm.org/bugs/show_bug.cgi?id=23095">23095</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>using C bindings, calling LLVMSetGC("shadow-stack") fails with an unsupported error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>halivingston@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm using LLVMSharp, which require .NET or Mono. I suspect it'll reproduce in
LLVM-C bindings as well.

I've attached the C# program I used on Windows.

Step 1:
Open Visual Studio
Create Solution
Install-Package LLVMSharp (it comes with a shared library inside)

Put the following program and notice the console output which says unsupported
error:

namespace ConsoleApplication2
{
    using System;
    using System.Runtime.InteropServices;
    using LLVMSharp;

    class Program
    {
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        public delegate int Add();

        static void Main(string[] args)
        {
            LLVMBool False = new LLVMBool(0);
            LLVMModuleRef mod = LLVM.ModuleCreateWithName("LLVMSharpIntro");

            LLVMTypeRef param_types = new LLVMTypeRef();
            LLVMTypeRef ret_type = LLVM.FunctionType(LLVM.Int32Type(), out
param_types, 0, False);
            LLVMValueRef sum = LLVM.AddFunction(mod, "sum", ret_type);
            LLVM.SetGC(sum, "erlang");

            LLVMBasicBlockRef entry = LLVM.AppendBasicBlock(sum, "entry");

            LLVMBuilderRef builder = LLVM.CreateBuilder();

            LLVM.PositionBuilderAtEnd(builder, entry);
            var p = LLVM.BuildAlloca(builder, LLVM.Int32Type(), "p");
            LLVM.BuildStore(builder, LLVM.ConstInt(LLVM.Int32Type(), 10,
False), p);
            var x = LLVM.BuildLoad(builder, p, "foo");
            LLVM.BuildRet(builder, x);

            IntPtr error;
            LLVM.VerifyModule(mod,
LLVMVerifierFailureAction.LLVMAbortProcessAction, out error);
            LLVM.DisposeMessage(error);

            LLVMExecutionEngineRef engine;

            LLVM.LinkInMCJIT();
            LLVM.InitializeX86Target();
            LLVM.InitializeX86TargetInfo();
            LLVM.InitializeX86TargetMC();
            LLVM.InitializeX86AsmPrinter();

            var platform = Environment.OSVersion.Platform;
            if (platform == PlatformID.Win32NT) // On Windows, LLVM currently
(3.6) does not support PE/COFF
            {
                LLVM.SetTarget(mod,
Marshal.PtrToStringAnsi(LLVM.GetDefaultTargetTriple()) + "-elf");
            }

            var options = new LLVMMCJITCompilerOptions();
            var optionsSize = (4 * sizeof(int)) + IntPtr.Size; //
LLVMMCJITCompilerOptions has 4 ints and a pointer

            LLVM.DumpModule(mod);

            LLVM.InitializeMCJITCompilerOptions(out options, optionsSize);
            LLVM.CreateMCJITCompilerForModule(out engine, mod, out options,
optionsSize, out error);

            var addMethod =
(Add)Marshal.GetDelegateForFunctionPointer(LLVM.GetPointerToGlobal(engine,
sum), typeof(Add));
            int result = addMethod();

            Console.WriteLine("Result of sum is: " + result);

            if (LLVM.WriteBitcodeToFile(mod, "sum.bc") != 0)
            {
                Console.WriteLine("error writing bitcode to file, skipping");
            }

            LLVM.DumpModule(mod);

            LLVM.DisposeBuilder(builder);
            LLVM.DisposeExecutionEngine(engine);
            Console.ReadKey();
        }
    }
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>