Avoiding segfaults in ld

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
Post Reply
xobs
Posts: 3
Joined: Thu Aug 29, 2013 10:19 am

Avoiding segfaults in ld

Post by xobs »

I'm using the version of ld from Debian's armhf "Wheezy" distribution ("GNU ld (GNU Binutils for Debian) 2.22"), and occasionally I would experience segfaults in ld when linking. I was able to track down a workaround after building a debug version of ld, but I'm still not sure why it's segfaulting in the first place.

I'm using ChibiOS with an STM32F101x8, so I've needed to create the ld script myself. Still, the following might be useful to anyone else experiencing random segfaults.

What solved my problem was adding the following to the SECTIONS definition:

Code: Select all

.rel.plt : { . = .; } > flash


I noticed that libbfd was looking for the section ".rel.plt" and was segfaulting on a NULL pointer when it couldn't find one in the hash table. My workaround is to create an "empty" entry in the hash table.

I don't know the scope of this problem, but here's the workaround in case anyone else is experiencing the same.
Post Reply