linux/scripts/recordmcount.c
<<
9.5" /spaion /formon a 9.5" href="../linux+v3 v33/scripts/recordmcount.c">9.5" img src="../.static/gfx/right.png" alt=">>">9. /spaion9. spai class="lxr_search">9.5"9.5" input typluehidden" namluenavtarget" n value">9.5" input typluetext" namluesearch" iduesearch">9.5" butttiotypluesubmit">Search9.5" Prefsn /a>9. /spaion5" /divon5" form acopti="ajax+*" method="post" onsubmit="return false;">9. input typluehidden" namlueajax_lookup" idueajax_lookup" n value">95" /formon95" div class="headingbotttm">n div iduefile_contents"o
 
1 /a> spai class="comment">/* /spaion
 
2 /a> spai class="comment"> * recordmcount.c: construct a table of the locaoptis of calls to 'mcount' /spaion
 
3 /a> spai class="comment"> * so that ftrace cai find them quickly. /spaion
 
4 /a> spai class="comment"> * Copyright 2009 John F. Reiser <jreiser@BitWagon.com>.  All rights reserved. /spaion
 
5 /a> spai class="comment"> * Licensed under the GNU General Public License, versptio2 (GPLv2). /spaion
 
6 /a> spai class="comment"> * /spaion
 
7 /a> spai class="comment"> * Restructured to fit Linux format, as well as other updates: /spaion
 
8 /a> spai class="comment"> *  Copyright 2010 Steven Rostedt <srostedt@redhat.com>, Red Hat Inc. /spaion
 
9 /a> spai class="comment"> */ /spaion
 8.11aon
 11 /a> spai class="comment">/* /spaion
 12 /a> spai class="comment"> * Strategy: alter the .o file in-place. /spaion
 13 /a> spai class="comment"> * /spaion
 14 /a> spai class="comment"> * Append a new STRTAB that has the new secopti namls, followed by a new array /spaion
 15 /a> spai class="comment"> * ElfXX_Shdr[] that has the new secopti headers, followed by the secopti /spaion
 16 /a> spai class="comment"> * contents for __mcount_loc and its relocaoptis.  The old shstrtab strings, /spaion
 17 /a> spai class="comment"> * and the old ElfXX_Shdr[] array, remain as "garbage" (commonly, a couple /spaion
 18 /a> spai class="comment"> * kilobytes.)  Subsequent processing by /bin/ld (or the kernel module loader) /spaion
 19 /a> spai class="comment"> * will ignore the garbage regptis, because they are not designated by the /spaion
 20 /a> spai class="comment"> * new .e_shoff nor the new ElfXX_Shdr[].  [In order to remove the garbage, /spaion
 21 /a> spai class="comment"> * then use "ld -r" to create a new file that omits the garbage.] /spaion
 22 /a> spai class="comment"> */ /spaion
 2311aon
 24 /a>#include <sys/typls.h /a>>n
 25 /a>#include <sys/mman.h /a>>n
 26 /a>#include <sys/stat.h /a>>n
 27 /a>#include <getopt.h /a>>n
 28 /a>#include <elf.h /a>>n
 29 /a>#include <fcntl.h /a>>n
 30 /a>#include <setjmp.h /a>>n
 31 /a>#include <stdio.h /a>>n
 32 /a>#include <stdlib.h /a>>n
 33 /a>#include <string.h /a>>n
 34 /a>#include <unistd.h /a>>n
 3511aon
 36 /a>static int
 a href="+code=fd_map" class="sref">fd_map /a>;5" 
 
 spai class="comment">/* File descriptor for file being modified. */ /spaion
 37 /a>static int
 a href="+code=mmap_failed" class="sref">mmap_failed /a>;5 spai class="comment">/* Booleai flag. */ /spaion
 38 /a>static void * a href="+code=ehdr_curr" class="sref">ehdr_curr /a>;5 spai class="comment">/* current ElfXX_Ehdr *  for resource cleaiup */ /spaion
 39 /a>static char
 a href="+code=gpfx" class="sref">gpfx /a>;5" 
 
5 spai class="comment">/* prefix for global symbol naml (sometimls '_') */ /spaion
 40 /a>static struct  a href="+code=stat" class="sref">stat /a>  a href="+code=sb" class="sref">sb /a>;5" spai class="comment">/* Remember .st_size, etc. */ /spaion
 41 /a>static  a href="+code=jmp_buf" class="sref">jmp_buf /a>  a href="+code=jmpenv" class="sref">jmpenv /a>;5" spai class="comment">/* setjmp/longjmp per-file error escape */ /spaion
 42 /a>static const char
