https://sourceware.org/bugzilla/show_bug.cgi?id=33779
Bug ID: 33779
Summary: .attach_to_group vs. multiple .section
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: jason.andryuk at amd dot com
Target Milestone: ---
Created attachment 16561
--> https://sourceware.org/bugzilla/attachment.cgi?id=16561&action=edit
c file with .init.text sections and .attach_to_group
Hi,
I'm trying to use .attach_to_group to group a function and its alternative
replacement instructions in the Xen hypervisor. I'd like to use gcc
-ffunction-sections and link with --gc-sections to drop entire groups of
function/alternatives/etc.
Xen also have some uses of
#define __init __attribute__((__section__((.init.text))))
to define boot time code that can be discarded.
The use of .attach_to_group breaks assembly with lots of:
Warning: dwarf line number information for .init.text ignored
and
Error: leb128 operand is an undefined symbol: .LVU4040
The issue seems to be that in a given file only the first instance is
.section .init.text,"ax",@progbits
and subsequent instances are:
.section .init.text
When the second .section is processed, get_section_by_match() does not match
the first .init.text. The first .init.text has been added to group .init.text,
but the second .init.text does not have a group (yet).
When the second section is created internally, it misses the original flags:
flags 0000000c vs need 00000013
Multiple .text are handled properly - they have
flags 0000001f vs need 00000013
Manually adding "ax",@progbits lets the file assemble.
When the dwarf line number information is retained, the leb128 errors go away.
Should .init.text be able to match another .init.text with a group for the
purposes of grabbing the flags?
I've attached b.c and some .s files to show the issue:
$ cc -ffunction-sections -fdata-sections -g -Wa,--sectname-subst -S -o
b.func-sects.s b.c
$ cc -g -Wa,--sectname-subst -S -o b.s b.c
$ as --sectname-subst b.s
b.s: Assembler messages:
b.s:93: Warning: dwarf line number information for .init.text ignored
b.s:104: Warning: dwarf line number information for .init.text ignored
b.s:106: Warning: dwarf line number information for .init.text ignored
$ as --sectname-subst b.func-sects.s
b.func-sects.s: Assembler messages:
b.func-sects.s:94: Warning: dwarf line number information for .init.text
ignored
b.func-sects.s:105: Warning: dwarf line number information for .init.text
ignored
b.func-sects.s:107: Warning: dwarf line number information for .init.text
ignored
$ cp b.func-sects.s b.progbits.s
$ vim b.progbits.s # add "ax",@progbits
$ as --sectname-subst b.progbits.s
$
--
You are receiving this mail because:
You are on the CC list for the bug.