COLLIDE(1) COLLIDE(1)
collide - look for name collisions between libraries
collide [-l] [-d] [-w] file ...
When porting a large application a critical question is ``How do I know
if names in this application conflict with names in libraries I must
use?'' Collide answers that question by finding name collisions across
archive libraries and object files. It treats a Dynamic Shared Object
(dso) as if it were an archive library.
Given a list of files, collide finds all duplicate external names and
writes those names to standard output. There is no output if there are
no conflicts.
The -l (longform) option adds the object file names to the output; these
are occasionally interesting. This must be the first option to collide
if it is specified at all.
The -d (show duplicates) option reports duplicate external names on
standard error. This reports the same problems ar would if run on the
same object files but in more detail. -d applies to object files, not
archive libraries.
The -w (weak symbol) option treats weak symbols the same as normal
external symbols. By default weak symbols are ignored in the search for
duplicates.
The files named may be either archive libraries or object files. A list
of object files is gathered together (by /usr/lib/collide1) just as is
done by ar(1). Gathering of a list of objects stops when an archive name
is seen. Object gathering is important because a common declaration may
appear in multiple files yet it does not reflect a name duplication.
Collide is a shell script that uses /usr/lib/collide1 to extract the
public symbols from each archive (or gathered collection of objects) and
notes the object file name and archive name along with the symbol. You
may find it useful to find which library or object contains a name, (the
name may be a weak symbol). For example, the following do roughly the
same thing:
/usr/lib/collide1 -w /usr/lib/libc.a | grep strcpy
nm -Bo /usr/lib/libc.a | grep strcpy
If there are too many objects to list them all on the command line, use
the ar(1) command to build an archive.
Page 1
COLLIDE(1) COLLIDE(1)
Examples:
cd /usr/lib
collide libgl_s.a libc.a libcps.a /tmp/mylib.a
cd /usr/tmp
# a.o b.o treated as if in archive "none".
# c.o d.o treated as if in a separate archive "none".
collide -d a.o b.o /usr/lib/libc.a c.o d.o
ar cr mylib.a *.o
collide mylib.a /usr/lib/libc.a
# Not useful. All the externals are collisions.
collide libc_s.a libc.a
/usr/sbin/collide
/usr/lib/collide1
The format of a line written by collide1 is:
variable-name objectfile-name archive-name
Each name is separated by a tab; the line ends with a newline. There are
no blanks or extraneous characters in the output.
If you supply object names to collide it is a good idea to use the -d
option.
While the C language does not have FORTRAN common declarations per se,
the declaration int c; will, if it appears outside of any function
declaration be marked in the symbol table as common (with Traditional C
only - not with ANSI C).
common declarations which appear in different archives can cause false
reports of duplications. This should not happen if you put all your
objects in a single archive or list all your objects together on the
command line.
collide recognizes an object as a dso by looking for names ending in .so
or .so.<N> (where <N> is a number, as in .so.1) so dso's not named that
way are treated as simple object files.
PPPPaaaaggggeeee 2222 [ Back ]
|