3 #######################################################
4 # Round 1: get all the loacl and external symbols
5 #######################################################
7 for i
in com32
/elflink
/modules
/*.c32 core
/isolinux.elf core
/pxelinux.elf com32
/elflink
/ldlinux
/*.c32
9 # module=$(echo $i | sed "s/^\(.*\).o$/\1/")
11 # remove the path infomation
12 module
=$
(echo $i |
sed "s/^.*\/\(.*\)$/\1/")
14 readelf
-s $i > temp.txt
15 #Get the last 2 items of each line
16 cut
-c47- temp.txt
> $module.txt
19 #Get the unresolved symbols
20 sed -n -e "/UND $/d" -e "/_GLOBAL_OFFSET_TABLE_/d" -e "s/^.UND.\(.*\)$/\1/p" $module.txt
> $module.ext
22 #Get the local symbols
23 sed -n -e "/UND/d" -e "/ABS/d" -e "/...[0-9] $/d" -e "/...[0-9] \./d" -e "/...[0-9]/p" $module.txt
> $module.int
24 sed -i -e "s/^.....//g" $module.int
25 sed -i -e "s/^\(.*\)$/\1 <$module>/g" $module.int
27 cat $module.int
>> all.txt
33 #######################################################
34 # Round 2: get all the loacl and external symbols
35 #######################################################
37 # Consolidate the dependent modules to one line and remove
38 # the redundant ones, and the "core"
47 # skip the module which is alreay on the list
48 grep $line rmcr.tmp
> /dev
/null
&& continue
50 # grep extlinux/isolinux and remove them
51 echo $line |
grep extlinux
> /dev
/null
&& continue
52 echo $line |
grep isolinux
> /dev
/null
&& continue
53 echo $line |
grep pxelinux
> /dev
/null
&& continue
55 all_dep
=$all_dep$space$line
56 echo $all_dep > rmcr.tmp
59 echo $all_dep >> modules.dep
63 # Find the symbol belongs to which module by screening all.txt, do it
64 # one by one, and the result "resolve.tmp" will be a file like:
74 # If no one provides the symbol we're trying to
75 # resolve then add it to the list of unresolved
77 grep -q $symbol all.txt
79 # We only need to add the symbol once
80 if [[ ! "$unresolved_symbols" =~
"$symbol" ]]; then
81 unresolved_symbols
="$unresolved_symbols $symbol"
85 sed -n -e "s/^$symbol <\(.*\)>/\1/p" all.txt
>> resolve.tmp
94 #only test name start with a/b
103 # Don't need to resolve the core symbols
104 for i
in extlinux isolinux pxelinux
114 module
=$
(echo $i |
sed "s/^\(.*\).ext$/\1/")
123 if [ "$unresolved_symbols" ]; then
124 echo "WARNING: These symbols could not be resolved:" $unresolved_symbols
127 echo ELF modules dependency is bult up
, pls check modules.dep
!