public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* pushl computed immediate address on 2.8.1
@ 1998-01-02 12:41 Robert Lipe
  1998-01-02 13:06 ` Ian Lance Taylor
  1998-01-09 20:42 ` H.J. Lu
  0 siblings, 2 replies; 6+ messages in thread
From: Robert Lipe @ 1998-01-02 12:41 UTC (permalink / raw)
  To: gas2

I was thinking this was a bug in the SCO x86 assembler becuase it worked
under GAS for Linux.   However, after some prodding form the egcs folks 
that really know PIC, I'm wondering if this is actually a construct that 
GAS should produce an error for becuase GCC shouldn't emit it.

The problem is that 

	pushl $.LC0@GOTOFF(%ebx)

seems to assemble just like

	pushl $LC0

so it ends up generating an push of an absolute address once the 
linker gets done with it.

Does this sound right at all?    Should GAS error on this?


Here's a short "hello, world" in PIC to exercise the issue.


Thanx,

RJL

	.file	"test.c"
	.section	.rodata
.LC0:
	.string	"Hello, World\n"

	.text
	.align 4
	.globl main
	.type	 main,@function
main:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	call .L2
.L2:
	popl %ebx
	addl $_GLOBAL_OFFSET_TABLE_+[.-.L2],%ebx

// This is the aproach that works, and is what GCC should emit.
// registers
	leal .LC0@GOTOFF(%ebx),%eax
	pushl %eax
	call printf@PLT

// This what GCC does emit, but seems to be nonsensical.
// assembler.
	pushl $.LC0@GOTOFF(%ebx)
	call printf@PLT

	movl -4(%ebp),%ebx
	movl %ebp,%esp
	popl %ebp
	ret
	.size	 main,.-main



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-01-10 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-02 12:41 pushl computed immediate address on 2.8.1 Robert Lipe
1998-01-02 13:06 ` Ian Lance Taylor
1998-01-02 13:26   ` Robert Lipe
1998-01-09 20:42 ` H.J. Lu
1998-01-09 23:02   ` Robert Lipe
1998-01-10 14:25     ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).