[cfe-commits] Bug 11709 Fix: va_list on ARM is not following AAPCS 7.1.4

Weiming Zhao weimingz at codeaurora.org
Thu Jul 19 16:00:13 PDT 2012


Hello,

 

ARM AAPCS ABI Section 7.1.4
(http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pd
f)
specifies that va_list should be defined as 
struct __va_list {
void *__ap;
}
And in C++, __va_list is in namespace std.
 
However, LLVM defined it as "void *__ap", which generates different mangled
name for C++ code.
 
For example:
For the following c++ code:
 
#include <stdarg.h>
int bar(int a, va_list args)
{
}
 
It should generate the name "_Z3bariSt9__va_list" (GCC 4.4 does that
correctly).
But now, it generates "_Z3bariPv".
 
Therefore, there is linkage issues between LLVM and other toolchains that
follow the ABI spec. 
 
I attached the fix and test case. (uploaded to
http://llvm.org/bugs/show_bug.cgi?id=11709 as well).
It passes the test suite. For the unit test, no new fails. (the before/after
test report is attached).
 
One thing I'm very certain is the change in lib/AST/ExprClassification.cpp.
Without that change, in debug build, the assertion will be triggered. 
So I relax the condition to let __va_list to pass the check. Please let me
know if there is a better solution.
 
Please review the patch.
 
Thanks,
Weiming
 
 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/4d19ebd5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-change-definiation-of-va_list-to-meet-arm-abi.patch
Type: application/octet-stream
Size: 9247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/4d19ebd5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-suite-report_after.log
Type: application/octet-stream
Size: 45559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/4d19ebd5/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unit_test_after.log
Type: application/octet-stream
Size: 3895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/4d19ebd5/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unit_test_before.log
Type: application/octet-stream
Size: 3895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/4d19ebd5/attachment-0003.obj>


More information about the cfe-commits mailing list