Passing command-line options to the "ld" or "as" command
Because the compiler automatically executes other commands, such as ld and as, as needed during compilation, you usually do not need to concern yourself with the options of those commands. If you want to choose options for these individual commands, you can do one of the following:
- Include linker options on the compiler command line. When the
compiler does not recognize a command-line option other than a -q option,
it passes the option on to the linker:
xlf95 -berok file.f # -berok is passed to ld
- Use the -W compiler option to construct
an argument list for the command:
In this example, the ld option -berok is passed to the linker (which is denoted by the l in the -Wl option) when the linker is executed.xlf95 -Wl,-berok file.f # -berok is passed to ld
This form is more general than the previous one because it works for the as command and any other commands called during compilation, by using different letters after the -W option.
- Edit the configuration file /opt/IBM/xlf/15.1.3/etc/xlf.cfg.nn, or construct your own configuration file.
You can customize particular stanzas to allow specific command-line
options to be passed through to the assembler or linker. For example, if you include these lines in the xlf95 stanza of /opt/IBM/xlf/15.1.3/etc/xlf.cfg.71:
and issue this command:asopt = "w" ldopt = "m"
the file produces_warnings.s is assembled with the options -w and -x (issue warnings and produce cross-reference), and the object files are linked with the options -m and -s (write list of object files and strip final executable file).xlf95 -wm -Wa,-x -Wl,-s produces_warnings.s uses_many_symbols.f