[MC] .addrsig_sym: ignore unregistered symbols
.addrsig_sym forces registering the symbol regardless whether it is otherwise registered. This creates an undefined symbol which is inconvenient/undesired: * `extern int x; void f() { (void)x; }` has inconsistent behavior whether `x` is emitted as an undefined symbol. `-O0 -faddrsig` makes `x` undefined while other -O levels and -fno-addrsig eliminate the symbol. * In ThinLTO, after a non-prevailing linkonce_odr definition is converted to available_externally, and then a declaration, the addrsig code emits a symbol while the symbol is otherwise unseen. D135427 fixed a bug that a non-prevailing `__cxx_global_var_init` was incorrectly retained. However, the IR declaration causes an undesired `.addrsig_sym __cxx_global_var_init`. This can be addressed in a way similar to D101512 (`isTransitiveUsedByMetadataOnly`) but the increased `OutStreamer->emitAddrsigSym(getSymbol(&GV));` complexity makes me nervous. Just ignoring unregistered symbols circumvents the problem. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D135642
Loading
Please sign in to comment