Fix PR12763, .tbss mishandling

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Fri May 20 17:27:00 GMT 2011


> Date: Sat, 21 May 2011 01:07:23 +0930
> From: Alan Modra <amodra@gmail.com>

> 	PR 12763
> 	* elf.c (_bfd_elf_make_section_from_shdr): Set up TLS section LMAs
> 	from PT_TLS header.
> 	(_bfd_elf_map_sections_to_segments): Don't create a final PT_LOAD
> 	segment if just for .tbss.
> 	(assign_file_positions_for_load_sections): Don't report "can't
> 	allocate in segment" errors for .tbss.
> 	(assign_file_positions_for_non_load_sections): Don't set p_filesz
> 	from SHT_NOBITS section filepos.

This change caused, for cris-axis-elf and cris-axis-linux-gnu:

Running /tmp/hpautotest-binutils/bsrc/src/ld/testsuite/ld-cris/cris.exp ...
FAIL: ld-cris/tls-e-tpoffcomm1

The first different lines between ld-cris/tls-e-tpoffcomm1.d and
the linked output are:

regexp_diff match failure
regexp "^         filesz 0x0+a4 memsz 0x0+a4 flags r-x$"
line   "         filesz 0x00000084 memsz 0x00000084 flags r-x"
regexp_diff match failure
regexp "^    LOAD off    0x0+a4 vaddr 0x0+820a4 paddr 0x0+820a4 align 2\*\*13$"
line   "     TLS off    0x00000000 vaddr 0x00082084 paddr 0x00082084 align 2**2"
regexp_diff match failure
regexp "^         filesz 0x0+ memsz 0x0+ flags rw-$"
line   "         filesz 0x00000000 memsz 0x00000008 flags r--"
regexp_diff match failure
regexp "^     TLS off    0x0+a4 vaddr 0x0+820a4 paddr 0x0+820a4 align 2\*\*2$"
line   "private flags = 0:"
regexp_diff match failure
regexp "^         filesz 0x0+ memsz 0x0+8 flags r--$"
line   "Sections:"

On the surface the change seems benevolent, removing a LOAD of
an empty segment which had just the effect of filling up 32
bytes.

brgds, H-P



More information about the Binutils mailing list