versioner: follow __asm__ labels.
Attribute the versioning information on `void foo() __asm("bar")` to
bar, not foo.
The various long double functions in <math.h> run into this.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Test: m
Change-Id: Idd3681ddbd006b4705608449935c9cfacfa3556e
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index aef4f55..33bccf3 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -54,6 +54,11 @@
}
}
+ // <math.h> maps fool onto foo on 32-bit, since long double is the same as double.
+ if (auto asm_attr = decl->getAttr<AsmLabelAttr>()) {
+ return asm_attr->getLabel();
+ }
+
// The decl might not have a name (e.g. bitfields).
if (auto identifier = decl->getIdentifier()) {
if (mangler->shouldMangleDeclName(decl)) {