From 3be251468365250a1ad2e86bb2fa634ff7297b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20M=20G=C3=B3mez?= Date: Tue, 13 Feb 2024 07:09:23 +0000 Subject: [PATCH] [Backport 2.0] Itanium mangling scheme (#23301) --- compiler/ccgtypes.nim | 28 ++++- compiler/ccgutils.nim | 63 ++++++++++ compiler/cgendata.nim | 1 + tests/codegen/titaniummangle.nim | 192 +++++++++++++++++++++++++++++++ 4 files changed, 279 insertions(+), 5 deletions(-) create mode 100644 tests/codegen/titaniummangle.nim diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 2aa92c130e..b40f8a5dac 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -54,13 +54,31 @@ proc mangleField(m: BModule; name: PIdent): string = if isKeyword(name): result.add "_0" +proc mangleProc(m: BModule; s: PSym; makeUnique: bool): string = + result = "_Z" # Common prefix in Itanium ABI + result.add encodeSym(m, s, makeUnique) + if s.typ.len > 1: #we dont care about the return param + for i in 1..