@@ -35,20 +35,26 @@ IFS=$'\n\t'
35
35
36
36
PG_BIN=$( pg_config --bindir) /postgres
37
37
38
- nm -D $PG_BIN | grep " T " | awk ' {print $3}' | sed -n -e ' s/@.*$//p'
38
+ # " T " - text symbol
39
+ nm -D $PG_BIN | grep " T " | awk ' {print $3}' | sed -e ' s/@.*$//p'
39
40
# global bss symbol in postgres
40
- nm -D $PG_BIN | grep " B " | awk ' {print $3}' | sed -n - e ' s/@.*$//p'
41
+ nm -D $PG_BIN | grep " B " | awk ' {print $3}' | sed -e ' s/@.*$//p'
41
42
# postgres weak symbols
42
- nm -D $PG_BIN | grep " w " | awk ' {print $2}' | sed -n - e ' s/@.*$//p'
43
+ nm -D $PG_BIN | grep " w " | awk ' {print $2}' | sed -e ' s/@.*$//p'
43
44
44
45
# Get a list of shared library dependencies using ldd
45
46
dependencies=$( ldd " $PG_BIN " | awk ' {print $3}' | grep -v " not a dynamic executable" )
46
47
47
48
# Loop through the dependencies and extract symbols
48
49
for dependency in $dependencies ; do
49
- nm -D " $dependency " | awk ' / U / {print $3}' | sed -n -e ' s/@.*$//p'
50
- nm -D " $dependency " | awk ' / i / {print $3}' | sed -n -e ' s/@.*$//p'
51
- nm -D " $dependency " | awk ' / T / {print $3}' | sed -n -e ' s/@.*$//p'
52
- nm -D " $dependency " | awk ' / V / {print $3}' | sed -n -e ' s/@.*$//p'
53
- nm -D " $dependency " | awk ' / W / {print $3}' | sed -n -e ' s/@.*$//p'
50
+ # " U " - undefined symbol
51
+ nm -D " $dependency " | awk ' / U / {print $3}' | sed -e ' s/@.*$//p'
52
+ # " i " - the symbol is an indirect reference to another symbol. This is often used for compiler-generated code
53
+ nm -D " $dependency " | awk ' / i / {print $3}' | sed -e ' s/@.*$//p'
54
+ # " T " - The symbol is a text (code) symbol, representing a function or code that can be executed
55
+ nm -D " $dependency " | awk ' / T / {print $3}' | sed -e ' s/@.*$//p'
56
+ # " V " - the symbol is a weak object
57
+ nm -D " $dependency " | awk ' / V / {print $3}' | sed -e ' s/@.*$//p'
58
+ # " W " - the symbol is a weak symbol that has not been specifically tagged as weak object symbol
59
+ nm -D " $dependency " | awk ' / W / {print $3}' | sed -e ' s/@.*$//p'
54
60
done
0 commit comments