blob: b34af3e1c3732e1d402c5f9c9ee77859de0733a1 (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#!/bin/bash
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# verify that ELF NEEDED entries are known-good so hopefully builds run on
# lots of different GNU/Linux distributions
set -euo pipefail
files=$(find "${INSTDIR}" -type f)
# all RPATHs should point to ${INSTDIR}/program so that's the files they find
programfiles=$(basename -a $(echo ${files} | grep -o '/program/[^/]* '))
# whitelists should contain only system libraries that have a good reputation
# of maintaining ABI stability
globalwhitelist="ld-linux-x86-64.so.2 libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0 librt.so.1 libutil.so.1 libnsl.so.1 libcrypt.so.1 libgcc_s.so.1 libstdc++.so.6 libz.so.1 libfontconfig.so.1 libfreetype.so.6 libxml.so.2 libxslt.so.1 libexslt.so.0"
x11whitelist="libX11.so.6 libXext.so.6 libSM.so.6 libICE.so.6 libXinerama.so.1 libXrender.so.1 libXrandr.so.2 libcairo.so.2"
openglwhitelist="libGL.so.1"
giowhitelist="libgio-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3"
gstreamerwhitelist="libgstpbutils-1.0.so.0 libgstvideo-1.0.so.0 libgstbase-1.0.so.0 libgstreamer-1.0.so.0"
gtk2whitelist="libgtk-x11-2.0.so.0 libgdk-x11-2.0.so.0 libpangocairo-1.0.so.0 libatk-1.0.so.0 libcairo.so.2 libgio-2.0.so.0 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3"
gtk3whitelist="libgtk-3.so.0 libgdk-3.so.0 libcairo-gobject.so.2 libpangocairo-1.0.so.0 libatk-1.0.so.0 libcairo.so.2 libgio-2.0.so.0 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3"
kde4whitelist="libkio.so.5 libkfile.so.4 libkdeui.so.5 libkdecore.so.5 libQtNetwork.so.4 libQtGui.so.4 libQtCore.so.4 libglib-2.0.so.0"
avahiwhitelist="libdbus-glib-1.so.2 libdbus-1.so.3 libgobject-2.0.so.0 libglib-2.0.so.0 libavahi-common.so.3 libavahi-client.so.3"
kerberoswhitelist="libgssapi_krb5.so.2 libcom_err.so.2 libkrb5.so.3"
status=0
for file in ${files}
do
skip=0
whitelist="${globalwhitelist}"
case "${file}" in
*/sdk/docs/*)
# skip the majority of files, no ELF binaries here
skip=1
;;
*/libsalcpprt.a)
# strangely readelf -d "succeeds" on a static library so
# have to filter it manually
skip=1
;;
*/libcairocanvaslo.so)
whitelist="${whitelist} libcairo.so.2"
;;
*/libucpgio1lo.so|*/liblosessioninstalllo.so|*/libevoablo.so)
whitelist="${whitelist} ${giowhitelist}"
;;
*/libavmediagst.so)
whitelist="${whitelist} ${gtk3whitelist} ${gstreamerwhitelist}"
;;
*/libvclplug_kde4lo.so|*/libkde4be1lo.so)
whitelist="${whitelist} ${x11whitelist} ${kde4whitelist}"
;;
*/libvclplug_gtklo.so|*/libqstart_gtklo.so|*/updater)
whitelist="${whitelist} ${x11whitelist} ${gtk2whitelist}"
;;
*/libvclplug_gtk3lo.so)
whitelist="${whitelist} ${x11whitelist} ${gtk3whitelist}"
;;
*/libdesktop_detectorlo.so|*/ui-previewer|*/oosplash|*/gengal.bin)
whitelist="${whitelist} ${x11whitelist}"
;;
*/libvclplug_genlo.so|*/libGLEW.so.*|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
whitelist="${whitelist} ${x11whitelist} ${openglwhitelist}"
;;
*/libvcllo.so|*/libsofficeapp.so)
whitelist="${whitelist} ${x11whitelist} ${openglwhitelist} ${giowhitelist} libcups.so.2"
;;
*/liblibreofficekitgtk.so)
whitelist="${whitelist} ${gtk3whitelist}"
;;
*/libsdlo.so)
whitelist="${whitelist} ${avahiwhitelist}"
;;
*/libofficebean.so)
whitelist="${whitelist} libjawt.so"
;;
*/libpostgresql-sdbc-impllo.so)
whitelist="${whitelist} ${kerberoswhitelist}"
;;
esac
if test "${skip}" = 0 && readelf -d "${file}" &> /dev/null ; then
rpath=$(readelf -d "${file}" | grep '(RPATH)' || true)
neededs=$(readelf -d "${file}" | grep '(NEEDED)' | sed -e 's/.*\[\(.*\)\]$/\1/')
neededsinternal=
for needed in ${neededs}
do
if ! echo ${whitelist} | grep -q -w "${needed}" ; then
neededsinternal="${neededsinternal} ${needed}"
if ! echo ${programfiles} | grep -q -w "${needed}" ; then
echo "${file}" has suspicious NEEDED: "${needed}"
status=1
fi
fi
done
if test -z "${rpath}" ; then
case "${file}" in
*/python-core-*/lib/lib-dynload/*)
# python modules don't have RPATH
;;
*/share/extensions/*)
# extension libraries don't have RPATH
;;
*)
# no NEEDED from instdir, no RPATH needed
if test -n "${neededsinternal}" ; then
echo "${file}" has no RPATH
status=1
fi
;;
esac
else
case "$file" in
*/sdk/bin/*)
if echo "${rpath}" | grep -q -v '\[\$ORIGIN/../../program\]$' ; then
echo "${file}" has unexpected RPATH "${rpath}"
status=1
fi
;;
*)
if echo "${rpath}" | grep -q -v '\[\$ORIGIN\]$' ; then
echo "${file}" has unexpected RPATH "${rpath}"
status=1
fi
;;
esac
fi
fi
done
exit ${status}
|