> Hi, > > I am not sure if this the right place to ask this question. > > How can we use cc to product assembler output file ? > > Regards >
bash-3.2$ cat hello.c #include <stdio.h> int main(int argc, char *argv[]) { printf ( "Hello World!\n" ); return (0); } bash-3.2$ CC=cc;export CC bash-3.2$ PATH=/opt/SUNWspro/bin:/usr/xpg4/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin bash-3.2$ export PATH bash-3.2$ cc -xstrconst -xildoff -xarch=v9a -xlibmil -Xc -c -o hello.o hello.c bash-3.2$ cc -xstrconst -xildoff -xarch=v9a -xlibmil -Xc -o hello hello.c bash-3.2$ cc -xstrconst -xildoff -xarch=v9a -xlibmil -Xc -S -o hello.s hello.c bash-3.2$ ls -lap hello* -rwxr-xr-x 1 dclarke csw 7504 Jan 23 09:58 hello -rw-r--r-- 1 dclarke staff 106 Apr 2 2006 hello.c -rw-r--r-- 1 dclarke csw 4371 Jan 23 09:58 hello.s bash-3.2$ file hello hello: ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC1 Extensions Required, dynamically linked, not stripped bash-3.2$ bash-3.2$ cat hello.s .section ".text",#alloc,#execinstr .align 8 .skip 24 ! block 0 .global main .type main,#function main: save %sp,-208,%sp ! block 1 .L58: st %i0,[%fp+2043] stx %i1,[%fp+2031] ! File hello.c: ! 1 #include <stdio.h> ! 2 ! 3 int ! 4 main(int argc, char *argv[]) ! 5 { ! 6 printf ( "Hello World!\n" ); sethi %h44(.L60),%o0 or %o0,%m44(.L60),%o0 sllx %o0,12,%o0 or %o0,%l44(.L60),%o0 call printf nop ! 7 return (0); mov 0,%l0 st %l0,[%fp+2027] mov 0,%i0 jmp %i7+8 restore ! block 2 .L57: mov 0,%i0 jmp %i7+8 restore .size main,(.-main) .align 8 .section ".rodata1",#alloc .align 8 .L60: .ascii "Hello World!\n\000" .type .L60,#object .size .L60,14 .section ".bss",#alloc,#write Bbss.bss: .skip 0 .type Bbss.bss,#object .size Bbss.bss,0 .section ".data",#alloc,#write Ddata.data: .skip 0 .type Ddata.data,#object .size Ddata.data,0 .section ".rodata",#alloc Drodata.rodata: .skip 0 .type Drodata.rodata,#object .size Drodata.rodata,0 .file "hello.c" .ident "@(#)stdio.h 1.78 99/12/08 SMI" .ident "@(#)stdio_iso.h 1.2 99/10/25 SMI" .ident "@(#)feature_tests.h 1.18 99/07/26 SMI" .ident "@(#)isa_defs.h 1.20 99/05/04 SMI" .ident "@(#)va_list.h 1.12 99/05/04 SMI" .ident "@(#)stdio_tag.h 1.3 98/04/20 SMI" .ident "@(#)stdio_impl.h 1.8 99/06/10 SMI" .ident "acomp: Sun C 5.8 Patch 121015-02 2006/03/29" .global __fsr_init_value __fsr_init_value = 0x0 ! Begin sdCreateSection : .debug_info ! Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0 ! Section Data Blocks: ! reloc[0]: knd=2, off=14, siz=8, lab1=.debug_abbrev, lab2=, loff=0 ! reloc[1]: knd=2, off=249, siz=8, lab1=.debug_line, lab2=, loff=0 .section ".debug_info" .byte 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 .byte 0x00,0x00,0x00,0xf8,0x00,0x02 .uaxword %section_symbol(".debug_abbrev") .byte 0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00 .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 .byte 0x00,0x04,0x68,0x65,0x6c,0x6c,0x6f,0x2e .byte 0x63,0x00,0x0c,0x2f,0x65,0x78,0x70,0x6f .byte 0x72,0x74,0x2f,0x6d,0x65,0x64,0x75,0x73 .byte 0x61,0x2f,0x64,0x63,0x6c,0x61,0x72,0x6b .byte 0x65,0x2f,0x70,0x67,0x6d,0x2f,0x43,0x2f .byte 0x72,0x61,0x6e,0x64,0x6f,0x6d,0x2f,0x72 .byte 0x6f,0x75,0x6c,0x65,0x74,0x74,0x65,0x00 .byte 0x20,0x2f,0x6f,0x70,0x74,0x2f,0x53,0x55 .byte 0x4e,0x57,0x73,0x70,0x72,0x6f,0x2f,0x70 .byte 0x72,0x6f,0x64,0x2f,0x62,0x69,0x6e,0x2f .byte 0x63,0x63,0x20,0x2d,0x78,0x73,0x74,0x72 .byte 0x63,0x6f,0x6e,0x73,0x74,0x20,0x2d,0x78 .byte 0x69,0x6c,0x64,0x6f,0x66,0x66,0x20,0x2d .byte 0x78,0x61,0x72,0x63,0x68,0x3d,0x76,0x39 .byte 0x61,0x20,0x2d,0x78,0x6c,0x69,0x62,0x6d .byte 0x69,0x6c,0x20,0x2d,0x58,0x63,0x20,0x2d .byte 0x53,0x20,0x20,0x68,0x65,0x6c,0x6c,0x6f .byte 0x2e,0x63,0x00,0x58,0x61,0x3b,0x52,0x3d .byte 0x53,0x75,0x6e,0x20,0x43,0x20,0x35,0x2e .byte 0x38,0x20,0x50,0x61,0x74,0x63,0x68,0x20 .byte 0x31,0x32,0x31,0x30,0x31,0x35,0x2d,0x30 .byte 0x32,0x20,0x32,0x30,0x30,0x36,0x2f,0x30 .byte 0x33,0x2f,0x32,0x39,0x3b,0x62,0x61,0x63 .byte 0x6b,0x65,0x6e,0x64,0x3b,0x72,0x61,0x77 .byte 0x3b,0x63,0x64,0x3b,0x00,0x44,0x42,0x47 .byte 0x5f,0x47,0x45,0x4e,0x20,0x35,0x2e,0x30 .byte 0x2e,0x38,0x00 .uaxword %section_symbol(".debug_line") .byte 0x00,0x00,0x00 ! End sdCreateSection ! Begin sdCreateSection : .debug_line ! Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0 ! Section Data Blocks: .section ".debug_line" .byte 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 .byte 0x00,0x00,0x00,0x52,0x00,0x02,0x00,0x00 .byte 0x00,0x00,0x00,0x00,0x00,0x48,0x04,0x00 .byte 0xff,0x04,0x0a,0x00,0x01,0x01,0x01,0x01 .byte 0x00,0x00,0x00,0x01,0x2f,0x65,0x78,0x70 .byte 0x6f,0x72,0x74,0x2f,0x6d,0x65,0x64,0x75 .byte 0x73,0x61,0x2f,0x64,0x63,0x6c,0x61,0x72 .byte 0x6b,0x65,0x2f,0x70,0x67,0x6d,0x2f,0x43 .byte 0x2f,0x72,0x61,0x6e,0x64,0x6f,0x6d,0x2f .byte 0x72,0x6f,0x75,0x6c,0x65,0x74,0x74,0x65 .byte 0x00,0x00,0x68,0x65,0x6c,0x6c,0x6f,0x2e .byte 0x63,0x00,0x01,0x00,0x00,0x00 ! End sdCreateSection ! Begin sdCreateSection : .debug_abbrev ! Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0 ! Section Data Blocks: .section ".debug_abbrev" .byte 0x01,0x11,0x00,0x11,0x01,0x12,0x01,0x03 .byte 0x08,0x13,0x0b,0x1b,0x08,0x85,0x44,0x08 .byte 0x87,0x44,0x08,0x25,0x08,0x10,0x07,0x00 .byte 0x00,0x00 ! End sdCreateSection bash-3.2$ Dennis Clarke _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org