Use a temporary directory in wrap-find-debuginfo.sh
This avoids the need for separate variables for all files.
This commit is contained in:
parent
885b520a6d
commit
6c17684392
@ -15,9 +15,10 @@
|
||||
|
||||
set -ex
|
||||
|
||||
ldso_tmp="$(mktemp)"
|
||||
libc_tmp="$(mktemp)"
|
||||
libc_dlink_tmp="$(mktemp)"
|
||||
workdir="$(mktemp -d -t find_debuginfo.XXXXXX)"
|
||||
|
||||
ldso_tmp="$workdir/ld.so"
|
||||
libc_tmp="$workdir/libc.so"
|
||||
|
||||
# Prefer a separately installed debugedit over the RPM-integrated one.
|
||||
if command -v debugedit >/dev/null ; then
|
||||
@ -27,7 +28,7 @@ else
|
||||
fi
|
||||
|
||||
cleanup () {
|
||||
rm -f "$ldso_tmp" "$libc_tmp" "$libc_dlink_tmp"
|
||||
rm -rf "$workdir"
|
||||
}
|
||||
trap cleanup 0
|
||||
|
||||
@ -69,7 +70,7 @@ cp "$libc_path" "$libc_tmp"
|
||||
|
||||
# libc.so.6: Extract the .gnu_debuglink section
|
||||
objcopy -j.gnu_debuglink --set-section-flags .gnu_debuglink=alloc \
|
||||
-O binary "$libc_path" "$libc_dlink_tmp"
|
||||
-O binary "$libc_path" "$libc_tmp.debuglink"
|
||||
|
||||
# Restore the original files.
|
||||
cp "$ldso_tmp" "$ldso_path"
|
||||
@ -80,7 +81,7 @@ objcopy --merge-notes "$ldso_path"
|
||||
objcopy --merge-notes "$libc_path"
|
||||
|
||||
# libc.so.6: Restore the .gnu_debuglink section
|
||||
objcopy --add-section .gnu_debuglink="$libc_dlink_tmp" "$libc_path"
|
||||
objcopy --add-section .gnu_debuglink="$libc_tmp.debuglink" "$libc_path"
|
||||
|
||||
# ld.so does not have separated debuginfo and so the debuginfo file
|
||||
# generated by find-debuginfo is redundant. Therefore, remove it.
|
||||
|
Loading…
Reference in New Issue
Block a user