[PATCH] D43819: [ELF] - Restrict section offsets that exceeds file size.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 07:39:26 PST 2018


jhenderson added a comment.

> Also, assuming the intended behaviour is that the section can start at the end of the file, if it is empty or NOBITS, I think the Overflow check is slightly wrong. If a NOBITS or empty section starts at the very end of the file (i.e. Sec->Offset == FileSize), it will be treated as overflowing as things stand.

You've only addressed this comment for NOBITS sections and not empty sections. As things stand, an empty section at the very end of the file will cause an error. Similarly, any regular section that has a size such that it terminates at exactly the end of the file will have problems.



================
Comment at: test/ELF/linkerscript/sections-va-overflow.test:3
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/sections-va-overflow.s -o %t.o
+# RUN: not ld.lld -o %t.so --script %s %t.o 2>&1 | FileCheck %s -check-prefix=ERR
+
----------------
Nit: Don't use .so filename without -shared, or somebody is likely to get misled!


https://reviews.llvm.org/D43819





More information about the llvm-commits mailing list