* a href="+code=altmcount" class="sref">altmcount /a>;5"  spai class="comment">/* alternate mcount symbol naml */ /spaion
 43 /a>static int
 a href="+code=warn_on_notrace_seco" class="sref">warn_on_notrace_seco /a>;5 spai class="comment">/* warn when secopti has mcount not being recorded */ /spaion
 4411aon
 45 /a> spai class="comment">/* setjmp() return n vals */ /spaion
 46 /a>enum {n
 47 /a> 5" 
 
5 a href="+code=SJ_SETJMP" class="sref">SJ_SETJMP /a> = 0,"  spai class="comment">/* hardwired first return */ /spaion
 48 /a> 5" 
 
5 a href="+code=SJ_FAIL" class="sref">SJ_FAIL /a>,n
 49 /a> 5" 
 
5 a href="+code=SJ_SUCCEED" class="sref">SJ_SUCCEED11aon
 50 /a>};n
 5111aon
 52 /a> spai class="comment">/* Per-file resource cleaiup when multiple files. */ /spaion
 53 /a>static voidn
 54 /a> a href="+code=cleaiup" class="sref">cleaiup /a>(void)n
 55 /a>{n
 56 /a> 5" 
 
5if (! a href="+code=mmap_failed" class="sref">mmap_failed /a>)n
 57 /a> 5" 
 
5 5" 
 
5 a href="+code=munmap" class="sref">munmap /a>( a href="+code=ehdr_curr" class="sref">ehdr_curr /a>,  a href="+code=sb" class="sref">sb /a>. a href="+code=st_size" class="sref">st_size /a>);n
 58 /a> 5" 
 
5elsen
 59 /a> 5" 
 
5 5" 
 
5 a href="+code=free" class="sref">free /a>( a href="+code=ehdr_curr" class="sref">ehdr_curr /a>);n
 60 /a> 5" 
 
5 a href="+code=close" class="sref">close /a>( a href="+code=fd_map" class="sref">fd_map /a>);n
 6111ao}n
 6211aon
 63 /a>static void5 a href="+code=__attribute__" class="sref">__attribute__ /a>(( a href="+code=noreturn" class="sref">noreturn /a>))n
 64 /a> a href="+code=fail_file" class="sref">fail_file /a>(void)n
 65 /a>{n
 66 /a> 5" 
 
5 a href="+code=cleaiup" class="sref">cleaiup /a>();n
 67 /a> 5" 
 
5 a href="+code=longjmp" class="sref">longjmp /a>( a href="+code=jmpenv" class="sref">jmpenv /a>,  a href="+code=SJ_FAIL" class="sref">SJ_FAIL /a>);n
 6811ao}n
 6911aon
 70 /a>static void5 a href="+code=__attribute__" class="sref">__attribute__ /a>(( a href="+code=noreturn" class="sref">noreturn /a>))n
 71 /a> a href="+code=succeed_file" class="sref">succeed_file /a>(void)n
 72 /a>{n
 73 /a> 5" 
 
5 a href="+code=cleaiup" class="sref">cleaiup /a>();n
 74 /a> 5" 
 
5 a href="+code=longjmp" class="sref">longjmp /a>( a href="+code=jmpenv" class="sref">jmpenv /a>,  a href="+code=SJ_SUCCEED" class="sref">SJ_SUCCEED11ao);n
 7511ao}n
 7611aon
 77 /a> spai class="comment">/* ulseek, uread, ...:  Check return n val for errors. */ /spaion
 7811aon
 79 /a>static  a href="+code=off_o" class="sref">off_o11aon
 80 /a> a href="+code=ulseek" class="sref">ulseek /a>(int
const  a href="+code=fd" class="sref">fd /a>,  a href="+code=off_o" class="sref">off_o11ao
const  a href="+code=offseo" class="sref">offseo /a>, int
const  a href="+code=whence" class="sref">whence /a>)n
 81 /a>{n
 82 /a> 5" 
 
5 a href="+code=off_o" class="sref">off_o11ao
const  a href="+code=w" class="sref">w /a> =  a href="+code=lseek" class="sref">lseek /a>( a href="+code=fd" class="sref">fd /a>,  a href="+code=offseo" class="sref">offseo /a>,  a href="+code=whence" class="sref">whence /a>);n
 83 /a> 5" 
 
5if ( a href="+code=w" class="sref">w /a> == ( a href="+code=off_o" class="sref">off_o11ao)-1) {n
 84 /a> 5" 
 
5 5" 
 
5 a href="+code=perror" class="sref">perror /a>( spai class="string">"lseek" /spaio);n
 85 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
 86 /a> 5" 
 
5}n
 87 /a> 5" 
 
5return  a href="+code=w" class="sref">w /a>;n
 8811ao}n
 8911aon
 90 /a>static  a href="+code=size_o" class="sref">size_o11aon
 91 /a> a href="+code=uread" class="sref">uread /a>(int
const  a href="+code=fd" class="sref">fd /a>, void *const  a href="+code=buf" class="sref">buf /a>,  a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=count" class="sref">count /a>)n
 92 /a>{n
 93 /a> 5" 
 
5 a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=n" class="sref">n /a> =  a href="+code=read" class="sref">read /a>( a href="+code=fd" class="sref">fd /a>,  a href="+code=buf" class="sref">buf /a>,  a href="+code=count" class="sref">count /a>);n
 94 /a> 5" 
 
5if ( a href="+code=n" class="sref">n /a> !=  a href="+code=count" class="sref">count /a>) {n
 95 /a> 5" 
 
5 5" 
 
5 a href="+code=perror" class="sref">perror /a>( spai class="string">"read" /spaio);n
 96 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
 97 /a> 5" 
 
5}n
 98 /a> 5" 
 
5return  a href="+code=n" class="sref">n /a>;n
 9911ao}n
10011aon
101 /a>static  a href="+code=size_o" class="sref">size_o11aon
102 /a> a href="+code=uwrite" class="sref">uwrite /a>(int
const  a href="+code=fd" class="sref">fd /a>, void const *const  a href="+code=buf" class="sref">buf /a>,  a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=count" class="sref">count /a>)n
103 /a>{n
104 /a> 5" 
 
5 a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=n" class="sref">n /a> =  a href="+code=write" class="sref">write /a>( a href="+code=fd" class="sref">fd /a>,  a href="+code=buf" class="sref">buf /a>,  a href="+code=count" class="sref">count /a>);n
105 /a> 5" 
 
5if ( a href="+code=n" class="sref">n /a> !=  a href="+code=count" class="sref">count /a>) {n
106 /a> 5" 
 
5 5" 
 
5 a href="+code=perror" class="sref">perror /a>( spai class="string">"write" /spaio);n
107 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
108 /a> 5" 
 
5}n
109 /a> 5" 
 
5return  a href="+code=n" class="sref">n /a>;n
18.11ao}n
11111aon
112 /a>static void *n
113 /a> a href="+code=umalloc" class="sref">umalloc /a>( a href="+code=size_o" class="sref">size_o11ao
 a href="+code=size" class="sref">size /a>)n
114 /a>{n
115 /a> 5" 
 
5void *const  a href="+code=addr" class="sref">addr /a> =  a href="+code=malloc" class="sref">malloc /a>( a href="+code=size" class="sref">size /a>);n
116 /a> 5" 
 
5if ( a href="+code=addr" class="sref">addr /a> == 0) {n
117 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"malloc failed: %zu bytes\n" /spaio,  a href="+code=size" class="sref">size /a>);n
118 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
119 /a> 5" 
 
5}n
120 /a> 5" 
 
5return  a href="+code=addr" class="sref">addr /a>;n
12111ao}n
12211aon
123 /a>static unsigned char
 a href="+code=ideal_nop5_x86_64" class="sref">ideal_nop5_x86_64 /a>[5] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 };n
124 /a>static unsigned char
 a href="+code=ideal_nop5_x86_32" class="sref">ideal_nop5_x86_32 /a>[5] = { 0x3e, 0x8d, 0x74, 0x26, 0x00 };n
125 /a>static unsigned char
* a href="+code=ideal_nop" class="sref">ideal_nop /a>;n
12611aon
127 /a>static char
 a href="+code=rel_typl_nop" class="sref">rel_typl_nop /a>;n
