linux/scripts/mod/mk_elfconfig.c
<<
on> 2" /spa3.1 2" /form.1 2" a on> 2" href="../linux+v3opt1/scripts/mod/mk_elfconfig.c">on> 2" img src="../.static/gfx/right.png" alt=">>">on /spa3.1on spa3 class="lxr_search">on> on> 2" input typ4.1hidden" nam4.1navtarget" v3.14.1">on> 2" input typ4.1text" nam4.1search" id.1search">on> 2" butt typ4.1submit">Search 2" onclick="return ajax_prefs();">on> 2"Prefs1 2" /a>on /spa3.1> 2" " /div.1> 2" " form ac="v3="ajax+*" method="post" onsubmit="return false;">on input typ4.1hidden" nam4.1ajax_lookup" id.1ajax_lookup" v3.14.1">o> 2" " /form.1o> 2" " div class="headingbott m"> 2" 2" 2" " div id.1search_results" class="search_results"1 2.1> 2" " /div.1 div id.1content">1 div id.1file_contents".
" "1
/a>#include <stdio.h
/a>>
" "2
/a>#include <stdlib.h
/a>>
" "3
/a>#include <string.h
/a>>
" "4
/a>#include <elf.h
/a>>
" "5
/a>o" "6
/a>into" "7
/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>)o" "8
/a>{o" "9
/a>        unsigned char 
a href="+code=ei" class="sref">ei
/a>[
a href="+code=EI_NIDENT" class="sref">EI_NIDENT
/a>];
" on va>        un>
  { short 
a href="+code=s" class="sref">s va>; char 
a href="+code=c" class="sref">c
/a>[2]; } 
a href="+code=endian_test" class="sref">endian_test va>;
" 11
/a>o" 12 va>        if (
a href="+code=fread" class="sref">fread
/a>(
a href="+code=ei" class="sref">ei
/a>, 1, 
a href="+code=EI_NIDENT" class="sref">EI_NIDENT
/a>, 
a href="+code=stdin" class="sref">stdin
/a>) != 
a href="+code=EI_NIDENT" class="sref">EI_NIDENT
/a>) {o" 13 va>                
a href="+code=fprintf" class="sref">fprintf
/a>(
a href="+code=stderr" class="sref">stderr
/a>, 
spa3 class="string">"Error: input truncated\n"
/spa3.);
" 14 va>                return 1;
" 15 va>        }
" 16 va>        if (
a href="+code=memcmp" class="sref">memcmp
/a>(
a href="+code=ei" class="sref">ei
/a>, 
a href="+code=ELFMAG" class="sref">ELFMAG
/a>, 
a href="+code=SELFMAG" class="sref">SELFMAG
/a>) != 0) {o" 17 va>                
a href="+code=fprintf" class="sref">fprintf
/a>(
a href="+code=stderr" class="sref">stderr
/a>, 
spa3 class="string">"Error: not ELF\n"
/spa3.);
" 18 va>                return 1;
" 19 va>        }
" 2n va>        switch (
a href="+code=ei" class="sref">ei
/a>[
a href="+code=EI_CLASS" class="sref">EI_CLASS
/a>]) {o" 21 va>        case 
a href="+code=ELFCLASS32" class="sref">ELFCLASS32 va>:o" 22 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define KERNEL_ELFCLASS ELFCLASS32\n"
/spa3.);
" 23 va>                break;
" 24 va>        case 
a href="+code=ELFCLASS64" class="sref">ELFCLASS64 va>:o" 25 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define KERNEL_ELFCLASS ELFCLASS64\n"
/spa3.);
" 26 va>                break;
" 27 va>        default:o" 28 va>                
a href="+code=exit" class="sref">exit
/a>(1);
" 29 va>        }
" 3n va>        switch (
a href="+code=ei" class="sref">ei
/a>[
a href="+code=EI_DATA" class="sref">EI_DATA
/a>]) {o" 31 va>        case 
a href="+code=ELFDATA2LSB" class="sref">ELFDATA2LSB va>:o" 32 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define KERNEL_ELFDATA ELFDATA2LSB\n"
/spa3.);
" 33 va>                break;
" 34 va>        case 
a href="+code=ELFDATA2MSB" class="sref">ELFDATA2MSB va>:o" 35 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define KERNEL_ELFDATA ELFDATA2MSB\n"
/spa3.);
" 36 va>                break;
" 37 va>        default:o" 38 va>                
a href="+code=exit" class="sref">exit
/a>(1);
" 39 va>        }
" 40
/a>o" 41 va>        if (sizeof(unsigned long) == 4) {o" 42 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define HOST_ELFCLASS ELFCLASS32\n"
/spa3.);
" 43 va>        } else if (sizeof(unsigned long) == 8) {o" 44 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define HOST_ELFCLASS ELFCLASS64\n"
/spa3.);
" 45 va>        }
" 46
/a>o" 47 va>        
a href="+code=endian_test" class="sref">endian_test va>.
a href="+code=s" class="sref">s va> = 0x0102;
" 48 va>        if (
a href="+code=memcmp" class="sref">memcmp
/a>(
a href="+code=endian_test" class="sref">endian_test va>.
a href="+code=c" class="sref">c
/a>, 
spa3 class="string">"\x01\x02"
/spa3., 2) == 0)o" 49 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define HOST_ELFDATA ELFDATA2MSB\n"
/spa3.);
" 5n va>        else if (
a href="+code=memcmp" class="sref">memcmp
/a>(
a href="+code=endian_test" class="sref">endian_test va>.
a href="+code=c" class="sref">c
/a>, 
spa3 class="string">"\x02\x01"
/spa3., 2) == 0)o" 51 va>                
a href="+code=printf" class="sref">printf
/a>(
spa3 class="string">"#define HOST_ELFDATA ELFDATA2LSB\n"
/spa3.);
" 52 va>        else
" 53 va>                
a href="+code=exit" class="sref">exit
/a>(1);
" 54
/a>o" 55 va>        return 0;
" 56
/a>}
" 57
/a>o" 58 va>
The original LXR software by the a href="http://sourceforge.net/projects/lxr">LXR community /a>, this experimental vers> by a href="mailto:lxr@linux.no">lxr@linux.no va>. /div.1 div class="subfooter"> lxr.linux.no kindly hosted by a href="http://www.redpill-linpro.no">Redpill Linpro AS /a>, provider of Linux consulting and opera="v3s services since 1995. /div.1 /body.1 /html.1