HomePhabricator

ThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is converted to a…

Authored by MaskRay on Feb 15 2020, 5:23 PM.

Description

ThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is converted to a declaration

If we infer the dso_local flag for -fpic, dso_local should be dropped
when we convert a GlobalVariable a declaration. dso_local causes the
generation of direct access (e.g. R_X86_64_PC32). Such relocations referencing
STB_GLOBAL STV_DEFAULT objects are not allowed in a -shared link.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D74749