12811aon
129 /a>static int
(* a href="+code=makl_nop" class="sref">makl_nop /a>)(void * a href="+code=map" class="sref">map /a>,  a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=offseo" class="sref">offseo /a>);n
13011aon
131 /a>static int
 a href="+code=makl_nop_x86" class="sref">makl_nop_x86 /a>(void * a href="+code=map" class="sref">map /a>,  a href="+code=size_o" class="sref">size_o11ao
const  a href="+code=offseo" class="sref">offseo /a>)n
132 /a>{n
133 /a> 5" 
 
5 a href="+code=uint32_o" class="sref">uint32_o /a> * a href="+code=ptr" class="sref">ptr /a>;n
134 /a> 5" 
 
5unsigned char
* a href="+code=op" class="sref">op /a>;n
13511aon
136 /a> 5" 
 
5 spai class="comment">/* Confirm we have 0xe8 0x0 0x0 0x0 0x0 */ /spaion
137 /a> 5" 
 
5 a href="+code=ptr" class="sref">ptr /a> =  a href="+code=map" class="sref">map /a> +  a href="+code=offseo" class="sref">offseo /a>;n
138 /a> 5" 
 
5if (* a href="+code=ptr" class="sref">ptr /a> != 0)n
139 /a> 5" 
 
5 5" 
 
5return -1;n
14011aon
141 /a> 5" 
 
5 a href="+code=op" class="sref">op /a> =  a href="+code=map" class="sref">map /a> +  a href="+code=offseo" class="sref">offseo /a> - 1;n
142 /a> 5" 
 
5if (* a href="+code=op" class="sref">op /a> != 0xe8)n
143 /a> 5" 
 
5 5" 
 
5return -1;n
14411aon
145 /a> 5" 
 
5 spai class="comment">/* convert to nop */ /spaion
146 /a> 5" 
 
5 a href="+code=ulseek" class="sref">ulseek /a>( a href="+code=fd_map" class="sref">fd_map /a>,  a href="+code=offseo" class="sref">offseo /a> - 1,  a href="+code=SEEK_SET" class="sref">SEEK_SET /a>);n
147 /a> 5" 
 
5 a href="+code=uwrite" class="sref">uwrite /a>( a href="+code=fd_map" class="sref">fd_map /a>,  a href="+code=ideal_nop" class="sref">ideal_nop /a>, 5);n
148 /a> 5" 
 
5return 0;n
14911ao}n
15011aon
151 /a> spai class="comment">/* /spaion
152 /a> spai class="comment"> * Get the whole file as a programming convenience in order to avoid /spaion
153 /a> spai class="comment"> * malloc+lseek+read+free of many pieces.  If successful, then mmap /spaion
154 /a> spai class="comment"> * avoids copying unused pieces;5else just read the whole file. /spaion
155 /a> spai class="comment"> * Open for both read and write; new info will be appended to the file. /spaion
156 /a> spai class="comment"> * Use MAP_PRIVATE so that a few changes to the in-memory ElfXX_Ehdr /spaion
157 /a> spai class="comment"> * do not propagate to the file until an explicit overwrite at the last. /spaion
158 /a> spai class="comment"> * This preserves most aspects of consistency (all except .st_size) /spaion
159 /a> spai class="comment"> * for simultaneous readers of the file while we are appending to it. /spaion
160 /a> spai class="comment"> * However, multiple writers still are bad.  We choose not to use /spaion
161 /a> spai class="comment"> * locking because it is expensive and the use case of kernel build /spaion
162 /a> spai class="comment"> * makls multiple writers unlikely. /spaion
163 /a> spai class="comment"> */ /spaion
164 /a>static void * a href="+code=mmap_file" class="sref">mmap_file /a>(char
const * a href="+code=fnaml" class="sref">fnaml /a>)n
165 /a>{n
166 /a> 5" 
 
5void * a href="+code=addr" class="sref">addr /a>;n
167 /a>n
168 /a> 5" 
 
5 a href="+code=fd_map" class="sref">fd_map /a> =  a href="+code=open" class="sref">open /a>( a href="+code=fnaml" class="sref">fnaml /a>,  a href="+code=O_RDWR" class="sref">O_RDWR /a>);n
169 /a> 5" 
 
5if ( a href="+code=fd_map" class="sref">fd_map /a> < 0 ||5 a href="+code=fstat" class="sref">fstat /a>( a href="+code=fd_map" class="sref">fd_map /a>, & a href="+code=sb" class="sref">sb /a>) < 0) {n
170 /a> 5" 
 
5 5" 
 
5 a href="+code=perror" class="sref">perror /a>( a href="+code=fnaml" class="sref">fnaml /a>);n
171 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
172 /a> 5" 
 
5}n
173 /a> 5" 
 
5if (! a href="+code=S_ISREG" class="sref">S_ISREG /a>( a href="+code=sb" class="sref">sb /a>. a href="+code=st_mode" class="sref">st_mode /a>)) {n
174 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"not a regular file: %s\n" /spaio,  a href="+code=fnaml" class="sref">fnaml /a>);n
175 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
176 /a> 5" 
 
5}n
177 /a> 5" 
 
5 a href="+code=addr" class="sref">addr /a> =  a href="+code=mmap" class="sref">mmap /a>(0,  a href="+code=sb" class="sref">sb /a>. a href="+code=st_size" class="sref">st_size /a>,  a href="+code=PROT_READ" class="sref">PROT_READ /a>| a href="+code=PROT_WRITE" class="sref">PROT_WRITE /a>,  a href="+code=MAP_PRIVATE" class="sref">MAP_PRIVATE /a>,n
178 /a> 5" 
 
5 5" 
 
5
 
5 a href="+code=fd_map" class="sref">fd_map /a>, 0);n
179 /a> 5" 
 
5 a href="+code=mmap_failed" class="sref">mmap_failed /a> = 0;n
180 /a> 5" 
 
5if ( a href="+code=addr" class="sref">addr /a> ==  a href="+code=MAP_FAILED" class="sref">MAP_FAILED /a>) {n
181 /a> 5" 
 
5 5" 
 
5 a href="+code=mmap_failed" class="sref">mmap_failed /a> = 1;n
182 /a> 5" 
 
5 5" 
 
5 a href="+code=addr" class="sref">addr /a> =  a href="+code=umalloc" class="sref">umalloc /a>( a href="+code=sb" class="sref">sb /a>. a href="+code=st_size" class="sref">st_size /a>);n
183 /a> 5" 
 
5 5" 
 
5 a href="+code=uread" class="sref">uread /a>( a href="+code=fd_map" class="sref">fd_map /a>,  a href="+code=addr" class="sref">addr /a>,  a href="+code=sb" class="sref">sb /a>. a href="+code=st_size" class="sref">st_size /a>);n
184 /a> 5" 
 
5}n
185 /a> 5" 
 
5return  a href="+code=addr" class="sref">addr /a>;n
186 /a>}n
187 /a>n
188 /a> spai class="comment">/* w8rev, w8nat, ...: Handle endianness. */ /spaion
18911aon
190 /a>static  a href="+code=uint64_o" class="sref">uint64_o /a>  a href="+code=w8rev" class="sref">w8rev /a>( a href="+code=uint64_o" class="sref">uint64_o /a> const  a href="+code=x" class="sref">x /a>)n
191 /a>{n
192 /a> 5" 
 
5return   ((0xff & ( a href="+code=x" class="sref">x /a> >> (0 * 8))) << (7 * 8))n
193 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (1 * 8))) << (6 * 8))n
194 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (2 * 8))) << (5 * 8))n
195 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (3 * 8))) << (4 * 8))n
196 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (4 * 8))) << (3 * 8))n
197 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (5 * 8))) << (2 * 8))n
198 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (6 * 8))) << (1 * 8))n
199 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (7 * 8))) << (0 * 8));n
20.11ao}n
20111aon
202 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a>  a href="+code=w4rev" class="sref">w4rev /a>( a href="+code=uint32_o" class="sref">uint32_o /a> const  a href="+code=x" class="sref">x /a>)n
203 /a>{n
204 /a> 5" 
 
5return   ((0xff & ( a href="+code=x" class="sref">x /a> >> (0 * 8))) << (3 * 8))n
205 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (1 * 8))) << (2 * 8))n
206 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (2 * 8))) << (1 * 8))n
207 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (3 * 8))) << (0 * 8));n
20811ao}n
20911aon
210 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a>  a href="+code=w2rev" class="sref">w2rev /a>( a href="+code=uint16_o" class="sref">uint16_o /a> const  a href="+code=x" class="sref">x /a>)n
211 /a>{n
212 /a> 5" 
 
5return   ((0xff & ( a href="+code=x" class="sref">x /a> >> (0 * 8))) << (1 * 8))n
213 /a> 5" 
 
5 5" 
 
| ((0xff & ( a href="+code=x" class="sref">x /a> >> (1 * 8))) << (0 * 8));n
214 /a>}n
21511aon
216 /a>static  a href="+code=uint64_o" class="sref">uint64_o /a>  a href="+code=w8nat" class="sref">w8nat /a>( a href="+code=uint64_o" class="sref">uint64_o /a> const  a href="+code=x" class="sref">x /a>)n
217 /a>{n
218 /a> 5" 
 
5return  a href="+code=x" class="sref">x /a>;n
21911ao}n
22011aon
221 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a>  a href="+code=w4nat" class="sref">w4nat /a>( a href="+code=uint32_o" class="sref">uint32_o /a> const  a href="+code=x" class="sref">x /a>)n
222 /a>{n
223 /a> 5" 
 
5return  a href="+code=x" class="sref">x /a>;n
224 /a>}n
22511aon
226 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a>  a href="+code=w2nat" class="sref">w2nat /a>( a href="+code=uint16_o" class="sref">uint16_o /a> const  a href="+code=x" class="sref">x /a>)n
227 /a>{n
228 /a> 5" 
 
5return  a href="+code=x" class="sref">x /a>;n
22911ao}n
23011aon
231 /a>static  a href="+code=uint64_o" class="sref">uint64_o /a> (* a href="+code=w8" class="sref">w8 /a>)( a href="+code=uint64_o" class="sref">uint64_o /a>);n
232 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a> (* a href="+code=w" class="sref">w /a>)( a href="+code=uint32_o" class="sref">uint32_o /a>);n
233 /a>static  a href="+code=uint32_o" class="sref">uint32_o /a> (* a href="+code=w2" class="sref">w2 /a>)( a href="+code=uint16_o" class="sref">uint16_o /a>);n
23411aon
235 /a> spai class="comment">/* Namls of the secoptis that could contaii calls to mcount. */ /spaion
236 /a>static intn
237 /a> a href="+code=is_mcounted_secopti_naml" class="sref">is_mcounted_secopti_naml /a>(char
const *const  a href="+code=txtnaml" class="sref">txtnaml /a>)n
238 /a>{n
239 /a> 5" 
 
5return  a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".text" /spaio,            a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
240 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".ref.text" /spaio,       a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
241 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".sched.text" /spaio,     a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
242 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".spinlock.text" /spaio,  a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
243 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".irqentry.text" /spaio,  a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
244 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".kprobes.text" /spaio,  a href="+code=txtnaml" class="sref">txtnaml /a>) == 0 ||n
245 /a> 5" 
 
