Stop Gas from generating line info or address ranges for sections that do not contain code or are not loaded

Alan Modra amodra@gmail.com
Tue Nov 17 00:49:52 GMT 2020


Hi Nick,
git commit bcb78b47614ed (was that patch posted?) resulted in

x86_64-w64-mingw32  +FAIL: aligned common 1
x86_64-w64-mingw32  +FAIL: aligned common 2
x86_64-w64-mingw32  +FAIL: aligned common 3
x86_64-w64-mingw32  +FAIL: aligned common 4
x86_64-w64-mingw32  +FAIL: compiling client fastcall/stdcall
x86_64-w64-mingw32  -FAIL: plugin claimfile replace symbol
x86_64-w64-mingw32  -FAIL: plugin claimfile resolve symbol
x86_64-w64-mingw32  -FAIL: load plugin with source
x86_64-w64-mingw32  -FAIL: plugin claimfile lost symbol with source
x86_64-w64-mingw32  -FAIL: plugin claimfile replace symbol with source
x86_64-w64-mingw32  -FAIL: plugin claimfile resolve symbol with source
x86_64-w64-mingw32  -FAIL: plugin claimfile replace file with source
x86_64-w64-mingw32  -FAIL: PR ld/17973
x86_64-w64-mingw32  -FAIL: plugin ignore lib with source
x86_64-w64-mingw32  -FAIL: plugin claimfile replace lib with source
x86_64-w64-mingw32  -FAIL: plugin 2 with source lib
x86_64-w64-mingw32  -FAIL: load plugin 2 with source
x86_64-w64-mingw32  -FAIL: load plugin 2 with source and -r
x86_64-w64-mingw32  -FAIL: plugin 3 with source lib
x86_64-w64-mingw32  -FAIL: load plugin 3 with source
x86_64-w64-mingw32  -FAIL: load plugin 3 with source and -r

Now if it really had fixed all those plugin fails it would be good
but instead plugin support isn't detected.  So no plugin testing was
done.

ld/ld.log has errors like the following.
/tmp/ccI6sUZe.s:335: Error: leb128 operand is an undefined symbol: .LVU3

