diff options
author | Rui Ueyama <ruiu@google.com> | 2013-11-18 03:50:50 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-11-18 03:50:50 +0000 |
commit | 2bafe7353e30d120573ebca0dfbb9eeb92d66770 (patch) | |
tree | ff6080cb2bb3d8fbd3fb2ad6c567b5d22890781c | |
parent | 101d3452278ab7d9852c86decaf2665d47812f8d (diff) | |
download | bcm5719-llvm-2bafe7353e30d120573ebca0dfbb9eeb92d66770.tar.gz bcm5719-llvm-2bafe7353e30d120573ebca0dfbb9eeb92d66770.zip |
Add an assert for NativeReferenceIvarsV1.
The maximum number of references the file with NativeReferenceIvarsV1 can
contain is 65534. If a file larger than that is converted to Native format,
the conversion will fail without any error message. This caused a subtle bug
that the LLD would produce a broken executable only when input files contain
too many references.
This issue exists since the RoundTripNativeTest is introduced in r193585. Since
then, it seems that nobody have linked any program having more than 65534
relocations with the LLD. Otherwise we would have found it earlier.
llvm-svn: 194987
-rw-r--r-- | lld/lib/ReaderWriter/Native/WriterNative.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/Native/WriterNative.cpp b/lld/lib/ReaderWriter/Native/WriterNative.cpp index 45846b5bd9a..876e64eac57 100644 --- a/lld/lib/ReaderWriter/Native/WriterNative.cpp +++ b/lld/lib/ReaderWriter/Native/WriterNative.cpp @@ -18,6 +18,7 @@ #include "NativeFileFormat.h" +#include <limits> #include <vector> namespace lld { @@ -404,6 +405,7 @@ private: } uint32_t result = _targetsTableIndex.size(); _targetsTableIndex[target] = result; + assert(result < NativeReferenceIvarsV1::noTarget); return result; } |