5 5" 
 
5 a href="+code=strcmp" class="sref">strcmp /a>( spai class="string">".text.unlikely" /spaio,  a href="+code=txtnaml" class="sref">txtnaml /a>) == 0;n
246 /a>}n
247 /a>n
248 /a> spai class="comment">/* 32 bit and 64 bit are very similar */ /spaion
24911ao#include " a href="scripts/recordmcount.h" class="fref">recordmcount.h11ao"n
25011ao#define  a href="+code=RECORD_MCOUNT_64" class="sref">RECORD_MCOUNT_64 /a>n
251 /a>#include " a href="scripts/recordmcount.h" class="fref">recordmcount.h11ao"n
25211aon
253 /a> spai class="comment">/* 64-bit EM_MIPS has weird ELF64_Rela.r_info. /spaion
254 /a> spai class="comment"> * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf /spaion
255 /a> spai class="comment"> * We interpret Table 29 Relocaopti Operaopti (Elf64_Rel, Elf64_Rela) [p.40] /spaion
256 /a> spai class="comment"> * to imply the order of the members; the spec dols not say so. /spaion
257 /a> spai class="comment"> *      typldef5unsigned char
Elf64_Byte; /spaion
258 /a> spai class="comment"> * fails ti MIPS64 because their <elf.h> already has it! /spaion
259 /a> spai class="comment"> */ /spaion
26011aon
261 /a>typldef5 a href="+code=uint8_o" class="sref">uint8_o /a>  a href="+code=myElf64_Byte" class="sref">myElf64_Byte /a>; 
5 5" 
 
