[PATCH] D70421: Initialize global vectors with invalid members to catch uninitialization errors

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 23:00:21 PST 2019


ruiu created this revision.
ruiu added reviewers: blackhole12, MaskRay, grimar.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added subscribers: peter.smith, thakis.

If you are using lld as a library, and if you are calling lld more than
once in your process, you may encounter a problem that lld runs correctly
only on the first run. This is often caused by global vectors that are
not emptied on each linker invocation.

This patch initializes global vectors with nullptr elements so that
we need to reset them even for the first run of the linker to make
it easy to catch errors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70421

Files:
  lld/COFF/Driver.cpp
  lld/COFF/InputFiles.cpp
  lld/COFF/Writer.cpp
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/InputSection.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70421.229976.patch
Type: text/x-patch
Size: 3818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191119/0e7926c2/attachment.bin>


More information about the llvm-commits mailing list