Put MIPS .mdebug.* sections at address 0

Joseph S. Myers joseph@codesourcery.com
Tue Dec 20 16:53:00 GMT 2011


I've observed prelink problems on MIPS that related to the
.mdebug.abi32 section being located at address 0x412cb0 and so being a
SHT_PROGBITS section located after a SHT_NOBITS section, something
prelink does not expect.

Logically being at that address should be harmless, since the section
is unallocated, but prelink isn't designed to work on completely
arbitrary valid ELF binaries (it needs cooperation from the linker).
As this section is an unallocated section much like .comment, 0 seems
like the most appropriate address for it just as .comment is placed at
address 0; this patch places all the .mdebug.* sections at address 0
(I don't know enough about the other MIPS-specific sections to know if
they should go there as well).

Tested with no regressions with cross to mips-linux-gnu.  OK to
commit?

2011-12-20  Joseph Myers  <joseph@codesourcery.com>

	* emulparams/elf32bmip.sh (OTHER_SECTIONS): Put .mdebug.* sections
	at address 0.

Index: ld/emulparams/elf32bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmip.sh,v
retrieving revision 1.17
diff -u -r1.17 elf32bmip.sh
--- ld/emulparams/elf32bmip.sh	8 Aug 2008 19:24:49 -0000	1.17
+++ ld/emulparams/elf32bmip.sh	20 Dec 2011 16:43:44 -0000
@@ -64,12 +64,12 @@
 OTHER_SECTIONS='
   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-  .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
-  .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
-  .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
-  .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
-  .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
-  .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
+  .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
+  .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
+  .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
+  .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) }
+  .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) }
+  .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
   .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
   .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
 '

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Binutils mailing list