From: Michael Tremer Date: Thu, 8 Apr 2010 12:25:39 +0000 (+0200) Subject: naoki: Improve function that finds the elf files in buildroot. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90b1cf55ce6f79bd6a1e6b041dfa6801d0c60964;p=ipfire-3.x.git naoki: Improve function that finds the elf files in buildroot. Skip statically linked files. --- diff --git a/tools/common-functions b/tools/common-functions index e3c8928d0..f85dd5fcf 100644 --- a/tools/common-functions +++ b/tools/common-functions @@ -29,6 +29,12 @@ has_nx() { [ $? != 0 ] } +is_elf() { + local file=${1} + + file ${file} | grep -q "ELF" +} + is_relro_partly() { local file=${1} @@ -51,6 +57,12 @@ is_shared_object() { file ${file} | grep -q "shared object" } +is_static() { + local file=${1} + + file ${file} | grep -q "statically linked" +} + get_interpreter() { local file=${1} @@ -79,6 +91,12 @@ get_soname() { tr -d "[]" | awk '{ print $NF }' } +filter_startfiles() { + local file=${1} + + grep -qE "crt[1in]\.o$" <<<${file} +} + find_requires() { local output local file @@ -111,8 +129,8 @@ find_elf_files() { local files for dir in ${dirs}; do - for file in $(find ${dir} -maxdepth 1 -type f 2>/dev/null); do - if file ${file} | grep -q "ELF"; then + for file in $(find ${dir} -type f 2>/dev/null); do + if is_elf ${file} && ! is_static ${file}; then files="${files} ${file}" fi done