File: test_exports.sh

package info (click to toggle)
highwayhash 0~git20200803.9490b14-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 924 kB
  • sloc: cpp: 7,804; ansic: 326; java: 271; makefile: 145; sh: 16
file content (22 lines) | stat: -rwxr-xr-x 567 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Verifies that a set of object files (or archives of object files) doesn't
# define any symbol twice. Used to check for ODR violation between files
# compiled with different compiler options.
#
# Usage: test_exports [object_files...]

if [ $# -eq 0 ]; then
    echo "${0##*/}: list of object files expected"
fi

for f in "$@"; do
    nm -g -P "$f" | awk '$2 ~ /[uvwA-Z]/ && $3 != "" { print $1 }' || exit 1
done | sort | uniq -d | grep '^'

if [ $? -eq 0 ]; then
    echo The above-mentioned symbols are duplicates
    echo FAIL
    exit 1
fi

echo PASS