This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linking files with 16 and 32 bit code


I have come across a situation where DISP16 is not being calculated
correctly.

To test this I created 2 .S files which were compiled using gcc 3.1.1 to
produce object files.

These object files appear correct (see objdump for each .o file below)

These two object files were linked together using ld (version 2.12.90
20020706)

The resultant file has the DISP16 calculated as FFEB instead of FFED (see
objdump of the output file)

I hope the above makes some sense (it's taken me long enough to work out
what's going on)

regards

Mike Lerwill

================================== rtest.S
	.code32

	.global l1

l1:	nop
	ret

	.end

================================== rtest2.S
	.code16

	.global l1
	call	l1

	.end

================================== rtest.o

rtest.o:     file format pe-i386

Disassembly of section .text:

00000000 <l1>:
   0:	90                   	nop
   1:	c3                   	ret
   2:	90                   	nop
   3:	90                   	nop
   4:	90                   	nop
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	90                   	nop
   b:	90                   	nop
   c:	90                   	nop
   d:	90                   	nop
   e:	90                   	nop
   f:	90                   	nop
================================== rtest2.o

rtest2.o:     file format pe-i386

Disassembly of section .text:

00000000 <.text>:
   0:	e8 00 00 90 90       	call   90900005 <.text+0x90900005>
			1: DISP16	l1
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	90                   	nop
   b:	90                   	nop
   c:	90                   	nop
   d:	90                   	nop
   e:	90                   	nop
   f:	90                   	nop
================================== rtest2.exe

rtest.exe:     file format pei-i386

Disassembly of section .text:

00000000 <__bss_end__>:
   0:	90                   	nop
   1:	c3                   	ret
   2:	90                   	nop
   3:	90                   	nop
   4:	90                   	nop
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	90                   	nop
   b:	90                   	nop
   c:	90                   	nop
   d:	90                   	nop
   e:	90                   	nop
   f:	90                   	nop

00000010 <.text>:
  10:	e8 eb ff 90 90       	call   90910000 <__image_base__+0x90510000>
  15:	90                   	nop
  16:	90                   	nop
  17:	90                   	nop
  18:	90                   	nop
  19:	90                   	nop
  1a:	90                   	nop
  1b:	90                   	nop
  1c:	90                   	nop
  1d:	90                   	nop
  1e:	90                   	nop
  1f:	90                   	nop



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]