Broken .loc directive in GAS

Alan Modra amodra@bigpond.net.au
Fri Jul 11 11:43:00 GMT 2003


On Fri, Jul 11, 2003 at 08:27:50AM +0200, Michal Ludvig wrote:
> Richard Henderson told me that:
> >On Thu, Jul 10, 2003 at 05:36:08PM +0200, Michal Ludvig wrote:
> >>Offset 0x52 points 2 bytes beyond the end of the section ...
> >
> >Well, that would be a bug, certainly.  Test case?
> 
> Test case was in my first posting - attached file temp.cc (attaching it 

I don't see any problem with current gcc-3.3 and mainline, and an older
gcc-3.3.  Current mainline gives:

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       temp.cc

 Line Number Statements:
  Extended opcode 2: set Address to 0x80483ba
  Special opcode 13: advance Address by 0 to 0x80483ba and Line by 8 to 9
  Advance PC by 6 to 80483c0
  Extended opcode 1: End of Sequence

  Extended opcode 2: set Address to 0x80483b4
  Special opcode 13: advance Address by 0 to 0x80483b4 and Line by 8 to 9
  Advance PC by 6 to 80483ba
  Extended opcode 1: End of Sequence

  Extended opcode 2: set Address to 0x8048354
  Advance Line by 16 to 17
  Copy
  Special opcode 230: advance Address by 16 to 0x8048364 and Line by 1 to 18
  Special opcode 76: advance Address by 5 to 0x8048369 and Line by 1 to 19
  Special opcode 48: advance Address by 3 to 0x804836c and Line by 1 to 20
  Advance Line by -7 to 13
  Special opcode 89: advance Address by 6 to 0x8048372 and Line by 0 to 13
  Advance PC by 35 to 8048395
  Special opcode 12: advance Address by 0 to 0x8048395 and Line by 7 to 20
  Special opcode 48: advance Address by 3 to 0x8048398 and Line by 1 to 21
  Advance PC by 28 to 80483b4
  Extended opcode 1: End of Sequence

For reference, I've attached the -S output I get from your testcase.
I suppose it's possible that ld is being confused by your crt*, libgcc
or libc.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre
-------------- next part --------------
	.file	"temp.cc"
	.section	.debug_abbrev,"",@progbits
.Ldebug_abbrev0:
	.section	.debug_info,"",@progbits
.Ldebug_info0:
	.section	.debug_line,"",@progbits
.Ldebug_line0:
	.text
.Ltext0:
.globl t5i
	.bss
	.type	t5i, @object
	.size	t5i, 1
t5i:
	.zero	1
	.text
	.align 2
.globl main
	.type	main, @function
main:
.LFB4:
.LBB2:
	.file 1 "/src/tmp/temp.cc"
	.loc 1 17 0
	pushl	%ebp
.LCFI0:
	movl	%esp, %ebp
.LCFI1:
	subl	$8, %esp
.LCFI2:
	andl	$-16, %esp
	movl	$0, %eax
	subl	%eax, %esp
	.loc 1 18 0
	movl	$0, %eax
.LBE2:
	.loc 1 19 0
	leave
	ret
.LFE4:
	.size	main, .-main
	.section	.gnu.linkonce.t._ZN2T5IiEC2Ei,"ax",@progbits
	.align 2
	.weak	_ZN2T5IiEC2Ei
	.type	_ZN2T5IiEC2Ei, @function
_ZN2T5IiEC2Ei:
.LFB7:
	.loc 1 9 0
	pushl	%ebp
.LCFI3:
	movl	%esp, %ebp
.LCFI4:
	popl	%ebp
	ret
.LFE7:
	.size	_ZN2T5IiEC2Ei, .-_ZN2T5IiEC2Ei
	.section	.gnu.linkonce.t._ZN2T5IiEC1Ei,"ax",@progbits
	.align 2
	.weak	_ZN2T5IiEC1Ei
	.type	_ZN2T5IiEC1Ei, @function
_ZN2T5IiEC1Ei:
.LFB9:
	.loc 1 9 0
	pushl	%ebp
.LCFI5:
	movl	%esp, %ebp
.LCFI6:
	popl	%ebp
	ret
.LFE9:
	.size	_ZN2T5IiEC1Ei, .-_ZN2T5IiEC1Ei
	.text
	.align 2
	.type	_Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB11:
	.loc 1 20 0
	pushl	%ebp
.LCFI7:
	movl	%esp, %ebp
.LCFI8:
	subl	$8, %esp
.LCFI9:
	.loc 1 13 0
	cmpl	$65535, 12(%ebp)
	jne	.L4
	cmpl	$1, 8(%ebp)
	jne	.L4
	movl	$2, 4(%esp)
	movl	$t5i, (%esp)
	call	_ZN2T5IiEC1Ei
.L4:
	.loc 1 20 0
	leave
	ret
.LFE11:
	.size	_Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
	.align 2
	.type	_GLOBAL__I_t5i, @function
_GLOBAL__I_t5i:
.LFB13:
	.loc 1 21 0
	pushl	%ebp
.LCFI10:
	movl	%esp, %ebp
.LCFI11:
	subl	$8, %esp
.LCFI12:
	movl	$65535, 4(%esp)
	movl	$1, (%esp)
	call	_Z41__static_initialization_and_destruction_0ii
	leave
	ret
.LFE13:
	.size	_GLOBAL__I_t5i, .-_GLOBAL__I_t5i
	.section	.ctors,"aw",@progbits
	.align 4
	.long	_GLOBAL__I_t5i
	.section	.debug_frame,"",@progbits
.Lframe0:
	.long	.LECIE0-.LSCIE0
.LSCIE0:
	.long	0xffffffff
	.byte	0x1
	.string	""
	.uleb128 0x1
	.sleb128 -4
	.byte	0x8
	.byte	0xc
	.uleb128 0x4
	.uleb128 0x4
	.byte	0x88
	.uleb128 0x1
	.align 4
.LECIE0:
.LSFDE0:
	.long	.LEFDE0-.LASFDE0
.LASFDE0:
	.long	.Lframe0
	.long	.LFB4
	.long	.LFE4-.LFB4
	.byte	0x4
	.long	.LCFI0-.LFB4
	.byte	0xe
	.uleb128 0x8
	.byte	0x85
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI1-.LCFI0
	.byte	0xd
	.uleb128 0x5
	.align 4
.LEFDE0:
.LSFDE2:
	.long	.LEFDE2-.LASFDE2
.LASFDE2:
	.long	.Lframe0
	.long	.LFB7
	.long	.LFE7-.LFB7
	.byte	0x4
	.long	.LCFI3-.LFB7
	.byte	0xe
	.uleb128 0x8
	.byte	0x85
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI4-.LCFI3
	.byte	0xd
	.uleb128 0x5
	.align 4
.LEFDE2:
.LSFDE4:
	.long	.LEFDE4-.LASFDE4
.LASFDE4:
	.long	.Lframe0
	.long	.LFB9
	.long	.LFE9-.LFB9
	.byte	0x4
	.long	.LCFI5-.LFB9
	.byte	0xe
	.uleb128 0x8
	.byte	0x85
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI6-.LCFI5
	.byte	0xd
	.uleb128 0x5
	.align 4
.LEFDE4:
.LSFDE6:
	.long	.LEFDE6-.LASFDE6
.LASFDE6:
	.long	.Lframe0
	.long	.LFB11
	.long	.LFE11-.LFB11
	.byte	0x4
	.long	.LCFI7-.LFB11
	.byte	0xe
	.uleb128 0x8
	.byte	0x85
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI8-.LCFI7
	.byte	0xd
	.uleb128 0x5
	.align 4
.LEFDE6:
.LSFDE8:
	.long	.LEFDE8-.LASFDE8
.LASFDE8:
	.long	.Lframe0
	.long	.LFB13
	.long	.LFE13-.LFB13
	.byte	0x4
	.long	.LCFI10-.LFB13
	.byte	0xe
	.uleb128 0x8
	.byte	0x85
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI11-.LCFI10
	.byte	0xd
	.uleb128 0x5
	.align 4
.LEFDE8:
	.text
.Letext0:
	.section	.debug_info
	.long	0x1ed
	.value	0x2
	.long	.Ldebug_abbrev0
	.byte	0x4
	.uleb128 0x1
	.long	.Ldebug_line0
	.string	"GNU C++ 3.4 20030710 (experimental)"
	.byte	0x4
	.string	"/src/tmp/temp.cc"
	.uleb128 0x2
	.long	0xb6
	.string	"T5<int>"
	.byte	0x1
	.byte	0x1
	.byte	0x2
	.uleb128 0x3
	.long	0x8a
	.byte	0x1
	.string	"operator="
	.string	"_ZN2T5IiEaSERKS0_"
	.long	0xb6
	.byte	0x1
	.byte	0x1
	.uleb128 0x4
	.long	0xbc
	.byte	0x1
	.uleb128 0x5
	.long	0xc2
	.byte	0x0
	.uleb128 0x6
	.long	0xa1
	.byte	0x1
	.string	"T5"
	.byte	0x1
	.byte	0x1
	.uleb128 0x4
	.long	0xbc
	.byte	0x1
	.uleb128 0x5
	.long	0xc2
	.byte	0x0
	.uleb128 0x7
	.byte	0x1
	.string	"T5"
	.byte	0x1
	.byte	0x9
	.byte	0x1
	.uleb128 0x4
	.long	0xbc
	.byte	0x1
	.uleb128 0x5
	.long	0xcd
	.byte	0x0
	.byte	0x0
	.uleb128 0x8
	.byte	0x4
	.long	0x46
	.uleb128 0x9
	.byte	0x4
	.long	0x46
	.uleb128 0x8
	.byte	0x4
	.long	0xc8
	.uleb128 0xa
	.long	0x46
	.uleb128 0xb
	.string	"int"
	.byte	0x4
	.byte	0x5
	.uleb128 0xc
	.byte	0x1
	.string	"main"
	.byte	0x1
	.byte	0x11
	.long	0xcd
	.long	.LFB4
	.long	.LFE4
	.byte	0x1
	.byte	0x55
	.uleb128 0xd
	.long	0x10c
	.long	0xa1
	.byte	0x2
	.uleb128 0xe
	.string	"this"
	.long	0x10c
	.byte	0x1
	.uleb128 0xf
	.string	"val"
	.byte	0x1
	.byte	0x9
	.long	0xcd
	.byte	0x0
	.uleb128 0xa
	.long	0xbc
	.uleb128 0x10
	.long	0x135
	.long	0xeb
	.long	.LFB7
	.long	.LFE7
	.byte	0x1
	.byte	0x55
	.uleb128 0x11
	.long	0xf5
	.byte	0x2
	.byte	0x91
	.sleb128 8
	.uleb128 0x11
	.long	0x100
	.byte	0x2
	.byte	0x91
	.sleb128 12
	.byte	0x0
	.uleb128 0x10
	.long	0x159
	.long	0xeb
	.long	.LFB9
	.long	.LFE9
	.byte	0x1
	.byte	0x55
	.uleb128 0x11
	.long	0xf5
	.byte	0x2
	.byte	0x91
	.sleb128 8
	.uleb128 0x11
	.long	0x100
	.byte	0x2
	.byte	0x91
	.sleb128 12
	.byte	0x0
	.uleb128 0x12
	.long	0x1c2
	.string	"__static_initialization_and_destruction_0"
	.byte	0x1
	.long	.LFB11
	.long	.LFE11
	.byte	0x1
	.byte	0x55
	.uleb128 0x13
	.string	"__initialize_p"
	.byte	0x1
	.byte	0x14
	.long	0xcd
	.byte	0x2
	.byte	0x91
	.sleb128 8
	.uleb128 0x13
	.string	"__priority"
	.byte	0x1
	.byte	0x14
	.long	0xcd
	.byte	0x2
	.byte	0x91
	.sleb128 12
	.byte	0x0
	.uleb128 0x14
	.string	"_GLOBAL__I_t5i"
	.byte	0x1
	.byte	0x15
	.long	.LFB13
	.long	.LFE13
	.byte	0x1
	.byte	0x55
	.uleb128 0x15
	.string	"t5i"
	.byte	0x1
	.byte	0xd
	.long	0x46
	.byte	0x1
	.byte	0x5
	.byte	0x3
	.long	t5i
	.byte	0x0
	.section	.debug_abbrev
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x10
	.uleb128 0x6
	.uleb128 0x25
	.uleb128 0x8
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0x8
	.byte	0x0
	.byte	0x0
	.uleb128 0x2
	.uleb128 0x13
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x2007
	.uleb128 0x8
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x34
	.uleb128 0xc
	.uleb128 0x3c
	.uleb128 0xc
	.byte	0x0
	.byte	0x0
	.uleb128 0x4
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x34
	.uleb128 0xc
	.byte	0x0
	.byte	0x0
	.uleb128 0x5
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x6
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x34
	.uleb128 0xc
	.uleb128 0x3c
	.uleb128 0xc
	.byte	0x0
	.byte	0x0
	.uleb128 0x7
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x3c
	.uleb128 0xc
	.byte	0x0
	.byte	0x0
	.uleb128 0x8
	.uleb128 0x10
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x9
	.uleb128 0xf
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0xa
	.uleb128 0x26
	.byte	0x0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0xb
	.uleb128 0x24
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0xc
	.uleb128 0x2e
	.byte	0x0
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0xd
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x47
	.uleb128 0x13
	.uleb128 0x20
	.uleb128 0xb
	.byte	0x0
	.byte	0x0
	.uleb128 0xe
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x34
	.uleb128 0xc
	.byte	0x0
	.byte	0x0
	.uleb128 0xf
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0x0
	.byte	0x0
	.uleb128 0x10
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x31
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x11
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x31
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x12
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x1
	.uleb128 0x13
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x34
	.uleb128 0xc
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x13
	.uleb128 0x5
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x14
	.uleb128 0x2e
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x40
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x15
	.uleb128 0x34
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.byte	0x0
	.section	.debug_pubnames,"",@progbits
	.long	0x3f
	.value	0x2
	.long	.Ldebug_info0
	.long	0x1f1
	.long	0xd4
	.string	"main"
	.long	0x111
	.string	"T5<int>::T5"
	.long	0x135
	.string	"T5<int>::T5"
	.long	0x1de
	.string	"t5i"
	.long	0x0
	.section	.debug_aranges,"",@progbits
	.long	0x2c
	.value	0x2
	.long	.Ldebug_info0
	.byte	0x4
	.byte	0x0
	.value	0x0
	.value	0x0
	.long	.Ltext0
	.long	.Letext0-.Ltext0
	.long	.LFB7
	.long	.LFE7-.LFB7
	.long	.LFB9
	.long	.LFE9-.LFB9
	.long	0x0
	.long	0x0
	.section	.note.GNU-stack,"",@progbits
	.ident	"GCC: (GNU) 3.4 20030710 (experimental)"


More information about the Binutils mailing list