[PATCH] D141082: [lld] Prevent assertions for aliases to weak_def_can_be_hidden symbols

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 12:00:14 PST 2023


int3 added a comment.

Okay so I looked into this a bit more and I don't think there are actually section-based aliases. Creating an alias to a Defined symbol (i.e. defined in the current object file) causes llvm-mc to emit a regular non-aliasing section symbol. Your `sym.n_type & N_INDR` check is not doing what you think it is -- `n_type` is not a set of disjoint flags, but a bunch of overlapping values. `sym.n_type & N_INDR` happens to be true for `n_type == N_SECT`, but that doesn't mean `n_type` is an alias.

So I think we should just delete the assertion, and keep the test as-is (with an update to the comment)



================
Comment at: lld/test/MachO/weak-def-can-be-hidden.s:119
 
+# A private alias to a weak_def_can_be_hidden symbol should not raise an error or assertion
+.set l_foo, _foo
----------------
maybe something like "an alias is the only way to get llvm-mc to set `.weak_def_can_be_hidden` on an already-hidden symbol. Verify that LLD can handle these double-hidden symbols gracefully"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141082/new/

https://reviews.llvm.org/D141082



More information about the llvm-commits mailing list