Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

05.08.2013 Views

92 Chapter 4 Informational Tools .strtab: Name a.out crti.s crt1.s __get_exit_frame_monitor_ptr ... .stab.indexstr: Name /tmp/;/opt/SUNWspro/prod/bin/f90 -g -qoption f90comp - h.XAzwWCA01y4\$DCK. test.f90 ... The mcs tool, which is shipped with Solaris, manipulates the comments section in elf files. The -p option will print the comments. It is possible to delete the comments section using -d, or append more strings using -a. The comments section often holds details of the compiler version used and the header files included. An example of manipulating the comments section is shown in Example 4.66. The initial comments section shows the version information for the compiler, together with details of the header files included at compile time. Using the mcs flag -a, it is possible to append another comment to the file. $ cc -O code.c $ mcs -p a.out a.out: Example 4.65 Example of Output from dump (continued ) Example 4.66 Manipulating the Comments Section Using mcs cg: Sun Compiler Common 11 2005/10/13 cg: Sun Compiler Common 11 2005/10/13 @(#)stdio.h 1.84 04/09/28 SMI @(#)feature_tests.h 1.25 07/02/02 SMI ... ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.486 $ mcs -a "Hello" a.out $ mcs -p a.out a.out: ... ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.486 Hello

92 <strong>Chapter</strong> 4 Informational Tools<br />

.strtab:<br />

Name<br />

<br />

a.out<br />

crti.s<br />

crt1.s<br />

__get_exit_frame_monitor_ptr<br />

...<br />

.stab.indexstr:<br />

Name<br />

/tmp/;/opt/SUNWspro/prod/bin/f90 -g -qoption f90comp -<br />

h.XAzwWCA01y4\$DCK. test.f90<br />

...<br />

The mcs tool, which is shipped with <strong>Solaris</strong>, manipulates the comments section<br />

in elf files. The -p option will print the comments. It is possible to delete the comments<br />

section using -d, or append more strings using -a. The comments section<br />

often holds details of the compiler version used and the header files included. An<br />

example of manipulating the comments section is shown in Example 4.66. The initial<br />

comments section shows the version information for the compiler, together<br />

with details of the header files included at compile time. Using the mcs flag -a, it<br />

is possible to append another comment to the file.<br />

$ cc -O code.c<br />

$ mcs -p a.out<br />

a.out:<br />

Example 4.65 Example of Output from dump (continued )<br />

Example 4.66 Manipulating the Comments Section Using mcs<br />

cg: Sun Compiler Common 11 2005/10/13<br />

cg: Sun Compiler Common 11 2005/10/13<br />

@(#)stdio.h 1.84 04/09/28 SMI<br />

@(#)feature_tests.h 1.25 07/02/02 SMI<br />

...<br />

ld: Software Generation Utilities - <strong>Solaris</strong> Link Editors: 5.10-1.486<br />

$ mcs -a "Hello" a.out<br />

$ mcs -p a.out<br />

a.out:<br />

...<br />

ld: Software Generation Utilities - <strong>Solaris</strong> Link Editors: 5.10-1.486<br />

Hello

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!