Created attachment 6555 [details]
The attached test case was constructed via some assembly files from the ARM ld testsuite. The only real change I made was to take the linker script from `arm-none-eabi-ld --verbose` and comment out the output section description for '.rel.plt'.
The problem can be reproduced as follows (with binutils built from HEAD):
$ tar xvfj arm-none-eabi-no-rel-plt-crash.tar.bz2
arm-none-eabi-as -o arm-app.o arm-app.s
arm-none-eabi-as -o arm-lib.o arm-lib.s
arm-none-eabi-ld -shared -o arm-lib.so arm-lib.o
arm-none-eabi-ld -o arm-app -T my.ld arm-app.o arm-lib.so
arm-none-eabi-ld: BFD (GNU Binutils) 188.8.131.5220724 assertion fail /home/meadori/Code/src/binutils/bfd/elf32-arm.c:14086
make: *** [arm-app] Segmentation fault (core dumped)
make: *** Deleting file `arm-app'
Created attachment 6556 [details]
Convert assertion into an error message
Please could you try out the uploaded patch which converts the assertion into an error message.
Created attachment 6557 [details]
Refreshed patch with test cases.
That fixed it and is much simpler than what I was trying to do.
The output should say "linker script" instead of "linker map", though.
Here is a refreshed patch with a few nits fixed plus test cases.
I ran the binutils suite and saw no regressions. I also tested the patch
against the original real world application that caused me to notice
this issue and the error message triggered as expected.
Thanks for coming up with a patch for this so quickly.
Module name: src
Changes by: email@example.com 2012-07-26 13:43:24
ld/testsuite : ChangeLog
bfd : ChangeLog elf32-arm.c
ld/testsuite/ld-arm: arm-no-rel-plt.ld arm-no-rel-plt.out
* elf32-arm.c (elf32_arm_finish_dynamic_sections): Report an error
if a required section is missing from the linker script.
* ld-arm/arm-elf.exp: Add tests of linking without .rel.plt.
* ld-arm/arm-no-rel-plt.out: Linker script without .rel.plt section.
* ld-arm/arm-no-rel-plt.out: Expected output.
> That fixed it and is much simpler than what I was trying to do.
> The output should say "linker script" instead of "linker map", though.
Doh - yes, sorry about that.
> Here is a refreshed patch with a few nits fixed plus test cases.
Thanks - I have applied your patch with one small change - I left the error message as one long line, rather than splitting it over two lines. The reason for doing this is that it makes it easier for the translators when converting the message into other languages.
On 07/26/2012 08:46 AM, nickc at redhat dot com wrote:
> Thanks - I have applied your patch with one small change