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

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

Issue 2851473003: supersize: Track symbol aliases and shared symbols (Closed)
Patch Set: tweak nm interfface 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 sys
6
7
8 _HEADERS = """ELF Header:
9 Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
10 Class: ELF32
11 Data: 2's complement, little endian
12 Version: 1 (current)
13 OS/ABI: UNIX - System V
14 ABI Version: 0
15 Type: DYN (Shared object file)
16 Machine: ARM
17 Version: 0x1
18 Entry point address: 0x0
19 Start of program headers: 52 (bytes into file)
20 Start of section headers: 628588000 (bytes into file)
21 Flags: 0x5000200, Version5 EABI, soft-float ABI
22 Size of this header: 52 (bytes)
23 Size of program headers: 32 (bytes)
24 Number of program headers: 9
25 Size of section headers: 40 (bytes)
26 Number of section headers: 40
27 Section header string table index: 39
28 """
29
30 _SECTIONS = """There are 40 section headers, starting at offset 0x25777de0:
31
32 Section Headers:
33 [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
34 [ 0] NULL 00000000 000000 000000 00 0 0 0
35 [ 1] .interp PROGBITS 00000154 000154 000013 00 A 0 0 1
36 [ 2] .note.gnu.build-id NOTE 00000168 000168 000024 00 A 0 0 4
37 [ 3] .dynsym DYNSYM 0000018c 00018c 001960 10 A 4 1 4
38 [ 4] .dynstr STRTAB 00001b0c 001b0c 000fb9 00 A 0 0 1
39 [ 5] .hash HASH 00002ad4 002ad4 000a7c 04 A 3 0 4
40 [ 6] .gnu.version VERSYM 00003558 003558 00032c 02 A 3 0 2
41 [ 7] .gnu.version_d VERDEF 00003888 003888 00001c 00 A 4 1 4
42 [ 8] .gnu.version_r VERNEED 000038a4 0038a4 000060 00 A 4 3 4
43 [ 9] .rel.dyn REL 00003904 003904 288498 08 A 3 0 4
44 [10] .rel.plt REL 0029fbec 29fbec 000b00 08 A 3 0 4
45 [11] .plt PROGBITS 002a06ec 2a06ec 001094 00 AX 0 0 4
46 [12] .text PROGBITS 002a1780 2a1780 223cd28 00 AX 0 0 64
47 [13] .rodata PROGBITS 02605000 2605000 5a72e4 00 A 0 0 256
48 [14] .ARM.exidx ARM_EXIDX 02bd3d10 2bd3d10 1771c8 08 AL 12 0 4
49 [15] .ARM.extab PROGBITS 02bd5858 2bd5858 02cd50 00 A 0 0 4
50 [16] .data.rel.ro.local PROGBITS 02bdac40 2bd9c40 0c0e08 00 WA 0 0 16
51 [17] .data.rel.ro PROGBITS 02c9d420 2c9c420 104108 00 WA 0 0 16
52 [18] .init_array INIT_ARRAY 02da4680 2da3680 000008 00 WA 0 0 4
53 [19] .fini_array FINI_ARRAY 02da4774 2da3774 000008 00 WA 0 0 4
54 [20] .dynamic DYNAMIC 02da477c 2da377c 000130 08 WA 4 0 4
55 [21] .got PROGBITS 02da48b4 2da38b4 00a7cc 00 WA 0 0 4
56 [22] .data PROGBITS 02db0000 2daf000 018d88 00 WA 0 0 32
57 [23] .bss NOBITS 02dc8220 2dc7220 13d7e8 00 WA 0 0 32
58 [35] .note.gnu.gold-version NOTE 00000000 226c41e8 00001c 00 0 0 4
59 [36] .ARM.attributes ARM_ATTRIBUTES 00000000 226c4204 00003c 00 0 0 1
60 [37] .symtab SYMTAB 00000000 226c4240 105ef20 10 38 901679 4
61 [38] .strtab STRTAB 00000000 23487ea0 213a4fe 00 0 0 1
62 [39] .shstrtab STRTAB 00000000 25777c2a 0001b4 00 0 0 1
63 Key to Flags:
64 W (write), A (alloc), X (execute), M (merge), S (strings)
65 I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
66 O (extra OS processing required) o (OS specific), p (processor specific)
67 """
68
69 _NOTES = """
70 Displaying notes found at file offset 0x00000168 with length 0x00000024:
71 Owner Data size\tDescription
72 GNU 0x00000014\tNT_GNU_BUILD_ID (unique build ID bitstring)
73 Build ID: WhatAnAmazingBuildId
74
75 Displaying notes found at file offset 0x226c41e8 with length 0x0000001c:
76 Owner Data size\tDescription
77 GNU 0x00000009\tNT_GNU_GOLD_VERSION (gold version)
78 """
79
80
81 def main():
82 if sys.argv[1] == '-h':
83 sys.stdout.write(_HEADERS)
84 elif sys.argv[1] == '-S':
85 sys.stdout.write(_SECTIONS)
86 elif sys.argv[1] == '-n':
87 sys.stdout.write(_NOTES)
88 else:
89 assert False, 'Invalid args: %s' % sys.argv
90
91
92 if __name__ == '__main__':
93 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698