IBM Support

New C++ name mangling option and pragma for XL C/C++ Enterprise Edition V7.0 and V8.0 for AIX

Troubleshooting


Problem

Binaries built with the -qnamemangling=compat option and with functions that contain repeated typedef parameters prior to the fix in APAR IY63617 are not compatible with binaries that are built after IY63617.

Cause

Prior to the fix in APAR IY63617, repeated function parameters that were cv-qualified typedef equivalents of non-cv qualified built-in types were treated as distinct types and were not mangled using the compression scheme normally used for repeated parameter types. After the fix in APAR IY63617, these repeated parameters were mangled according to the compression scheme.

Resolving The Problem

To restore the behavior prior to the fix in IY63617 for users who are compiling with -qnamemangling=compat, the following backward compatibility option and pragma are added in XL C/C++ Enterprise Edition V7.0 and V8.0 for AIX:

  • -qnamemanglingrulefor=compat=[no]fnparmstypedefscmp
  • #pragma nameManglingRule(fnparmstypedefscmp, on|off|pop)

Syntax
----------

The syntax for the option and pragma are as follows:

>>--q-namemanglingrulefor-=-(--compat-=-fnparmstypedefscmp---)--><
|--nofnparmstypedefscmp--|

>>--#--pragma--nameManglingRule-(--fnparmstypedefscmp--,--off--)-><
|--on---|
|--pop--|

Suboptions
----------------

The suboptions for the option and pragma are as follows:


Option PragmaDescription
compat=fnparmstypedefscmpfnparmstypedefscmp, onApplies the compression scheme to repeated typedef parameters. This is the default behaviour under -qnamemangling=compat.
compat=nofnparmstypedefscmpfnparmstypedefscmp, offDoes not apply the compression scheme to repeated typedef parameters. This suboption overwrites the default -qnamemangling=compat behavior and reverts to the old behavior.
n/afnparmstypedefscmp, popDiscards the current #pragma nameManglingRule setting, and replaces it with the previous #pragma nameManglingRule setting in on the stack. If no previous settings remain on the stack, the default #pragma nameManglingRule setting is used.

Example
----------------

The following example shows the result of new option or pragma setting:



Testcase:Name mangling with
-qnamemangling=compat prior to APAR IY63617
Name mangling with
-qnamemangling=compat
Name mangling with -qnamemangling=compat
-qnamemanglingrulefor
=compat=nofnparmstyp
edefscmp or #pragma
nameManglingRule(fnp
armstypedefscmp, off)
typedef const char* CHARSTAR;

void fn(CHARSTAR,CHARSTAR,const char*) {}
fn__FPCcPCcPCcfn__FPCcT1PCcfn__FPCcPCcPCc

Usage
----------

The new option and pragma are only applicable when -qnamemangling=compat is in effect, and the code to be compiled contains repeated function arguments which are typedefs of equivalent types that are not cv-qualified.

[{"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Compiler","Platform":[{"code":"PF002","label":"AIX"}],"Version":"7.0;8.0","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Compiler","Platform":[{"code":"PF002","label":"AIX"}],"Version":"7.0;8.0","Edition":"Not applicable","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
06 December 2018

UID

swg21251671