わいえむねっと

Contents
Categories
Calendar
2008/05
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Monthly Archives
~2000/01
Recent Entries
RSS1.0
Templates
Information
Processed: 0.017 sec
Chashed: -
2008/05/16 Fri
rpmbuild の strip処理についてちょと調べる。

/usr/lib/rpm/brp-strip (RH7.2)

# Strip ELF binaries
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
    grep -v ' shared object,' | \
    sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
    strip $f || :
done

/usr/lib/rpm/brp-strip (RHEL4)

# Strip ELF binaries
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
    grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
    grep -v ' shared object,' | \
    sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
    strip -g $f || :
done

/usr/lib/rpm/brp-strip-comment-note (RH7.2, RHEL4)

# Strip .comment and .note sections (the latter only if it is not allocated)
# for already stripped elf files in the build root
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
    grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
    sed -n -e 's/^\(.*\):[ 	]*ELF.*, stripped/\1/p'`; do
    note="-R .note"
    if objdump -h $f | grep '^[ 	]*[0-9]*[ 	]*.note[ 	]' -A 1 | \
        grep ALLOC >/dev/null; then
        note=
    fi
    strip -R .comment $note $f || :
done

strip -g と strip -R .comment -R .note と。
判定は意外にベタですね。