Kenwood HP 9000 Personal Computer User Manual


 
296 Appendix A
Using Mapfiles
Controlling Mapfiles with the -k Option
Controlling Mapfiles with the -k Option
The -k option to ld specifies a text file containing mapfile directives:
ld -k mapfile [flags] files ...
The ld command automatically maps sections from input object files
onto output segments in executable files. The mapfile option allows you
to change the default mapping provided by the linker.
Use the -k filename option to specify a text file that contains mapfile
directives. The linker appends the specified mapfile to the default
mapfile unless you specify the +nodefaultmap option.
Mapfile Example: Using -k filename (without
+nodefaultmap Option):
cat mapfile
text = LOAD ?RX V0x1000;
text : .rodata;
text : .PARISC.milli;
text : .dynamic;
text : .dynsym;
text : .dynstr;
text : .hash;
text : $PROGBITS ?AX;
text : .PARISC.unwind;
text : $UNWIND;
data = LOAD ?RW V0x4000000040001000;
data : .opd;
data : .plt;
data : .dlt;
data : .data;
data : $PROGBITS ?AW!S;
data : .sdata;
data : $PROGBITS ?AWS;
data : .sbss;
data : $NOBITS ?AWS;
data : .bss;
data : $NOBITS ?AW!S;
note = NOTE;
note : $NOTE;
ld main.o -k mapfile -lc
elfdump -h -S a.out
a.out:
*** Section Header ***
Index TypeVaddr Offset Size Name