public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* determining output section type
@ 2021-11-03 12:40 Rasmus Villemoes
  2021-11-04  2:01 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Rasmus Villemoes @ 2021-11-03 12:40 UTC (permalink / raw)
  To: binutils

Hi

I've observed that there has been some change between 2.34 and 2.35 (and
from some 'git grep'/'git blame' I suspect commit 8c803a2dd7d3
(elf_backend_section_flags and _bfd_elf_init_private_section_data))
which ends up breaking module loading on our old vxworks platform.

The issue is that the .data section now ends up having type INIT_ARRAY
rather than PROGBITS, and the ELF loader on target doesn't know anything
about that section type, so it ignores it. We use a custom linker
script, part of which reads

    .data 0 :
    {
	PROVIDE(__start_data = .);

	_ctors = .;
	KEEP (*(.preinit_array))
	KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
	KEEP (*(.init_array))
	LONG(0)

...
	*(.data)
	*(.data.*) *(.gnu.linkonce.d*) *(.data1)
	PROVIDE(__stop_data = .);
    }

If I rearrange this to put the *(.data) stanza at the beginning, the
.data section in the output file does get type PROGBITS, but only if any
of the input .data sections are non-empty. I could arrange for that in
the toolchain I build since that includes linking in a crtbegin.o that I
control, but it seems a little wasteful and fragile.

Is there some way in the linker script (or otherwise) to force .data to
have type PROGBITS? I'd rather not need a post-processing step editing
the ELF file, even if it could be done with objcopy or similar.

Rasmus

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

end of thread, other threads:[~2021-11-07 21:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 12:40 determining output section type Rasmus Villemoes
2021-11-04  2:01 ` Alan Modra
2021-11-04  7:47   ` Rasmus Villemoes
2021-11-05 13:11     ` Rasmus Villemoes
2021-11-07 21:48       ` Alan Modra

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).