elflink: Warn about unresolved symbols when creating modules.dep
authorMatt Fleming <matt.fleming@linux.intel.com>
Thu, 17 Feb 2011 22:03:26 +0000 (22:03 +0000)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 17 Feb 2011 23:59:48 +0000 (15:59 -0800)
If, after running elf_gen_dep.sh, there are still some symbols that
are not provided by any of the modules that we built, issue a warning
and list the unresolved symbols.

Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
elf_gen_dep.sh

index 306034a..404ebbe 100755 (executable)
@@ -71,9 +71,20 @@ resolve_sym ()
 
        while read symbol 
        do
-               #echo $symbol
-               sed -n -e "s/^$symbol <\(.*\)>/\1/p" all.txt >> resolve.tmp 
-               #grep $symbol all.txt
+               # If no one provides the symbol we're trying to
+               # resolve then add it to the list of unresolved
+               # symbols.
+               grep -q $symbol all.txt
+               if [ $? -ne 0 ]; then
+                       # We only need to add the symbol once
+                       if [[ ! "$unresolved_symbols" =~ "$symbol" ]]; then
+                               unresolved_symbols="$unresolved_symbols $symbol"
+                       fi
+               else
+                       #echo $symbol
+                       sed -n -e "s/^$symbol <\(.*\)>/\1/p" all.txt >> resolve.tmp
+                       #grep $symbol all.txt
+               fi
        done
 
        rm_cr < resolve.tmp
@@ -108,4 +119,9 @@ done
 rm *.txt
 rm *.ext
 rm *.int
+
+if [ "$unresolved_symbols" ]; then
+       echo "WARNING: These symbols could not be resolved:" $unresolved_symbols
+fi
+
 echo ELF modules dependency is bult up, pls check modules.dep!