blob: 1059d850f1292fe9fc2e4d3ec0eeddcab32deedf [file] [log] [blame]
Zonr Changee690092012-04-12 12:19:15 +08001/*
2 * Copyright 2012, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Stephen Hines2f6a4932012-05-03 12:27:13 -070017#include "BCCRuntimeSymbolResolver.h"
Zonr Changee690092012-04-12 12:19:15 +080018
19// int_lib.h included by BCCRuntimeStub.h has the following line:
20//
21// typedef int si_int;
22//
23// However, there's already a macro also named "si_int" defined in siginfo.h
24// bionic/libc/kernel/common/asm-generic/. This is #undef is a hack to avoid
25// compiler mistakenly recognize the identifier "si_int" as a macro and abort
26// the compilation.
27//
28// This line of hack should put in the header file since it invalidate a
29// "system" scope macro definition.
30#undef si_int
31#include "BCCRuntimeStub.h"
32
33using namespace bcc;
34
35#if defined(__arm__) || defined(__mips__)
36 #define DEF_GENERIC_RUNTIME(func) \
37 extern void *func;
38 #define DEF_VFP_RUNTIME(func) \
39 extern void *func ## vfp;
40 #define DEF_LLVM_RUNTIME(func)
41 #define DEF_BCC_RUNTIME(func)
42#include "BCCRuntime.def"
43#endif
44
45const BCCRuntimeSymbolResolver::SymbolMap BCCRuntimeSymbolResolver::SymbolArray[] = {
46#if defined(__arm__) || defined(__mips__)
47 #define DEF_GENERIC_RUNTIME(func) \
48 { #func, (void*) &func },
49 // TODO: enable only when target support VFP
50 #define DEF_VFP_RUNTIME(func) \
51 { #func, (void*) &func ## vfp },
52#else
53 // host compiler library must contain generic runtime
54 #define DEF_GENERIC_RUNTIME(func)
55 #define DEF_VFP_RUNTIME(func)
56#endif
57#define DEF_LLVM_RUNTIME(func) \
58 { #func, (void*) &func },
59#define DEF_BCC_RUNTIME(func) \
60 { #func, &func ## _bcc },
61#include "BCCRuntime.def"
62};
63
64const size_t BCCRuntimeSymbolResolver::NumSymbols =
65 sizeof(BCCRuntimeSymbolResolver::SymbolArray) /
66 sizeof(BCCRuntimeSymbolResolver::SymbolArray[0]);