1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-06 01:28:12 +03:00

[ELF] Ignore dead FDE entries

Looks like some CUDA object files contains FDEs whose relocation has
r_sym with value 0. Such FDEs are dead and should be ignored.

Unfortunately, there's no easy way to produce an object file containing
such relocation, so this change lacks a testcase.

Fixes https://github.com/rui314/mold/issues/235
This commit is contained in:
Rui Ueyama 2022-01-04 13:32:25 +09:00
parent 70704c7c09
commit 8ffe4cd472

View File

@ -342,7 +342,7 @@ void ObjectFile<E>::read_ehframe(Context<E> &ctx, InputSection<E> &isec) {
cies.push_back(CieRecord<E>(ctx, *this, isec, begin_offset, rel_begin));
} else {
// This is FDE.
if (rel_begin == rel_idx) {
if (rel_begin == rel_idx || rels[rel_begin].r_sym == 0) {
// FDE has no valid relocation, which means FDE is dead from
// the beginning. Compilers usually don't create such FDE, but
// `ld -r` tend to generate such dead FDEs.