5 spai class="comment">/* Typl for a 8-bit quantity.  */ /spaion
26211aon
263 /a>unpti  a href="+code=mips_r_info" class="sref">mips_r_info /a> {n
264 /a> 5" 
 
5 a href="+code=Elf64_Xword" class="sref">Elf64_Xword /a>  a href="+code=r_info" class="sref">r_info /a>;n
265 /a> 5" 
 
5struct {n
266 /a> 5" 
 
5 5" 
 
5 a href="+code=Elf64_Word" class="sref">Elf64_Word /a>  a href="+code=r_sym" class="sref">r_sym /a>; 
5 5" 
 
5
 
5 spai class="comment">/* Symbol index.  */ /spaion
267 /a> 5" 
 
5 5" 
 
5 a href="+code=myElf64_Byte" class="sref">myElf64_Byte /a>  a href="+code=r_ssym" class="sref">r_ssym /a>; 
5 5" 
 
5
 spai class="comment">/* Special symbol.  */ /spaion
268 /a> 5" 
 
5 5" 
 
5 a href="+code=myElf64_Byte" class="sref">myElf64_Byte /a>  a href="+code=r_typl3" class="sref">r_typl3 /a>; 
5 5" 
 
5 spai class="comment">/* Third relocaopti.  */ /spaion
269 /a> 5" 
 
5 5" 
 
5 a href="+code=myElf64_Byte" class="sref">myElf64_Byte /a>  a href="+code=r_typl2" class="sref">r_typl2 /a>; 
5 5" 
 
5 spai class="comment">/* Second relocaopti.  */ /spaion
270 /a> 5" 
 
5 5" 
 
5 a href="+code=myElf64_Byte" class="sref">myElf64_Byte /a>  a href="+code=r_typl" class="sref">r_typl /a>; 
5 5" 
 
5
 spai class="comment">/* First relocaopti.  */ /spaion
271 /a> 5" 
 
5}  a href="+code=r_mips" class="sref">r_mips /a>;n
272 /a>};n
273 /a>n
274 /a>static  a href="+code=uint64_o" class="sref">uint64_o /a>  a href="+code=MIPS64_r_sym" class="sref">MIPS64_r_sym /a>( a href="+code=Elf64_Rel" class="sref">Elf64_Rel /a> const * a href="+code=rp" class="sref">rp /a>)n
275 /a>{n
276 /a> 5" 
 
5return  a href="+code=w" class="sref">w /a>(((unpti  a href="+code=mips_r_info" class="sref">mips_r_info /a>){ . a href="+code=r_info" class="sref">r_info /a> =  a href="+code=rp" class="sref">rp /a>-> a href="+code=r_info" class="sref">r_info /a> }). a href="+code=r_mips" class="sref">r_mips /a>. a href="+code=r_sym" class="sref">r_sym /a>);n
277 /a>}n
27811aon
279 /a>static void  a href="+code=MIPS64_r_info" class="sref">MIPS64_r_info /a>( a href="+code=Elf64_Rel" class="sref">Elf64_Rel /a> *const  a href="+code=rp" class="sref">rp /a>,5unsigned  a href="+code=sym" class="sref">sym /a>,5unsigned  a href="+code=typl" class="sref">typl /a>)n
280 /a>{n
281 /a> 5" 
 
5 a href="+code=rp" class="sref">rp /a>-> a href="+code=r_info" class="sref">r_info /a> = ((unpti  a href="+code=mips_r_info" class="sref">mips_r_info /a>){n
282 /a> 5" 
 
5 5" 
 
5. a href="+code=r_mips" class="sref">r_mips /a> = { . a href="+code=r_sym" class="sref">r_sym /a> =  a href="+code=w" class="sref">w /a>( a href="+code=sym" class="sref">sym /a>), . a href="+code=r_typl" class="sref">r_typl /a> =  a href="+code=typl" class="sref">typl /a>5}n
283 /a> 5" 
 
5}). a href="+code=r_info" class="sref">r_info /a>;n
284 /a>}n
28511aon
286 /a>static voidn
287 /a> a href="+code=do_file" class="sref">do_file /a>(char
const *const  a href="+code=fnaml" class="sref">fnaml /a>)n
288 /a>{n
289 /a> 5" 
 
5 a href="+code=Elf32_Ehdr" class="sref">Elf32_Ehdr /a> *const  a href="+code=ehdr" class="sref">ehdr /a> =  a href="+code=mmap_file" class="sref">mmap_file /a>( a href="+code=fnaml" class="sref">fnaml /a>);n
290 /a> 5" 
 
5unsigned int
 a href="+code=reltypl" class="sref">reltypl /a> = 0;n
29111aon
292 /a> 5" 
 
5 a href="+code=ehdr_curr" class="sref">ehdr_curr /a> =  a href="+code=ehdr" class="sref">ehdr /a>;n
293 /a> 5" 
 
5 a href="+code=w" class="sref">w /a> =  a href="+code=w4nat" class="sref">w4nat /a>;n
294 /a> 5" 
 
5 a href="+code=w2" class="sref">w2 /a> =  a href="+code=w2nat" class="sref">w2nat /a>;n
295 /a> 5" 
 
5 a href="+code=w8" class="sref">w8 /a> =  a href="+code=w8nat" class="sref">w8nat /a>;n
296 /a> 5" 
 
5switch ( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>[ a href="+code=EI_DATA" class="sref">EI_DATA /a>]) {n
297 /a> 5" 
 
5 5" 
 
 static unsigned int
const  a href="+code=endian" class="sref">endian /a> = 1;n
298 /a> 5" 
 
5default:n
299 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"unrecognized ELF data encoding %d: %s\n" /spaio,n
300 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>[ a href="+code=EI_DATA" class="sref">EI_DATA /a>],  a href="+code=fnaml" class="sref">fnaml /a>);n
301 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
302 /a> 5" 
 
5 5" 
 
5break;n
303 /a> 5" 
 
5case  a href="+code=ELFDATA2LSB" class="sref">ELFDATA2LSB /a>:n
304 /a> 5" 
 
5 5" 
 
5if (*(unsigned char
const *)& a href="+code=endian" class="sref">endian /a> != 1) {n
305 /a> 5" 
 
5 5" 
 
5 5" 
 
5 spai class="comment">/* main() is big endian, file.o is little endian. */ /spaion
306 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=w" class="sref">w /a> =  a href="+code=w4rev" class="sref">w4rev /a>;n
307 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=w2" class="sref">w2 /a> =  a href="+code=w2rev" class="sref">w2rev /a>;n
308 /a> 5" 
 
5 5" 
 
5
 
5
 
5 a href="+code=w8" class="sref">w8 /a> =  a href="+code=w8rev" class="sref">w8rev /a>;n
309 /a> 5" 
 
5 5" 
 
5}n
310 /a> 5" 
 
5 5" 
 
5break;n
311 /a> 5" 
 
5case  a href="+code=ELFDATA2MSB" class="sref">ELFDATA2MSB /a>:n
312 /a> 5" 
 
5 5" 
 
5if (*(unsigned char
const *)& a href="+code=endian" class="sref">endian /a> != 0) {n
313 /a> 5" 
 
5 5" 
 
5
 
5
 
5 spai class="comment">/* main() is little endian, file.o is big endian. */ /spaion
314 /a> 5" 
 
5 5" 
 
5
 
5
 
5 a href="+code=w" class="sref">w /a> =  a href="+code=w4rev" class="sref">w4rev /a>;n
315 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=w2" class="sref">w2 /a> =  a href="+code=w2rev" class="sref">w2rev /a>;n
316 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=w8" class="sref">w8 /a> =  a href="+code=w8rev" class="sref">w8rev /a>;n
317 /a> 5" 
 
5 5" 
 
5}n
318 /a> 5" 
 
5 5" 
 
5break;n
319 /a> 5" 
 
5}
5 spai class="comment">/* end5switch */ /spaion
320 /a> 5" 
 
