[PATCH] D41046: [ELF] Make overlapping output sections an error

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 08:26:44 PST 2017


Alexander Richardson via Phabricator <reviews at reviews.llvm.org> writes:

> +# LLD used to accept overlapping sections and create binaries that potentially
> +# crash at runtime while ld.bfd gives the following error:
> +# ld.bfd: section .sec2 [0000000000008080 -> 000000000000817f] overlaps section .sec1 [0000000000008000 -> 00000000000080ff]

It is clear what this is testing, so I would probably drop the comment.

> +# check that we create the expected binary with --noinhibit-exec:

I don't think we have any tests for what the output of --noinhibit-exec
looks like. Please reduce this to just show that a file is created (rm
it before lld, check that it exists after).

> +# Finally check the case where both LMA and vaddr overlap

This also seems excessive.

> +# RUN: not ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared 2>&1 | FileCheck %s -check-prefix BOTH-OVERLAP-ERR
> +
> +# FIXME: we should not be creating binaries where file offsets overlap!

Why are we?

> +// TODO: this is quite similar to clang::tooling::Range, maybe there should be
> +// a class in LLVM that can be used by both

I agree that this seems a bit much in lld. I would suggest adding a
Range struct to llvm's ADT and using that in clang and lld.

Cheers,
Rafael


More information about the llvm-commits mailing list