diff options
-rwxr-xr-x | meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env index c838256f74..7636d090a4 100755 --- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env +++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env | |||
@@ -6,6 +6,12 @@ | |||
6 | 6 | ||
7 | target_files= | 7 | target_files= |
8 | 8 | ||
9 | is_dynamic_elf () | ||
10 | { | ||
11 | # Is the file an dynamically linked ELF executable? | ||
12 | (file -L "$1" | grep 'ELF' > /dev/null 2>&1) && (! file -L "$1" | grep 'static' > /dev/null 2>&1) | ||
13 | } | ||
14 | |||
9 | is_contained () | 15 | is_contained () |
10 | { | 16 | { |
11 | case " $target_files " in | 17 | case " $target_files " in |
@@ -34,8 +40,16 @@ add_file () | |||
34 | target_files="$target_files $toadd" | 40 | target_files="$target_files $toadd" |
35 | if test -x "$path"; then | 41 | if test -x "$path"; then |
36 | # Only call ldd when it makes sense | 42 | # Only call ldd when it makes sense |
37 | if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then | 43 | if is_dynamic_elf "$path"; then |
38 | if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then | 44 | # Request the program interpeter (dynamic loader) |
45 | interp=`readelf -w -l "$path" | grep "Requesting program interpreter:" | sed "s/\s*\[Requesting program interpreter:\s*\(.*\)\]/\1/g"` | ||
46 | |||
47 | if test -n "$interp" && test -x "$interp"; then | ||
48 | # Use the dynamic loaders --list argument to list the | ||
49 | # depenencies. The program may have a a different program | ||
50 | # interpeter (typical when using uninative tarballs), which is | ||
51 | # why we can't just call ldd. | ||
52 | # | ||
39 | # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc | 53 | # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc |
40 | # this regexp parse the outputs like: | 54 | # this regexp parse the outputs like: |
41 | # ldd /usr/bin/gcc | 55 | # ldd /usr/bin/gcc |
@@ -43,7 +57,7 @@ add_file () | |||
43 | # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000) | 57 | # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000) |
44 | # /lib/ld-linux.so.2 (0xb7fe8000) | 58 | # /lib/ld-linux.so.2 (0xb7fe8000) |
45 | # covering both situations ( with => and without ) | 59 | # covering both situations ( with => and without ) |
46 | for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do | 60 | for lib in `$interp --list "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do |
47 | test -f "$lib" || continue | 61 | test -f "$lib" || continue |
48 | # Check wether the same library also exists in the parent directory, | 62 | # Check wether the same library also exists in the parent directory, |
49 | # and prefer that on the assumption that it is a more generic one. | 63 | # and prefer that on the assumption that it is a more generic one. |