🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Thomas Tornblom Thu, 29 Oct 1992 12:04
gcc 2.2.2 -fpic on sun386i generates illegal assembly code
#16
Author: Thomas Tornblom
Date: Thu, 29 Oct 1992 12:04
65 lines
1739 bytes
Compiling the following simple file makes suns as complain:
---------
foo()
{
    (void) bar(42);
}
---------

gcc -fpic -S -O2 (-O2 doesn't matter, the code just gets shorter)
produces the following illegal assembly code:
----
	.file	"foo.c"
	.version	"GNU C 2.2.2"
	.optim
gcc2_compiled.:
.text
	.align 4
.globl foo
foo:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	call .L2
.L2:
	popl %ebx
	addl $_GLOBAL_OFFSET_TABLE_+[.-.L2],%ebx
	pushl $42
	call bar@PLT				<= illegal character
	movl -4(%ebp),%ebx
	leave
	ret
---------
cc -pic -S -O produces the following code:
---------
	.file	"foo.c"
	.version	"sun386-1.0"
	.optim
.LL0:
        .data
	.text
	.globl	foo
foo:
	pushl	%ebp
	movl	%esp,%ebp
	pushl	%ebx
	call	.+5
	pop	%ebx
	add	$_globtb_offset,%ebx
	pushl	$42
	call	bar,%eax			<= this is ok
	popl	%ecx
/ASMQ
	movl	-4(%ebp),%ebx
/ASMEND0
	leave	
	ret	
/FUNCEND

        .data
	.text
--
Real life:      Thomas Tornblom           Email:  Thomas.Tornblom@Nexus.Comm.SE
Snail mail:     Communicator Nexus AB     Phone:  +46 18 171814
                Box 857                   Fax:    +46 18 696516
                S - 751 08 Uppsala, Sweden
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads