Fix ADDR(nosuchsection) crash
Nathan Sidwell
nathan@codesourcery.com
Mon Dec 18 11:11:00 GMT 2006
A linker script that uses ADDR(nosuchsection) can cause confusing errors and a
crash. The linker script in this patch for instance, produces:
nathan@kosh:116>m68k-elf/ld/ld-new -T 1150.ld 1150.o
m68k-elf/ld/ld-new: warning: cannot find entry symbol RAM; defaulting to 00000000
1150.o: In function `foo':
1150.c:(.text+0x6): undefined reference to `RAM'
m68k-elf/ld/ld-new: BFD 2.17.50 20061218 internal error, aborting at
../../src/bfd/elflink.c line 6991 in elf_link_output_extsym
m68k-elf/ld/ld-new: Please report this bug.
which is less than enlightening :) This patch changes fold-name to give an
error when ADDR, LOADADDR or SIZEOF are given a non-existant section name. Am I
correct in thinking that lang_output_section_find only returns non-null when the
section is not mentioned in the output script (it doesn't return NULL when the
section is not output). with this patch we get:
expr1.t:13: undefined section `ram' referenced in expression
tested on m68k-elf, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1150.patch
Type: text/x-patch
Size: 4944 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20061218/c8e320b6/attachment.bin>
More information about the Binutils
mailing list