Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tools/binary_size/libsupersize/testdata/mock_toolchain/mock_nm.py

Issue 2832253004: supersize: nm in progress (Closed)
Patch Set: supersize: Track symbol aliases and shared symbols Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os
6 import sys
7
8
9 _GARBAGE = """002b6e20 t $t
10 00000010 N $d
11 002b6bb8 t $t"""
12
13 _ELF_OUTPUT = _GARBAGE + """
14 002a0010 t blink::ContiguousContainerBase::shrinkToFit() [clone .part.1234] [clo ne .isra.2]
15 0028d900 t startup._GLOBAL__sub_I_page_allocator.cc
16 002a0010 t FooAlias()
17 002a0010 t BarAlias()
18 002a0000 t blink::ContiguousContainerBase::shrinkToFit()
19 002a0000 t BazAlias(bool)
20 """
21
22 _SHRINK_TO_FIT = ('blink::ContiguousContainerBase::shrinkToFit() '
23 '[clone .part.1234] [clone .isra.2]')
24 _OBJECT_OUTPUTS = {
25 'obj/third_party/icu/icuuc/ucnv_ext.o': [
26 '01010101 t ' + _SHRINK_TO_FIT,
27 '01010101 t _GLOBAL__sub_I_SkDeviceProfile.cpp',
28 '01010101 t foo_bar',
29 '01010101 r vtable for ChromeMainDelegate',
30 '01010101 r vtable for chrome::mojom::FieldTrialRecorder',
31 ('01010101 t ucnv_extMatchFromU(int const*, int, unsigned short const*,'
32 ' int, unsigned short const*, int, unsigned int*, signed char, signed '
33 'char)'),
34 ],
35 'obj/third_party/WebKit.a': [
36 '',
37 'PaintChunker.o:',
38 '01010101 t ' + _SHRINK_TO_FIT,
39 '010101 t (anonymous namespace)::kAnimationFrameTimeHistogramClassPath',
40 '010101 r vtable for ChromeMainDelegateAndroid',
41 ('01010101 r blink::(anonymous namespace)::CSSValueKeywordsHash::findVa'
42 'lueImpl(char const*, unsigned int)::value_word_list'),
43 '',
44 'ContiguousContainer.o:',
45 '01010101 d chrome::mojom::FilePatcher::Name_',
46 '01010101 r vtable for chrome::mojom::FieldTrialRecorderProxy',
47 '01010101 r google::protobuf::internal::pLinuxKernelMemoryBarrier',
48 '01010101 r base::android::kBaseRegisteredMethods',
49 ('01010101 r base::android::(anonymous namespace)::g_renderer_histogram'
50 '_code'),
51 ('01010101 r base::android::(anonymous namespace)::g_library_version_nu'
52 'mber'),
53 ('01010101 t blink::ContiguousContainerBase::ContiguousContainerBase(bl'
54 'ink::ContiguousContainerBase&&)'),
55 ('01010101 t (anonymous namespace)::blink::PaintChunker::releasePaintCh'
56 'unks() [clone .part.1]'),
57 ],
58 'obj/base/base/page_allocator.o': [
59 '01010101 t _GLOBAL__sub_I_page_allocator.cc',
60 '01010101 t _GLOBAL__sub_I_bbr_sender.cc',
61 '01010101 t _GLOBAL__sub_I_pacing_sender.cc',
62 '01010101 t _GLOBAL__sub_I_bbr_sender.cc',
63 '01010101 t extFromUUseMapping(aj, int)',
64 '01010101 t extFromUUseMapping(signed char, unsigned int, int)',
65 '01010101 t Name',
66 '01010101 v vtable for mojo::MessageReceiver',
67 '01010101 r kMethodsAnimationFrameTimeHistogram',
68 '01010101 r google::protobuf::internal::pLinuxKernelCmpxchg',
69 ],
70 'obj/third_party/ffmpeg/libffmpeg_internal.a': [
71 '',
72 'fft_float.o:',
73 '01010101 b ff_cos_65536',
74 '01010101 b ff_cos_131072',
75 ''
76 'fft_fixed.o:'
77 '01010101 b ff_cos_131072_fixed',
78 ],
79 '../../third_party/gvr-android-sdk/libgvr_shim_static_arm.a': [
80 '',
81 'libcontroller_api_impl.a_controller_api_impl.o:'
82 '01010101 d .Lswitch.table.45',
83 '',
84 'libport_android_jni.a_jni_utils.o:',
85 '(anonymous namespace)::kSystemClassPrefixes',
86 ],
87 }
88
89 def _PrintHeader(path):
90 sys.stdout.write('\n')
91 sys.stdout.write(path + ':\n')
92
93
94 def _PrintOutput(path):
95 if path.endswith(os.path.join('mock_output_directory', 'elf')):
96 sys.stdout.write(_ELF_OUTPUT)
97 else:
98 lines = _OBJECT_OUTPUTS.get(path)
99 assert lines, 'No mock_nm.py entry for: ' + path
100 sys.stdout.write('\n'.join(lines))
101 sys.stdout.write('\n')
102
103
104 def main():
105 paths = [p for p in sys.argv[1:] if not p.startswith('-')]
106 if len(paths) == 1:
107 _PrintOutput(paths[0])
108 else:
109 for path in paths:
110 _PrintHeader(path)
111 _PrintOutput(path)
112
113
114 if __name__ == '__main__':
115 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698