[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

Stephen Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 20 07:14:28 PDT 2022


steplong added a comment.

Hmm, it looks like MSVC is accepting:

  extern "C" {
  static void foo();
  }
  
  static int foo();
  #pragma alloc_text("s", foo)
  static void foo() {}

Ignoring the `pragma alloc_text`, it looks like GCC compiles the following `foo` with C linkage vs LLVM which compiles with C++ linkage (foo's name is mangled):

  extern "C" {
  static int foo();
  }
  
  static int foo();
  static int foo() {
    return 3;
  }
  
  int bar() {
    return foo();
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126559/new/

https://reviews.llvm.org/D126559



More information about the cfe-commits mailing list