Skip to content

Commit 86b6b5f

Browse files
keesHoney Goyal
authored andcommitted
[CodeGen][KCFI] Fix asm comment style (llvm#170739)
We can't use "#" in the middle of the asm output, so switch to a /* */ pair instead.
1 parent 23cd36e commit 86b6b5f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,8 +3212,8 @@ void CodeGenModule::finalizeKCFITypes() {
32123212
continue;
32133213

32143214
std::string Asm = (".weak __kcfi_typeid_" + Name + "\n.set __kcfi_typeid_" +
3215-
Name + ", " + Twine(Type->getZExtValue()) + " # " +
3216-
Twine(Type->getSExtValue()) + "\n")
3215+
Name + ", " + Twine(Type->getZExtValue()) + " /* " +
3216+
Twine(Type->getSExtValue()) + " */\n")
32173217
.str();
32183218
M.appendModuleInlineAsm(Asm);
32193219
}

clang/test/CodeGen/cfi-salt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ typedef unsigned int (* __cfi_salt ufn_salt_t)(void);
2727

2828
/// Must emit __kcfi_typeid symbols for address-taken function declarations
2929
// CHECK: module asm ".weak __kcfi_typeid_[[F4:[a-zA-Z0-9_]+]]"
30-
// CHECK: module asm ".set __kcfi_typeid_[[F4]], {{[0-9]+}} # [[#%d,LOW_SODIUM_HASH:]]"
30+
// CHECK: module asm ".set __kcfi_typeid_[[F4]], {{[0-9]+}} /* [[#%d,LOW_SODIUM_HASH:]] */"
3131
// CHECK: module asm ".weak __kcfi_typeid_[[F4_SALT:[a-zA-Z0-9_]+]]"
32-
// CHECK: module asm ".set __kcfi_typeid_[[F4_SALT]], {{[0-9]+}} # [[#%d,ASM_SALTY_HASH:]]"
32+
// CHECK: module asm ".set __kcfi_typeid_[[F4_SALT]], {{[0-9]+}} /* [[#%d,ASM_SALTY_HASH:]] */"
3333

3434
/// Must not __kcfi_typeid symbols for non-address-taken declarations
3535
// CHECK-NOT: module asm ".weak __kcfi_typeid_f6"

clang/test/CodeGen/kcfi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/// Must emit __kcfi_typeid symbols for address-taken function declarations
99
// CHECK: module asm ".weak __kcfi_typeid_[[F4:[a-zA-Z0-9_]+]]"
10-
// CHECK: module asm ".set __kcfi_typeid_[[F4]], {{[0-9]+}} # [[#%d,HASH:]]"
10+
// CHECK: module asm ".set __kcfi_typeid_[[F4]], {{[0-9]+}} /* [[#%d,HASH:]] */"
1111
/// Must not __kcfi_typeid symbols for non-address-taken declarations
1212
// CHECK-NOT: module asm ".weak __kcfi_typeid_{{f6|_Z2f6v}}"
1313

0 commit comments

Comments
 (0)