HP-UX Linker and Libraries User's Guide

Turn Off Linker Warnings with -w
In some build processes you might want to improve parsing of build output by ignoring linker
warnings. You can turn off linker warnings with the -w option.
Preserving Compiler Generated Relocation Sections with -emit_relocs
The -emit_relocs option enables the linker to preserve compiler-generated relocation sections
in the output binary. The input relocation information is stored in the executable, or the shared
library. This information provides the necessary support for third-party programming tools to perform
post-link instrumentation.
The following example illustrates that the compiler generated relocation sections (such as
.rela.text, and .rela.IA64_64.unwind) are copied to the output binary with
-emit_relocs:
$ cc -c main.c
$ ld -emit_relocs main.o -lc
$ elfdump -h -S a.out | grep rela
7 RELA 04000740 00000740 0000000c .rela.plt
30 RELA 00000000 00010304 00000024 .rela.IA_64.unwind
31 RELA 00000000 00010328 0000000c .rela.IA_64.unwind_info
32 RELA 00000000 00010334 00000024 .rela.text
34 RELA 00000000 00010398 0000000c .rela.debug_line
36 RELA 00000000 000103d8 0000000c .rela.debug_actual
39 RELA 00000000 00010470 0000003c .rela.debug_procs_info
The following example illustrates that only the linker genereated relocation sections are copied to
the output binary if -emit_relocs is not used:
$ ld main.o -lc
$ elfdump -h -S a.out | grep rela
7 RELA 040006ec 000006ec 0000000c .rela.plt
The compiler generated relocation sections are not copied to the output binary if -emit_relocs
is not used.
52 Determining How to Link Programs or Libraries (Linker Tasks)