本文转自:http://blog.csdn.net/dj0379/article/details/17010981
写过win32程序的朋友对dll导出函数名都很熟悉,大家都可以通过.def文件或者__declspec(dllexport)来指定导出的函数名。在android下,可执行文件或者动态链接库用的是elf格式,和win32的pe格式有所不同。当编译动态链接库时,缺省的编译选项下默认所有的符号表都会导出。以android-ndk下的san-angeles例子为例,用ndk编译之后生成的jni动态库导出的符号表可以用下面命令看到(默认开发环境为win32 cygwin):
001
$ /path/to/ndk/buid/prebuilt/windows/arm-eabi-4.4.0/bin/arm-eabi-nm libs/armeabi/libsanangeles.so
002
003
00003600 T Java_com_example_SanAngeles_DemoGLSurfaceView_nativePause
004
005
00003638 T Java_com_example_SanAngeles_DemoRenderer_nativeDone
006
007
0000367c T Java_com_example_SanAngeles_DemoRenderer_nativeInit
008
009
000035b4 T Java_com_example_SanAngeles_DemoRenderer_nativeRender
010
011
00003644 T Java_com_example_SanAngeles_DemoRenderer_nativeResize
012
013
00007334 a _DYNAMIC
014
015
0000740c a _GLOBAL_OFFSET_TABLE_
016
017
0000577c T _Unwind_Backtrace
018
019
00004978 T _Unwind_Complete
020
021
0000497c T _Unwind_DeleteException
022
023
00005758 T _Unwind_ForcedUnwind
024
025
00004970 T _Unwind_GetCFA
026
027
00005800 T _Unwind_GetDataRelBase
028
029
00005808 t _Unwind_GetGR
030
031
0000482c t _Unwind_GetGR
032
033
00005838 T _Unwind_GetLanguageSpecificData
034
035
00005854 T _Unwind_GetRegionStart
036
037
000057f8 T _Unwind_GetTextRelBase
038
039
000056ec T _Unwind_RaiseException
040
041
00005710 T _Unwind_Resume
042
043
00005734 T _Unwind_Resume_or_Rethrow
044
045
000048a0 t _Unwind_SetGR
046
047
000047e0 T _Unwind_VRS_Get
048
049
0000528c T _Unwind_VRS_Pop
050
051
00004854 T _Unwind_VRS_Set
052
053
000047cc t _Unwind_decode_target2
054
055
0000577c T ___Unwind_Backtrace
056
057
00005758 T ___Unwind_ForcedUnwind
058
059
000056ec T ___Unwind_RaiseException
060
061
00005710 T ___Unwind_Resume
062
063
00005734 T ___Unwind_Resume_or_Rethrow
064
065
00003874 T __adddf3
066
067
0000413c T __addsf3
068
069
000046f8 T __aeabi_cfcmpeq
070
071
000046f8 T __aeabi_cfcmple
072
073
000046e8 T __aeabi_cfrcmple
074
075
00004090 T __aeabi_d2f
076
077
00003874 T __aeabi_dadd
078
079
00003e8c T __aeabi_ddiv
080
081
00003c20 T __aeabi_dmul
082
083
00003868 T __aeabi_drsub
084
085
00003870 T __aeabi_dsub
086
087
00003b6c T __aeabi_f2d
088
089
00004770 T __aeabi_f2iz
090
091
0000413c T __aeabi_fadd
092
093
0000470c T __aeabi_fcmpeq
094
095
00004748 T __aeabi_fcmpge
096
097
0000475c T __aeabi_fcmpgt
098
099
00004734 T __aeabi_fcmple
100
101
00004720 T __aeabi_fcmplt
102
103
00004518 T __aeabi_fdiv
104
105
00004380 T __aeabi_fmul
106
107
00004130 T __aeabi_frsub
108
109
00004138 T __aeabi_fsub
110
111
00003b44 T __aeabi_i2d
112
113
000042d4 T __aeabi_i2f
114
115
00003770 T __aeabi_idiv
116
117
00003864 T __aeabi_idiv0
118
119
0000384c T __aeabi_idivmod
120
121
00003bc0 T __aeabi_l2d
122
123
00004304 T __aeabi_l2f
124
125
00003864 T __aeabi_ldiv0
126
127
00003b20 T __aeabi_ui2d
128
129
000042cc T __aeabi_ui2f
130
131
000036ac T __aeabi_uidiv
132
133
00003758 T __aeabi_uidivmod
134
135
00003bac T __aeabi_ul2d
136
137
000042f4 T __aeabi_ul2f
138
139
00004d5c T __aeabi_unwind_cpp_pr0
140
141
00004d54 W __aeabi_unwind_cpp_pr1
142
143
00004d4c W __aeabi_unwind_cpp_pr2
144
145
U __android_log_print
146
147
000076d4 A __bss_end__
148
149
00007658 A __bss_start
150
151
00007658 A __bss_start__
152
153
00004688 T __cmpsf2
154
155
w __cxa_begin_cleanup
156
157
w __cxa_call_unexpected
158
159
w __cxa_type_match
160
161
000074b8 D __data_start
162
163
00003864 T __div0
164
165
00003e8c T __divdf3
166
167
00004518 T __divsf3
168
169
00003770 T __divsi3
170
171
000076d4 A __end__
172
173
00004688 T __eqsf2
174
175
00006334 A __exidx_end
176
177
000061a4 A __exidx_start
178
179
00003b6c T __extendsfdf2
180
181
00004770 T __fixsfsi
182
183
00003bc0 T __floatdidf
184
185
00004304 T __floatdisf
186
187
00003b44 T __floatsidf
188
189
000042d4 T __floatsisf
190
191
00003bac T __floatundidf
192
193
000042f4 T __floatundisf
194
195
00003b20 T __floatunsidf
196
197
000042cc T __floatunsisf
198
199
00004678 T __gesf2
200
201
00004f04 T __gnu_Unwind_Backtrace
202
203
w __gnu_Unwind_Find_exidx
204
205
000050e8 T __gnu_Unwind_ForcedUnwind
206
207
0000515c T __gnu_Unwind_RaiseException
208
209
0000560c T __gnu_Unwind_Restore_VFP
210
211
0000561c T __gnu_Unwind_Restore_VFP_D
212
213
0000562c T __gnu_Unwind_Restore_VFP_D_16_to_31
214
215
000056c4 T __gnu_Unwind_Restore_WMMXC
216
217
0000563c T __gnu_Unwind_Restore_WMMXD
218
219
00005220 T __gnu_Unwind_Resume
220
221
00005200 T __gnu_Unwind_Resume_or_Rethrow
222
223
00005614 T __gnu_Unwind_Save_VFP
224
225
00005624 T __gnu_Unwind_Save_VFP_D
226
227
00005634 T __gnu_Unwind_Save_VFP_D_16_to_31
228
229
000056d8 T __gnu_Unwind_Save_WMMXC
230
231
00005680 T __gnu_Unwind_Save_WMMXD
232
233
00005864 T __gnu_unwind_execute
234
235
00005be0 T __gnu_unwind_frame
236
237
0000499c t __gnu_unwind_pr_common
238
239
00004678 T __gtsf2
240
241
00004680 T __lesf2
242
243
00004680 T __ltsf2
244
245
00003c20 T __muldf3
246
247
00004380 T __mulsf3
248
249
00004688 T __nesf2
250
251
000055f8 T __restore_core_regs
252
253
00003870 T __subdf3
254
255
00004138 T __subsf3
256
257
00004090 T __truncdfsf2
258
259
000036ac T __udivsi3
260
261
000076d4 A _bss_end__
262
263
00007658 A _edata
264
265
000076d4 A _end
266
267
00003590 t _getTime
268
269
00080000 N _stack
270
271
U abort
272
273
000020c8 T appDeinit
274
275
00002238 T appInit
276
277
00002ee0 T appRender
278
279
U cos
280
281
00001ec8 t drawGLObject
282
283
00001f18 t drawModels
284
285
U
free
286
287
000020a8 t freeGLObject
288
289
00007654 D gAppAlive
290
291
00004d64 t get_eit_entry
292
293
U gettimeofday
294
295
U glBlendFunc
296
297
U glClear
298
299
U glClearColorx
300
301
U glColor4x
302
303
U glColorPointer
304
305
U glDisable
306
307
U glDisableClientState
308
309
U glDrawArrays
310
311
U glEnable
312
313
U glEnableClientState
314
315
U glFrustumx
316
317
U glLightxv
318
319
U glLoadIdentity
320
321
U glMaterialx
322
323
U glMaterialxv
324
325
U glMatrixMode
326
327
U glMultMatrixx
328
329
U glNormalPointer
330
331
U glPopMatrix
332
333
U glPushMatrix
334
335
U glRotatex
336
337
U glScalex
338
339
U glShadeModel
340
341
U glTranslatex
342
343
U glVertexPointer
344
345
U glViewport
346
347
00001e1c T importGLDeinit
348
349
00001e18 T importGLInit
350
351
000075ec d light0Diffuse.3407
352
353
000075dc d light0Position.3406
354
355
0000760c d light1Diffuse.3409
356
357
000075fc d light1Position.3408
358
359
0000762c d light2Diffuse.3411
360
361
0000761c d light2Position.3410
362
363
U malloc
364
365
0000763c d materialSpecular.3412
366
367
U memcpy
368
369
000020f4 t newGLObject
370
371
000057a0 t next_unwind_byte
372
373
U pow
374
375
0000610c r quadVertices.3337
376
377
000055f8 T restore_core_regs
378
379
00004e98 t restore_non_core_regs
380
381
000074bc d sCamTracks
382
383
000076bc b sCurrentCamTrack
384
385
000076c0 b sCurrentCamTrackStartTick
386
387
000076c4 b sDemoStopped
388
389
000076b4 b sGroundPlane
390
391
000074b8 d sNextCamTrackStartTick
392
393
00007658 b sRandomSeed
394
395
000076b8 b sStartTick
396
397
0000765c b sSuperShapeObjects
398
399
00005c20 r sSuperShapeParams
400
401
000076b0 b sTick
402
403
000076c8 b sTimeOffset
404
405
000076d0 b sTimeOffsetInit
406
407
000076cc b sTimeStopped
408
409
00007650 d sWindowHeight
410
411
0000764c d sWindowWidth
412
413
000048e4 t search_EIT_table
414
415
000048cc t selfrel_offset31
416
417
U sin
418
419
U sqrt
420
421
00002164 t ssFunc
422
423
00001e20 t superShapeMap
424
425
00005830 t unwind_UCB_from_context
426
427
00005104 t unwind_phase2
428
429
00004fcc t unwind_phase2_forced
这里可以看到几乎所有的函数名全局变量名都会被导出。其中有Java_com_example_SanAngeles_为前缀的JNI接口函数,有importGLInit这些普通函数,有freeGLObject这些局部(static)函数,还有sStartTick等全局变量名。其实在这个动态发布的时候,只需要导出java_com_开头的jni函数就可以了,里面这些细节函数名完全不需要暴露出来。
如何做到这一点呢?首先,我们需要了解gcc新引进的选项-fvisibility=hidden,这个编译选项可以把所有的符号名(包括函数名和全局变量名)都强制标记成隐藏属性。我们可以在Android.mk中可以通过修改LOCAL_CFLAGS选项加入-fvisibility=hidden来做到这一点,这样编译之后的.so看到的符号表为:
001
000033d0 t Java_com_example_SanAngeles_DemoGLSurfaceView_nativePause
002
00003408 t Java_com_example_SanAngeles_DemoRenderer_nativeDone
003
0000344c t Java_com_example_SanAngeles_DemoRenderer_nativeInit
004
00003384 t Java_com_example_SanAngeles_DemoRenderer_nativeRender
005
00003414 t Java_com_example_SanAngeles_DemoRenderer_nativeResize
006
00007104 a _DYNAMIC
007
000071dc a _GLOBAL_OFFSET_TABLE_
008
0000554c T _Unwind_Backtrace
009
00004748 T _Unwind_Complete
010
0000474c T _Unwind_DeleteException
011
00005528 T _Unwind_ForcedUnwind
012
00004740 T _Unwind_GetCFA
013
000055d0 T _Unwind_GetDataRelBase
014
000045fc t _Unwind_GetGR
015
000055d8 t _Unwind_GetGR
016
00005608 T _Unwind_GetLanguageSpecificData
017
00005624 T _Unwind_GetRegionStart
018
000055c8 T _Unwind_GetTextRelBase
019
000054bc T _Unwind_RaiseException
020
000054e0 T _Unwind_Resume
021
00005504 T _Unwind_Resume_or_Rethrow
022
00004670 t _Unwind_SetGR
023
000045b0 T _Unwind_VRS_Get
024
0000505c T _Unwind_VRS_Pop
025
00004624 T _Unwind_VRS_Set
026
0000459c t _Unwind_decode_target2
027
0000554c T ___Unwind_Backtrace
028
00005528 T ___Unwind_ForcedUnwind
029
000054bc T ___Unwind_RaiseException
030
000054e0 T ___Unwind_Resume
031
00005504 T ___Unwind_Resume_or_Rethrow
032
00003644 T __adddf3
033
00003f0c T __addsf3
034
000044c8 T __aeabi_cfcmpeq
035
000044c8 T __aeabi_cfcmple
036
000044b8 T __aeabi_cfrcmple
037
00003e60 T __aeabi_d2f
038
00003644 T __aeabi_dadd
039
00003c5c T __aeabi_ddiv
040
000039f0 T __aeabi_dmul
041
00003638 T __aeabi_drsub
042
00003640 T __aeabi_dsub
043
0000393c T __aeabi_f2d
044
00004540 T __aeabi_f2iz
045
00003f0c T __aeabi_fadd
046
000044dc T __aeabi_fcmpeq
047
00004518 T __aeabi_fcmpge
048
0000452c T __aeabi_fcmpgt
049
00004504 T __aeabi_fcmple
050
000044f0 T __aeabi_fcmplt
051
000042e8 T __aeabi_fdiv
052
00004150 T __aeabi_fmul
053
00003f00 T __aeabi_frsub
054
00003f08 T __aeabi_fsub
055
00003914 T __aeabi_i2d
056
000040a4 T __aeabi_i2f
057
00003540 T __aeabi_idiv
058
00003634 T __aeabi_idiv0
059
0000361c T __aeabi_idivmod
060
00003990 T __aeabi_l2d
061
000040d4 T __aeabi_l2f
062
00003634 T __aeabi_ldiv0
063
000038f0 T __aeabi_ui2d
064
0000409c T __aeabi_ui2f
065
0000347c T __aeabi_uidiv
066
00003528 T __aeabi_uidivmod
067
0000397c T __aeabi_ul2d
068
000040c4 T __aeabi_ul2f
069
00004b2c T __aeabi_unwind_cpp_pr0
070
00004b24 W __aeabi_unwind_cpp_pr1
071
00004b1c W __aeabi_unwind_cpp_pr2
072
U __android_log_print
073
000074a4 A __bss_end__
074
00007428 A __bss_start
075
00007428 A __bss_start__
076
00004458 T __cmpsf2
077
w __cxa_begin_cleanup
078
w __cxa_call_unexpected
079
w __cxa_type_match
080
00007288 D __data_start
081
00003634 T __div0
082
00003c5c T __divdf3
083
000042e8 T __divsf3
084
00003540 T __divsi3
085
000074a4 A __end__
086
00004458 T __eqsf2
087
00006104 A __exidx_end
088
00005f74 A __exidx_start
089
0000393c T __extendsfdf2
090
00004540 T __fixsfsi
091
00003990 T __floatdidf
092
000040d4 T __floatdisf
093
00003914 T __floatsidf
094
000040a4 T __floatsisf
095
0000397c T __floatundidf
096
000040c4 T __floatundisf
097
000038f0 T __floatunsidf
098
0000409c T __floatunsisf
099
00004448 T __gesf2
100
00004cd4 T __gnu_Unwind_Backtrace
101
w __gnu_Unwind_Find_exidx
102
00004eb8 T __gnu_Unwind_ForcedUnwind
103
00004f2c T __gnu_Unwind_RaiseException
104
000053dc T __gnu_Unwind_Restore_VFP
105
000053ec T __gnu_Unwind_Restore_VFP_D
106
000053fc T __gnu_Unwind_Restore_VFP_D_16_to_31
107
00005494 T __gnu_Unwind_Restore_WMMXC
108
0000540c T __gnu_Unwind_Restore_WMMXD
109
00004ff0 T __gnu_Unwind_Resume
110
00004fd0 T __gnu_Unwind_Resume_or_Rethrow
111
000053e4 T __gnu_Unwind_Save_VFP
112
000053f4 T __gnu_Unwind_Save_VFP_D
113
00005404 T __gnu_Unwind_Save_VFP_D_16_to_31
114
000054a8 T __gnu_Unwind_Save_WMMXC
115
00005450 T __gnu_Unwind_Save_WMMXD
116
00005634 T __gnu_unwind_execute
117
000059b0 T __gnu_unwind_frame
118
0000476c t __gnu_unwind_pr_common
119
00004448 T __gtsf2
120
00004450 T __lesf2
121
00004450 T __ltsf2
122
000039f0 T __muldf3
123
00004150 T __mulsf3
124
00004458 T __nesf2
125
000053c8 T __restore_core_regs
126
00003640 T __subdf3
127
00003f08 T __subsf3
128
00003e60 T __truncdfsf2
129
0000347c T __udivsi3
130
000074a4 A _bss_end__
131
00007428 A _edata
132
000074a4 A _end
133
00003360 t _getTime
134
00080000 N _stack
135
U abort
136
00001e98 t appDeinit
137
00002008 t appInit
138
00002cb0 t appRender
139
U cos
140
00001c98 t drawGLObject
141
00001ce8 t drawModels
142
U
free
143
00001e78 t freeGLObject
144
00007424 d gAppAlive
145
00004b34 t get_eit_entry
146
U gettimeofday
147
U glBlendFunc
148
U glClear
149
U glClearColorx
150
U glColor4x
151
U glColorPointer
152
U glDisable
153
U glDisableClientState
154
U glDrawArrays
155
U glEnable
156
U glEnableClientState
157
U glFrustumx
158
U glLightxv
159
U glLoadIdentity
160
U glMaterialx
161
U glMaterialxv
162
U glMatrixMode
163
U glMultMatrixx
164
U glNormalPointer
165
U glPopMatrix
166
U glPushMatrix
167
U glRotatex
168
U glScalex
169
U glShadeModel
170
U glTranslatex
171
U glVertexPointer
172
U glViewport
173
00001bec t importGLDeinit
174
00001be8 t importGLInit
175
000073bc d light0Diffuse.3407
176
000073ac d light0Position.3406
177
000073dc d light1Diffuse.3409
178
000073cc d light1Position.3408
179
000073fc d light2Diffuse.3411
180
000073ec d light2Position.3410
181
U malloc
182
0000740c d materialSpecular.3412
183
U memcpy
184
00001ec4 t newGLObject
185
00005570 t next_unwind_byte
186
U pow
187
00005edc r quadVertices.3337
188
000053c8 T restore_core_regs
189
00004c68 t restore_non_core_regs
190
0000728c d sCamTracks
191
0000748c b sCurrentCamTrack
192
00007490 b sCurrentCamTrackStartTick
193
00007494 b sDemoStopped
194
00007484 b sGroundPlane
195
00007288 d sNextCamTrackStartTick
196
00007428 b sRandomSeed
197
00007488 b sStartTick
198
0000742c b sSuperShapeObjects
199
000059f0 r sSuperShapeParams
200
00007480 b sTick
201
00007498 b sTimeOffset
202
000074a0 b sTimeOffsetInit
203
0000749c b sTimeStopped
204
00007420 d sWindowHeight
205
0000741c d sWindowWidth
206
000046b4 t search_EIT_table
207
0000469c t selfrel_offset31
208
U sin
209
U sqrt
210
00001f34 t ssFunc
211
00001bf0 t superShapeMap
212
00005600 t unwind_UCB_from_context
213
00004ed4 t unwind_phase2
214
00004d9c t unwind_phase2_forced
这里可以看到所有源代码里出现的函数名和全局变量名(符号名)都变成了't',也就是说都是局部符号(类似于static),这样这些函数名主程序是看不到的。我们还需要把jni的入口函数变成'T'类型才行,我们可以修改jni入口函数的属性来导出这些入口函数,比如app-android.c中的Java_com_example_SanAngeles_DemoRenderer_nativeInit函数,可以改为:
1
void
__attribute__ ((visibility (
"default"
)))
2
Java_com_example_SanAngeles_DemoRenderer_nativeInit ( JNIEnv* env )
3
{
4
importGLInit();
5
appInit();
6
gAppAlive = 1;
7
sDemoStopped = 0;
8
sTimeOffsetInit = 0;
9
}
其他几个Java_com_example_SanAngeles_开头的函数也这样修改一下即可。这样编译之后我们看到的符号表里所有Java_com_example_SanAngeles_开头的函数又变成'T'类型了。
最后我们还有一个问题就是如何隐藏那些局部符号名呢(t类型的符号)?我们可以调用strip -x来去掉这些局部的符号名。我们可以通过修改Android.mk重定义cmd-strip这个命令来实现,修改后的Android.mk如下:
01
LOCAL_PATH := $(call my-
dir
)
02
03
cmd-strip = $(TOOLCHAIN_PREFIX)strip --strip-debug -x $1
04
05
include $(CLEAR_VARS)
06
07
LOCAL_MODULE := sanangeles
08
09
LOCAL_CFLAGS := -DANDROID_NDK \
10
-DDISABLE_IMPORTGL \
11
-fvisibility=hidden
12
13
LOCAL_SRC_FILES := \
14
importgl.c \
15
demo.c \
16
app-android.c \
17
18
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
19
20
include $(BUILD_SHARED_LIBRARY)
这样每次编译之后会自动strip掉这些局部的符号名,如下:
001
00003540 T Java_com_example_SanAngeles_DemoGLSurfaceView_nativePause
002
00003578 T Java_com_example_SanAngeles_DemoRenderer_nativeDone
003
000035bc T Java_com_example_SanAngeles_DemoRenderer_nativeInit
004
000034f4 T Java_com_example_SanAngeles_DemoRenderer_nativeRender
005
00003584 T Java_com_example_SanAngeles_DemoRenderer_nativeResize
006
000056bc T _Unwind_Backtrace
007
000048b8 T _Unwind_Complete
008
000048bc T _Unwind_DeleteException
009
00005698 T _Unwind_ForcedUnwind
010
000048b0 T _Unwind_GetCFA
011
00005740 T _Unwind_GetDataRelBase
012
00005778 T _Unwind_GetLanguageSpecificData
013
00005794 T _Unwind_GetRegionStart
014
00005738 T _Unwind_GetTextRelBase
015
0000562c T _Unwind_RaiseException
016
00005650 T _Unwind_Resume
017
00005674 T _Unwind_Resume_or_Rethrow
018
00004720 T _Unwind_VRS_Get
019
000051cc T _Unwind_VRS_Pop
020
00004794 T _Unwind_VRS_Set
021
000056bc T ___Unwind_Backtrace
022
00005698 T ___Unwind_ForcedUnwind
023
0000562c T ___Unwind_RaiseException
024
00005650 T ___Unwind_Resume
025
00005674 T ___Unwind_Resume_or_Rethrow
026
000037b4 T __adddf3
027
0000407c T __addsf3
028
00004638 T __aeabi_cfcmpeq
029
00004638 T __aeabi_cfcmple
030
00004628 T __aeabi_cfrcmple
031
00003fd0 T __aeabi_d2f
032
000037b4 T __aeabi_dadd
033
00003dcc T __aeabi_ddiv
034
00003b60 T __aeabi_dmul
035
000037a8 T __aeabi_drsub
036
000037b0 T __aeabi_dsub
037
00003aac T __aeabi_f2d
038
000046b0 T __aeabi_f2iz
039
0000407c T __aeabi_fadd
040
0000464c T __aeabi_fcmpeq
041
00004688 T __aeabi_fcmpge
042
0000469c T __aeabi_fcmpgt
043
00004674 T __aeabi_fcmple
044
00004660 T __aeabi_fcmplt
045
00004458 T __aeabi_fdiv
046
000042c0 T __aeabi_fmul
047
00004070 T __aeabi_frsub
048
00004078 T __aeabi_fsub
049
00003a84 T __aeabi_i2d
050
00004214 T __aeabi_i2f
051
000036b0 T __aeabi_idiv
052
000037a4 T __aeabi_idiv0
053
0000378c T __aeabi_idivmod
054
00003b00 T __aeabi_l2d
055
00004244 T __aeabi_l2f
056
000037a4 T __aeabi_ldiv0
057
00003a60 T __aeabi_ui2d
058
0000420c T __aeabi_ui2f
059
000035ec T __aeabi_uidiv
060
00003698 T __aeabi_uidivmod
061
00003aec T __aeabi_ul2d
062
00004234 T __aeabi_ul2f
063
00004c9c T __aeabi_unwind_cpp_pr0
064
00004c94 W __aeabi_unwind_cpp_pr1
065
00004c8c W __aeabi_unwind_cpp_pr2
066
U __android_log_print
067
00007614 A __bss_end__
068
00007598 A __bss_start
069
00007598 A __bss_start__
070
000045c8 T __cmpsf2
071
w __cxa_begin_cleanup
072
w __cxa_call_unexpected
073
w __cxa_type_match
074
000073f8 D __data_start
075
000037a4 T __div0
076
00003dcc T __divdf3
077
00004458 T __divsf3
078
000036b0 T __divsi3
079
00007614 A __end__
080
000045c8 T __eqsf2
081
00006274 A __exidx_end
082
000060e4 A __exidx_start
083
00003aac T __extendsfdf2
084
000046b0 T __fixsfsi
085
00003b00 T __floatdidf
086
00004244 T __floatdisf
087
00003a84 T __floatsidf
088
00004214 T __floatsisf
089
00003aec T __floatundidf
090
00004234 T __floatundisf
091
00003a60 T __floatunsidf
092
0000420c T __floatunsisf
093
000045b8 T __gesf2
094
00004e44 T __gnu_Unwind_Backtrace
095
w __gnu_Unwind_Find_exidx
096
00005028 T __gnu_Unwind_ForcedUnwind
097
0000509c T __gnu_Unwind_RaiseException
098
0000554c T __gnu_Unwind_Restore_VFP
099
0000555c T __gnu_Unwind_Restore_VFP_D
100
0000556c T __gnu_Unwind_Restore_VFP_D_16_to_31
101
00005604 T __gnu_Unwind_Restore_WMMXC
102
0000557c T __gnu_Unwind_Restore_WMMXD
103
00005160 T __gnu_Unwind_Resume
104
00005140 T __gnu_Unwind_Resume_or_Rethrow
105
00005554 T __gnu_Unwind_Save_VFP
106
00005564 T __gnu_Unwind_Save_VFP_D
107
00005574 T __gnu_Unwind_Save_VFP_D_16_to_31
108
00005618 T __gnu_Unwind_Save_WMMXC
109
000055c0 T __gnu_Unwind_Save_WMMXD
110
000057a4 T __gnu_unwind_execute
111
00005b20 T __gnu_unwind_frame
112
000045b8 T __gtsf2
113
000045c0 T __lesf2
114
000045c0 T __ltsf2
115
00003b60 T __muldf3
116
000042c0 T __mulsf3
117
000045c8 T __nesf2
118
00005538 T __restore_core_regs
119
000037b0 T __subdf3
120
00004078 T __subsf3
121
00003fd0 T __truncdfsf2
122
000035ec T __udivsi3
123
00007614 A _bss_end__
124
00007598 A _edata
125
00007614 A _end
126
00080000 N _stack
127
U abort
128
U cos
129
U
free
130
U gettimeofday
131
U glBlendFunc
132
U glClear
133
U glClearColorx
134
U glColor4x
135
U glColorPointer
136
U glDisable
137
U glDisableClientState
138
U glDrawArrays
139
U glEnable
140
U glEnableClientState
141
U glFrustumx
142
U glLightxv
143
U glLoadIdentity
144
U glMaterialx
145
U glMaterialxv
146
U glMatrixMode
147
U glMultMatrixx
148
U glNormalPointer
149
U glPopMatrix
150
U glPushMatrix
151
U glRotatex
152
U glScalex
153
U glShadeModel
154
U glTranslatex
155
U glVertexPointer
156
U glViewport
157
U malloc
158
U memcpy
159
U pow
160
00005538 T restore_core_regs
161
U sin
162
U sqrt
这样局部符号都没有了,只有jni入口函数被导出。这样提高了jni动态库的安全性,同时.so文件的大小也小了不少。
关于elf文件的更多资料,可以参考这篇文章。
如果要了解gcc和strip更多的选项,请移步gcc和binutils的官方文档。
补充隐藏和显示方式:
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
#define DLL_CLASS __attribute__((visibility("default")))
LOCAL_CFLAGS += -fvisibility=hidden #默认隐藏符号