Also, no warning about throwing away debug info.  :-(

It seems that we are getting sections without SEC_ALLOC set.

-- 
Alan Modra
Australia Development Lab, IBM
-------------- next part --------------
	.file	"main.c"
	.text
.Ltext0:
	.cfi_sections	.debug_frame
	.def	__main;	.scl	2;	.type	32;	.endef
	.section	.text.startup,"x"
	.p2align 4
	.globl	main
	.def	main;	.scl	2;	.type	32;	.endef
	.seh_proc	main
main:
.LVL0:
.LFB0:
	.file 1 "/home/alan/src/binutils-gdb/ld/testsuite/ld-plugin/main.c"
	.loc 1 10 1 view -0
	.cfi_startproc
	.loc 1 10 1 is_stmt 0 view .LVU1
	subq	$40, %rsp
	.seh_stackalloc	40
	.cfi_def_cfa_offset 48
	.seh_endprologue
	.loc 1 10 1 view .LVU2
	call	__main
.LVL1:
	.loc 1 11 3 is_stmt 1 view .LVU3
	movq	.refptr.text(%rip), %rax
	movq	(%rax), %rcx
	call	puts
	nop
.LVL2:
	.loc 1 12 3 view .LVU4
	.loc 1 13 1 is_stmt 0 view .LVU5
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	.loc 1 12 10 view .LVU6
	jmp	func
.LVL3:
	.cfi_endproc
.LFE0:
	.seh_endproc
	.globl	retval
	.bss
	.align 4
retval:
	.space 4
	.text
.Letext0:
	.file 2 "<built-in>"
	.section	.debug_info,"dr"
.Ldebug_info0:
	.long	0x18d
	.word	0x4
	.secrel32	.Ldebug_abbrev0
	.byte	0x8
	.uleb128 0x1
	.ascii "GNU C17 9.3.1 20200611 -mtune=generic -march=x86-64 -g -O2\0"
	.byte	0xc
	.ascii "/home/alan/src/binutils-gdb/ld/testsuite/ld-plugin/main.c\0"
	.ascii "/home/alan/build/gas/x86_64-w64-mingw32/ld\0"
	.secrel32	.Ldebug_ranges0+0
	.quad	0
	.secrel32	.Ldebug_line0
	.uleb128 0x2
	.ascii "text\0"
	.byte	0x1
	.byte	0x4
	.byte	0x14
	.long	0xca
	.uleb128 0x3
	.byte	0x8
	.long	0xd8
	.uleb128 0x4
	.byte	0x1
	.byte	0x6
	.ascii "char\0"
	.uleb128 0x5
	.long	0xd0
	.uleb128 0x6
	.ascii "retval\0"
	.byte	0x1
	.byte	0x7
	.byte	0x5
	.long	0xf6
	.uleb128 0x9
	.byte	0x3
	.quad	retval
	.uleb128 0x4
	.byte	0x4
	.byte	0x5
	.ascii "int\0"
	.uleb128 0x7
	.ascii "main\0"
	.byte	0x1
	.byte	0x9
	.byte	0x5
	.long	0xf6
	.quad	.LFB0
	.quad	.LFE0-.LFB0
	.uleb128 0x1
	.byte	0x9c
	.long	0x165
	.uleb128 0x8
	.ascii "argc\0"
	.byte	0x1
	.byte	0x9
	.byte	0xf
	.long	0xf6
	.secrel32	.LLST0
	.secrel32	.LVUS0
	.uleb128 0x8
	.ascii "argv\0"
	.byte	0x1
	.byte	0x9
	.byte	0x22
	.long	0x165
	.secrel32	.LLST1
	.secrel32	.LVUS1
	.uleb128 0x9
	.quad	.LVL2
	.long	0x16b
	.uleb128 0xa
	.quad	.LVL3
	.long	0x182
	.byte	0
	.uleb128 0x3
	.byte	0x8
	.long	0xca
	.uleb128 0xb
	.ascii "puts\0"
	.ascii "__builtin_puts\0"
	.byte	0x2
	.byte	0
	.uleb128 0xc
	.ascii "func\0"
	.ascii "func\0"
	.byte	0x1
	.byte	0x5
	.byte	0xc
	.byte	0
	.section	.debug_abbrev,"dr"
.Ldebug_abbrev0:
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x25
	.uleb128 0x8
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x1b
	.uleb128 0x8
	.uleb128 0x55
	.uleb128 0x17
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x10
	.uleb128 0x17
	.byte	0
	.byte	0
	.uleb128 0x2
	.uleb128 0x34
	.byte	0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x39
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0x19
	.uleb128 0x3c
	.uleb128 0x19
	.byte	0
	.byte	0
	.uleb128 0x3
	.uleb128 0xf
	.byte	0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.byte	0
	.byte	0
	.uleb128 0x4
	.uleb128 0x24
	.byte	0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0x8
	.byte	0
	.byte	0
	.uleb128 0x5
	.uleb128 0x26
	.byte	0
	.uleb128 0x49
	.uleb128 0x13
	.byte	0
	.byte	0
	.uleb128 0x6
	.uleb128 0x34
	.byte	0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x39
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0x19
	.uleb128 0x2
	.uleb128 0x18
	.byte	0
	.byte	0
	.uleb128 0x7
	.uleb128 0x2e
	.byte	0x1
	.uleb128 0x3f
	.uleb128 0x19
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x39
	.uleb128 0xb
	.uleb128 0x27
	.uleb128 0x19
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x7
	.uleb128 0x40
	.uleb128 0x18
	.uleb128 0x2116
	.uleb128 0x19
	.uleb128 0x1
	.uleb128 0x13
	.byte	0
	.byte	0
	.uleb128 0x8
	.uleb128 0x5
	.byte	0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x39
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x2
	.uleb128 0x17
	.uleb128 0x2137
	.uleb128 0x17
	.byte	0
	.byte	0
	.uleb128 0x9
	.uleb128 0x4109
	.byte	0
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x31
	.uleb128 0x13
	.byte	0
	.byte	0
	.uleb128 0xa
	.uleb128 0x4109
	.byte	0
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x2115
	.uleb128 0x19
	.uleb128 0x31
	.uleb128 0x13
	.byte	0
	.byte	0
	.uleb128 0xb
	.uleb128 0x2e
	.byte	0
	.uleb128 0x3f
	.uleb128 0x19
	.uleb128 0x3c
	.uleb128 0x19
	.uleb128 0x6e
	.uleb128 0x8
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.byte	0
	.byte	0
	.uleb128 0xc
	.uleb128 0x2e
	.byte	0
	.uleb128 0x3f
	.uleb128 0x19
	.uleb128 0x3c
	.uleb128 0x19
	.uleb128 0x6e
	.uleb128 0x8
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x39
	.uleb128 0xb
	.byte	0
	.byte	0
	.byte	0
	.section	.debug_loc,"dr"
.Ldebug_loc0:
.LVUS0:
	.uleb128 0
	.uleb128 .LVU3
	.uleb128 .LVU3
	.uleb128 0
.LLST0:
	.quad	.LVL0
	.quad	.LVL1-1
	.word	0x1
	.byte	0x52
	.quad	.LVL1-1
	.quad	.LFE0
	.word	0x4
	.byte	0xf3
	.uleb128 0x1
	.byte	0x52
	.byte	0x9f
	.quad	0
	.quad	0
.LVUS1:
	.uleb128 0
	.uleb128 .LVU3
	.uleb128 .LVU3
	.uleb128 0
.LLST1:
	.quad	.LVL0
	.quad	.LVL1-1
	.word	0x1
	.byte	0x51
	.quad	.LVL1-1
	.quad	.LFE0
	.word	0x4
	.byte	0xf3
	.uleb128 0x1
	.byte	0x51
	.byte	0x9f
	.quad	0
	.quad	0
	.section	.debug_aranges,"dr"
	.long	0x2c
	.word	0x2
	.secrel32	.Ldebug_info0
	.byte	0x8
	.byte	0
	.word	0
	.word	0
	.quad	.LFB0
	.quad	.LFE0-.LFB0
	.quad	0
	.quad	0
	.section	.debug_ranges,"dr"
.Ldebug_ranges0:
	.quad	.LFB0
	.quad	.LFE0
	.quad	0
	.quad	0
	.section	.debug_line,"dr"
.Ldebug_line0:
	.section	.debug_str,"dr"
	.ident	"GCC: (GNU) 9.3.1 20200611"
	.def	puts;	.scl	2;	.type	32;	.endef
	.def	func;	.scl	2;	.type	32;	.endef
	.section	.rdata$.refptr.text, "dr"
	.globl	.refptr.text
	.linkonce	discard
.refptr.text:
	.quad	text


More information about the Binutils mailing list