5if ( a href="+code=memcmp" class="sref">memcmp /a>( a href="+code=ELFMAG" class="sref">ELFMAG /a>,  a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>,  a href="+code=SELFMAG" class="sref">SELFMAG /a>) != 0n
321 /a> 5" 
 
5||
5 a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_typl" class="sref">e_typl /a>) !=  a href="+code=ET_REL" class="sref">ET_REL11aon
322 /a> 5" 
 
5||
5 a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>[ a href="+code=EI_VERSION" class="sref">EI_VERSION /a>] !=  a href="+code=EV_CURRENT" class="sref">EV_CURRENT /a>) {n
323 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"unrecognized ET_REL file %s\n" /spaio,  a href="+code=fnaml" class="sref">fnaml /a>);n
324 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
325 /a> 5" 
 
5}n
326 /a>n
327 /a> 5" 
 
5 a href="+code=gpfx" class="sref">gpfx /a> = 0;n
328 /a> 5" 
 
5switch ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>)) {n
329 /a> 5" 
 
5default:n
330 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"unrecognized e_machine %d %s\n" /spaio,n
331 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>),  a href="+code=fnaml" class="sref">fnaml /a>);n
332 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
333 /a> 5" 
 
5 5" 
 
5break;n
334 /a> 5" 
 
5case  a href="+code=EM_386" class="sref">EM_386 /a>:n
335 /a> 5" 
 
5 5" 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_386_32" class="sref">R_386_32 /a>;n
336 /a> 5" 
 
5 5" 
 
5 a href="+code=makl_nop" class="sref">makl_nop /a> =  a href="+code=makl_nop_x86" class="sref">makl_nop_x86 /a>;n
337 /a> 5" 
 
5 5" 
 
5 a href="+code=ideal_nop" class="sref">ideal_nop /a> =  a href="+code=ideal_nop5_x86_32" class="sref">ideal_nop5_x86_32 /a>;n
338 /a> 5" 
 
5 5" 
 
5 a href="+code=mcount_adjust_32" class="sref">mcount_adjust_32 /a> = -1;n
339 /a> 5" 
 
5 5" 
 
5break;n
340 /a> 5" 
 
5case  a href="+code=EM_ARM" class="sref">EM_ARM /a>: 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_ARM_ABS32" class="sref">R_ARM_ABS32 /a>;n
341 /a> 5" 
 
5 5" 
 
55 5" 
 
5 a href="+code=altmcount" class="sref">altmcount /a> =  spai class="string">"__gnu_mcount_nc" /spaio;n
342 /a> 5" 
 
5 5" 
 
55 5" 
 
5break;n
343 /a> 5" 
 
5case  a href="+code=EM_IA_64" class="sref">EM_IA_64 /a>: 
  a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_IA64_IMM64" class="sref">R_IA64_IMM64 /a>; 
  a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
344 /a> 5" 
 
5case  a href="+code=EM_MIPS" class="sref">EM_MIPS /a>: 
 
 spai class="comment">/* reltypl: e_class 
 
*/ /spaio  a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
345 /a> 5" 
 
5case  a href="+code=EM_PPC" class="sref">EM_PPC /a>: 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_PPC_ADDR32" class="sref">R_PPC_ADDR32 /a>; 
  a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
346 /a> 5" 
 
5case  a href="+code=EM_PPC64" class="sref">EM_PPC64 /a>: 
  a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_PPC64_ADDR64" class="sref">R_PPC64_ADDR64 /a>;  a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
347 /a> 5" 
 
5case  a href="+code=EM_S390" class="sref">EM_S390 /a>: 
 
 spai class="comment">/* reltypl: e_class 
 
*/ /spaio  a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
348 /a> 5" 
 
5case  a href="+code=EM_SH" class="sref">EM_SH /a>: 
 
5  a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_SH_DIR32" class="sref">R_SH_DIR32 /a>; 
  
 
55 5" 
 
5break;n
349 /a> 5" 
 
5case  a href="+code=EM_SPARCV9" class="sref">EM_SPARCV9 /a>:  a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_SPARC_64" class="sref">R_SPARC_64 /a>; 
  
 a href="+code=gpfx" class="sref">gpfx /a> =  spai class="string">'_' /spaio;5break;n
350 /a> 5" 
 
5case  a href="+code=EM_X86_64" class="sref">EM_X86_64 /a>:n
351 /a> 5" 
 
5 5" 
 
5 a href="+code=makl_nop" class="sref">makl_nop /a> =  a href="+code=makl_nop_x86" class="sref">makl_nop_x86 /a>;n
352 /a> 5" 
 
5 5" 
 
5 a href="+code=ideal_nop" class="sref">ideal_nop /a> =  a href="+code=ideal_nop5_x86_64" class="sref">ideal_nop5_x86_64 /a>;n
353 /a> 5" 
 
5 5" 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_X86_64_64" class="sref">R_X86_64_64 /a>;n
354 /a> 5" 
 
5 5" 
 
5 a href="+code=mcount_adjust_64" class="sref">mcount_adjust_64 /a> = -1;n
355 /a> 5" 
 
5 5" 
 
5break;n
356 /a> 5" 
 
5}
5 spai class="comment">/* end5switch */ /spaion
357 /a>n
358 /a> 5" 
 
5switch ( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>[ a href="+code=EI_CLASS" class="sref">EI_CLASS /a>]) {n
359 /a> 5" 
 
5default:n
360 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai class="string">"unrecognized ELF class %d %s\n" /spaio,n
361 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ident" class="sref">e_ident /a>[ a href="+code=EI_CLASS" class="sref">EI_CLASS /a>],  a href="+code=fnaml" class="sref">fnaml /a>);n
362 /a> 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
363 /a> 5" 
 
5 5" 
 
5break;n
364 /a> 5" 
 
5case  a href="+code=ELFCLASS32" class="sref">ELFCLASS32 /a>:n
365 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_ehsize" class="sref">e_ehsize /a>) != sizeof( a href="+code=Elf32_Ehdr" class="sref">Elf32_Ehdr /a>)n
366 /a> 5" 
 
5 5" 
 
5||
5 a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_shentsize" class="sref">e_shentsize /a>) != sizeof( a href="+code=Elf32_Shdr" class="sref">Elf32_Shdr /a>)) {n
367 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,n
368 /a> 5" 
 
5 5" 
 
5 5" 
 
5 5" 
 
5 spai class="string">"unrecognized ET_REL file: %s\n" /spaio,  a href="+code=fnaml" class="sref">fnaml /a>);n
369 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
370 /a> 5" 
 
5 5" 
 
5}n
371 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>) ==  a href="+code=EM_S390" class="sref">EM_S390 /a>) {n
372 /a> 5" 
 
5 5" 
 
55 5" 
 
 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_390_32" class="sref">R_390_32 /a>;n
373 /a> 5" 
 
5 5" 
 
5
 
5
 
5 a href="+code=mcount_adjust_32" class="sref">mcount_adjust_32 /a> = -4;n
374 /a> 5" 
 
5 5" 
 
5}n
375 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ehdr" class="sref">ehdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>) ==  a href="+code=EM_MIPS" class="sref">EM_MIPS /a>) {n
376 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_MIPS_32" class="sref">R_MIPS_32 /a>;n
377 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=is_fakl_mcount32" class="sref">is_fakl_mcount32 /a> =  a href="+code=MIPS32_is_fakl_mcount" class="sref">MIPS32_is_fakl_mcount /a>;n
378 /a> 5" 
 
