Option Type | Default Value | #pragma options | C | C++ |
-flag | nounique | - | x |
Syntax
-qunique | -qnounique
Purpose
Generates unique names for static
constructor/deconstructor file compilation units.
Notes
Unique names are generated with -qunique by
encoding random numbers into thename of the static initialization
(sinit) and static termination (sterm) functions. Default
behavior is encoding the absolute path name of the source file in
the sinit and sterm functions. If the absolute path name will be
identical for multiple compilations (for example, if a make
script is used), the -qunique option is
necessary.
Using -qnounique allows you to do incremental linking of files.
If you use -qunique, you must always link with all .o and .a files. Do not include an executable file on the link step. An object (.o) file compiled with -qunique should not be used for incremental linking.
Example
Suppose you want to compile several files using the same
path name, ensuring that static construction works correctly. A make
file may generate the following steps:
sqlpreprocess file1.sql > t.C xlC -qunique t.C -o file1.o rm -f t.C sqlpreprocess file2.sql > t.C xlC -qunique t.C -o file2.o rm -f t.C xlC file1.o file2.o
Following is a sample make file for the above example:
# rule to get from file.sql to file.o .SUFFIXES: .sql .sql.o: sqlpreprocess $< > t.C $(CCC) t.C -c $(CCFLAGS) -o $@ rm -f t.C