#!/bin/sh
# 
# Check for symbols defined as COMMON and appearing in the global symbol
# table.  This indicates that the COMMON definition is not visible when
# the function is defined, which causes errors on some linkers (Linux on
# IA_64 is one of them).
# 
# Note: this script only works on Linux/i386.  No worries, its only for
# me to find all such problems.

grep -w COMMON */*.h | \
	sed 's/.*COMMON([^)]*)[ 	]\([a-zA-Z_0-9]*\).*/\1/' | \
	sort -u > Common.def

nm ../linux/pl2xpce.so | \
	grep -w T | \
	sed 's/.* T //' | \
	sort -u > Common.glb

comm -12 Common.def Common.glb

rm -f Common.def Common.glb
