]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Improve function that finds the elf files in buildroot.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Apr 2010 12:25:39 +0000 (14:25 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Apr 2010 12:25:39 +0000 (14:25 +0200)
Skip statically linked files.

tools/common-functions

index e3c8928d0deae9d8ec11218961a8f48a33c61759..f85dd5fcf3a40bc419c649d57f7de3eda354bbbd 100644 (file)
@@ -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