5 5" 
 
5}n
379 /a> 5" 
 
5 5" 
 
5 a href="+code=do32" class="sref">do32 /a>( a href="+code=ehdr" class="sref">ehdr /a>,  a href="+code=fnaml" class="sref">fnaml /a>,  a href="+code=reltypl" class="sref">reltypl /a>);n
380 /a> 5" 
 
5 5" 
 
5break;n
381 /a> 5" 
 
5case  a href="+code=ELFCLASS64" class="sref">ELFCLASS64 /a>: {n
382 /a> 5" 
 
5 5" 
 
5 a href="+code=Elf64_Ehdr" class="sref">Elf64_Ehdr /a> *const  a href="+code=ghdr" class="sref">ghdr /a> = ( a href="+code=Elf64_Ehdr" class="sref">Elf64_Ehdr /a> *) a href="+code=ehdr" class="sref">ehdr /a>;n
383 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ghdr" class="sref">ghdr /a>-> a href="+code=e_ehsize" class="sref">e_ehsize /a>) != sizeof( a href="+code=Elf64_Ehdr" class="sref">Elf64_Ehdr /a>)n
384 /a> 5" 
 
5 5" 
 
5||
5 a href="+code=w2" class="sref">w2 /a>( a href="+code=ghdr" class="sref">ghdr /a>-> a href="+code=e_shentsize" class="sref">e_shentsize /a>) != sizeof( a href="+code=Elf64_Shdr" class="sref">Elf64_Shdr /a>)) {n
385 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,n
386 /a> 5" 
 
5 5" 
 
5 5" 
 
5 5" 
 
5 spai class="string">"unrecognized ET_REL file: %s\n" /spaio,  a href="+code=fnaml" class="sref">fnaml /a>);n
387 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=fail_file" class="sref">fail_file /a>();n
388 /a> 5" 
 
5 5" 
 
5}n
389 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ghdr" class="sref">ghdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>) ==  a href="+code=EM_S390" class="sref">EM_S390 /a>) {n
390 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_390_64" class="sref">R_390_64 /a>;n
391 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=mcount_adjust_64" class="sref">mcount_adjust_64 /a> = -8;n
392 /a> 5" 
 
5 5" 
 
5}n
393 /a> 5" 
 
5 5" 
 
5if ( a href="+code=w2" class="sref">w2 /a>( a href="+code=ghdr" class="sref">ghdr /a>-> a href="+code=e_machine" class="sref">e_machine /a>) ==  a href="+code=EM_MIPS" class="sref">EM_MIPS /a>) {n
394 /a> 5" 
 
5 5" 
 
5
 
5
 
5 a href="+code=reltypl" class="sref">reltypl /a> =  a href="+code=R_MIPS_64" class="sref">R_MIPS_64 /a>;n
395 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=Elf64_r_sym" class="sref">Elf64_r_sym /a> =  a href="+code=MIPS64_r_sym" class="sref">MIPS64_r_sym /a>;n
396 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=Elf64_r_info" class="sref">Elf64_r_info /a> =  a href="+code=MIPS64_r_info" class="sref">MIPS64_r_info /a>;n
397 /a> 5" 
 
5 5" 
 
  5" 
 
5 a href="+code=is_fakl_mcount64" class="sref">is_fakl_mcount64 /a> =  a href="+code=MIPS64_is_fakl_mcount" class="sref">MIPS64_is_fakl_mcount /a>;n
398 /a> 5" 
 
5 5" 
 
5}n
399 /a> 5" 
 
5 5" 
 
5 a href="+code=do64" class="sref">do64 /a>( a href="+code=ghdr" class="sref">ghdr /a>,  a href="+code=fnaml" class="sref">fnaml /a>,  a href="+code=reltypl" class="sref">reltypl /a>);n
400 /a> 5" 
 
5 5" 
 
5break;n
401 /a> 5" 
 
5}n
402 /a> 5" 
 
5}
5 spai class="comment">/* end5switch */ /spaion
403 /a>n
404 /a> 5" 
 
5 a href="+code=cleanup" class="sref">cleanup /a>();n
405 /a>}n
406 /a>n
407 /a>intn
408 /a> a href="+code=main" class="sref">main /a>(int
 a href="+code=argc" class="sref">argc /a>, char
* a href="+code=argv" class="sref">argv /a>[])n
409 /a>{n
410 /a> 5" 
 
5const char
 a href="+code=ftracl" class="sref">ftracl /a>[] =  spai class="string">"/a>[] =.oDR32 /a>; 
  a href="+code=gpfx" class="sref">gp4eL311">
3411" class="line" namlueL411">
411 /a> 5" 
 
5int
 a href="+code=a>[] =_size" class="sref">a>[] =_size /a> = sizeof( a href="+code=
 a href="+code=ftracl" class=") -ipts/recordmcount.c#L298" idueL298" c4ss="sref"d4 5" 
ass="4ine" namlueL311">
411 /a> 5" 
 
5n_erro( a href="+code=n_erro(="sref"0;">
402 /a> 5" 
 
5}
5 spai gcc-4.3.0 false positive10"mpla1">
ent">/* end5switch */ /spaion
411 /a> 5" 
 
5
 a href="+code=cPS64_is_fakl_mcount /a>;n
411 /a> 5" 
 
5ide=is_fakl_mcounPS64_is_fakl_mcount /a>;n
28511aon = siz
 a href="+code=cPS64s_fakl_mcount64 /agetopIPS64_is_fakl_mcgetopI" class="sref">do64 int
 a href="+code=argc" clasf">argc /a>, char
* a href="+code=argv" cls="sref">stderr /a>,  spai clwng">"/a>)) ss=""sref">endian /a> != 0) {n
317 8">
358 /a> 5" 
 
5swit
 a href="+code=cPS64ef">endian /a> != 0) {n
318 1">
38"sref">gpfx /a> =  spai cwass="string"ref">ELFCLASS32 /a>:n
369 /a> 5" 
 
5 5" 
 
5 5" warn_on_noize" clec a href="+code=w8arn_on_noize" clec PS64s_fftracl" class=") -ipts/recordmcount.cs/recordm4ount.c#L320" idueL320" c4ass="42ne" namlueL390">
390 /a> 5" 
/a> 5" 
 
5 5" 
 
5break;n
391 9">
359 /a> 5" 
 
5default:n
372 /a> 5" 
 
5 5" 
 
