[PATCH] D109386: Change to use ValueHandle for associated data of GlobalCtors

2021-09-08 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. In D109386#2990606 , @wlei wrote: > I think this is what we desire. Do you think this can cause other issues or > anything I missed? I forgot to mention, yes, sounds good, I see, it is only weak when the value is erased without bei

[PATCH] D109386: Change to use ValueHandle for associated data of GlobalCtors

2021-09-08 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. In D109386#2990606 , @wlei wrote: > Not swift, it seems this use-after-free needs a large program to repro, I > tried to simplify it but failed to expose it by small program. If you use an ASan build to detect the use-after-free, yo

[PATCH] D109386: Change to use ValueHandle for associated data of GlobalCtors

2021-09-08 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. It shouldn't need a large program to duplicate, but the test will need to exercise some unusual, arguably invalid conditions. We need to add an entry with associated data to `GlobalCtors` or `GlobalDtors` and then replace the associated data. We only actually use asso

[PATCH] D109386: Change to use ValueHandle for associated data of GlobalCtors

2021-09-08 Thread Lei Wang via Phabricator via cfe-commits
wlei added a comment. In D109386#2990504 , @rnk wrote: > This seems incorrect: a weak VH won't have the same semantics, it will just > drop the comdat associativity when the underlying global changes type. @rnk Thanks. Here I tried to use `WeakTrackingV

[PATCH] D109386: Change to use ValueHandle for associated data of GlobalCtors

2021-09-08 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. This seems incorrect: a weak VH won't have the same semantics, it will just drop the comdat associativity when the underlying global changes type. BTW, can this be tested, or is this only possible when clang is being used as a library, perhaps as in swift? Repository: r