Skip to content

Commit db9323d

Browse files
kinkeMartin Kinkelin
and
Martin Kinkelin
authored
ImportC: Support weird asm("_" "<name>") mangling stuff (#4486)
These are apparently used in the Mac system headers... Co-authored-by: Martin Kinkelin <kinke@gnx.net>
1 parent 798f73b commit db9323d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

gen/mangling.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ std::string hashSymbolName(llvm::StringRef name, Dsymbol *symb) {
9898

9999
std::string getIRMangledName(FuncDeclaration *fdecl, LINK link) {
100100
std::string mangledName = mangleExact(fdecl);
101+
if (fdecl->adFlags & 4) { // nounderscore
102+
mangledName.insert(0, "\1");
103+
}
101104

102105
// Hash the name if necessary
103106
if (((link == LINK::d) || (link == LINK::default_)) &&

tests/dmd/runnable/test23343.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/* DISABLED: win32 win64 linux32 linux64 freebsd32 freebsd64 osx32 dragonflybsd32 netbsd32 LDC
2-
* LDC: this was apparently hacked around in DMD, requiring the glue layer to
3-
know about this ImportC special case and only apply it for Mac targets...
1+
/* DISABLED: win32 win64 linux32 linux64 freebsd32 freebsd64 osx32 dragonflybsd32 netbsd32
42
*/
53

64
/* https://issues.dlang.org/show_bug.cgi?id=23343

0 commit comments

Comments
 (0)