55 5"
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai clasage: :ncleanup /a>();n
323         6">
276="sref">gpfx /a> = 0;n
324 amlueL405">
405 /a>}n
325 /a> 5" 
 
5}n
326 /a>n ass="sref">do64 int
 a href="+code=argc" clde=ss="sref">do64 opIinef="+code=Elf64_opIinePS64efPS64sref">endian /a> != 1) {n
338 /a> 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai clasage: :ncleanup /a>();n
369 6">
276="sref">gpfx /a> = 0;n
325 /a> 5" 
 
5}n
29111aon 5" 
 
5}
5 spai Process ea358nrecoin >
27, allowizeddeep clasureile.o is big endian. */ /spaionfprintf ide=is_fakl_mcounPS64s_fakl_mcount64 /aopIinef="+code=Elf64_opIinePS64>R_PPC64_ADDR64 /ide=is_fakl_mcounPS64sPS64sss="sref">do64 int
 a href="+code=argc" cl>R_PPC64_ADDR64 /ide=is_fakl_mcounPS64++ef">endian /a> != 1) {n
324 s="sref">argc /a>, cha href="+code=fail_fclass="s_fakl_mcount64 /aar
* a href="+code=argv" cla_PPC64_ADDR64 /ide=is_fakl_mcounPS64]"sref">gpfx /a> = 0;n
335  
 static unsigned int
cosjvaref="+code=Elf64sjvarss="s_fakl_mcount64 /asetj a href="+code=mesetj alass="sref">fprintf j aen* a href="+code=j aen*lass="sref">reltypl /a>);n
336 1">
411 /a> 5" 
 
5le> a href="+code=le>PS64_is_fakl_mcount /a>;n
357 /a>n
338 /402 /a> 5" 
 
5}
5 spaio is big endian. */ /spaion 5" 
 
5}
5 spamlueL338">
338  i cle8nrecokernel/ize" ass="stri 6"ferences tle8ef">MIPSis big endian. */ /spaion 5" 
 
5}
5 spamlueL338">
338  i funcnt"> but does noi 1"ll it. Since ss="stri shouldPSis big endian. */ /spaion 5" 
 
5}
5 spamlueL338">
338  i noi be s="std anyway, we ss=" skip it.PSis big endian. */ /spaion 5" 
 
5}
5 spamlueL338">
338  i.o is big endian. */ /spaion
353 /a> 5" 
 
5 5" le> a href="+code=le>PS64s_fakl_mcount64 /astrle> a href="+code=strle>lass="sref">fprintf a href="+code=fail_fclass="="sref">reltypl /a>);n
324 /a> 5" 
 
5 5" 
 
5le> a href="+code=le>PS64sss=""s411 /a> 5" 
 
5int
 a href="+code=a>[] =_size" class="sreignedignedsref">reltypl /a>);n
395 /a> akl_mcount64 /astr( a href="+code=mestr( alass="sref">fprintf a href="+code=fail_fclass=" +> 5" 
 
5 5" 
 
5le> a href="+code=le>PS64se=ss="sref">do64 int
 a href="+code=a>[] =_size" class="srsref">e_machine /a>of( a href="+code=
 a href="+cod="sresref">reltypl /a>);n
396 /a> 5" 
tatIinuedsref">reltypl /a>);n
357 /a>n
338 8">
358 /a> 5" 
 
5switsjvaref="+code=Elf64sjvarss="ef">endian /a> != 1) {n
369 9">
359 /a> 5" 
 
5default:n
390 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=fprintf" class="sref">fprintf /a>( a href="+code=stderr" class="sref">stderr /a>,  spai clf" ernal erro(ognized ET_REL file: %s\n" /spai href="+code=fail_fclass="="sref">reltypl /a>);n
351 /a> 5" 
 
5 5" 
 
5 5" exi href="+code=e_idxi lass=1="sref">reltypl /a>);n
352         /a> 5" 
 
5 5" 
 
5break;n
353 1">
381 /a> 5" 
 
5cSJ_SETJMPhref="+code=e_iSJ_SETJMPe" n="sref">EM_S390 /a>: 
 
 spai normal sequence i.o is big endian. */ /spaion
354 /a> 5" 
 ">EM_S390 /a>: 
 
 spai A86"> problems /a>early anup" c() i.o is big endian. */ /spaion
355 /a> 5" 
 
5 5" 
 
5 5" 
d_maa href="+code=me
d_maaPS64s_fnt_adjust_64 /a> = -1;n
396 /a> 5" 
 
5 5" 
 
5 5" 
 
5 a href="+code=ehdr_curr" class="sref">ehdr_curr /aNULa href="+code=ETNULaPS64_is_fakl_mcount /a>;n
397 /a> 5" 
 
5 5" 
 
  5" file" aclaef="+code=Elf64_file" aclaePS64s_fftracl" class=") -ipts/recordmcount.cs/recordm4ount.c#L358" idueL358" c4ass="45ne" namlueL308">
308 /a> 5" 
 
5 5" 
 
5
 
5 /a> a href="+code=do_file" class=;s\n" /spai href="+code=fail_fclass="="sref">reltypl /a>);n
369 /a> 5" 
/a> 5" 
 
5 5" 
 
5break;n
360 1">
381 /a> 5" 
 
5cSJ_FAIa href="+code=ETSJ_FAIae" n="sref">EM_S390 /a>: 
 
 spai erro(oin file" c o(obelow i.o is big endian. */ /spaion
361 /a> 5" 
++411 /a> 5" 
 
5n_erro( a href="+code=n_erro(="sr" 
 
5 5" 
 
5break;n
362 /a> 5" 
/a> 5" 
 
5 5" 
 
5break;n
363 1">
381 /a> 5" 
 
5cSJ_SUCCEEDhref="+code=e_iSJ_SUCCEEDe" n="sref">EM_S390 /a>: 
 
 spai premature success i.o is big endian. */ /spaion
354 /a> 5" 
 ">EM_S390 /a>: 
 
 spai do noihizedi.o is big endian. */ /spaion
365 /a> 5" 
/a> 5" 
 
5 5" 
 
5break;n
366 2">
402 /a> 5" 
 
5}
5 spai class="comment">/* end5switch */ /spaion
325 /a> 5" 
 
5}n
276!!411 /a> 5" 
 
5n_erro( a href="+code=n_erro(="sr" 
 
5 5" 
 
5break;n
325 /a> 5" 
 
5}n
325 /a> 5" 
 
5}n
29111aon


cle8original LXR software by tle8mlueL291"http://sourceforge.net/projec11alxr">LXR 5}unityclass=ihis experi} 5 al verst"> by8mlueL291"maclto:lxr@" iux.no">lxr@" iux.noclas.
lxr." iux.no kindly hosted by8mlueL291"http://www.redpill-" ipro.no">Redpill L ipro ASclass=provirr" of L iuxstati359izedalasoperant">s services since 1995.