Nathan Lanza
2f65166056
[lld:elf] Weaken the requirement for a computed binding to be STB_LOCAL
...
Given the following scenario:
```
// Cat.cpp
struct Animal { virtual void makeNoise() const = 0; };
struct Cat : Animal { void makeNoise() const override; };
extern "C" int puts(char const *);
void Cat::makeNoise() const { puts("Meow"); }
void doThingWithCat(Animal *a) { static_cast<Cat *>(a)->makeNoise(); }
// CatUser.cpp
struct Animal { virtual void makeNoise() const = 0; };
struct Cat : Animal { void makeNoise() const override; };
void doThingWithCat(Animal *a);
void useDoThingWithCat() {
Cat *d = new Cat;
doThingWithCat(d);
}
// cat.ver
{
global: _Z17useDoThingWithCatv;
local: *;
};
$ clang++ Cat.cpp CatUser.cpp -fpic -flto=thin -fwhole-program-vtables
-shared -O3 -fuse-ld=lld -Wl,--lto-whole-program-visibility
-Wl,--version-script,cat.ver
```
We cannot devirtualize `Cat::makeNoise`. The issue is complex:
Due to `-fsplit-lto-unit` and usage of type metadata, we place the Cat
vtable declaration into module 0 and the Cat vtable definition with type
metadata into module 1, causing duplicate entries (Undefined followed by
Defined) in the `lto::InputFile::symbols()` output.
In `BitcodeFile::parse`, after processing the `Undefined` then the
`Defined`, the final state is `Defined`.
In `BitcodeCompiler::add`, for the first symbol, `computeBinding`
returns `STB_LOCAL`, then we reset it to `Undefined` because it is
prevailing (`versionId` is `preserved`). For the second symbol, because
the state is now `Undefined`, `computeBinding` returns `STB_GLOBAL`,
causing `ExportDynamic` to be true and suppressing devirtualization.
In D77280, the `computeBinding` change used a stricter `isDefined()`
condition to make weak``Lazy` symbol work.
This patch relaxes the condition to weaker `!isLazy()` to keep it
working while making the devirtualization work as well.
Differential Revision: https://reviews.llvm.org/D98686
2021-05-24 23:32:21 -04:00
..
2021-05-22 17:48:45 -07:00
2021-01-21 10:36:48 +03:00
2021-04-16 12:18:46 -07:00
2021-05-24 23:32:21 -04:00
2021-02-08 08:55:29 -08:00
2021-02-08 08:55:29 -08:00
2020-04-10 09:21:09 -07:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-09-21 12:09:17 -07:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-09-21 12:09:17 -07:00
2020-12-16 09:20:55 -08:00
2021-02-08 08:55:29 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2021-02-08 08:55:29 -08:00
2021-02-13 10:32:27 -08:00
2021-01-26 12:01:38 +00:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-04-10 09:21:09 -07:00
2021-02-13 10:32:27 -08:00
2020-12-16 09:20:55 -08:00
2021-02-08 13:44:30 -08:00
2021-02-08 08:55:29 -08:00
2020-06-23 16:10:07 -07:00
2021-02-08 08:55:29 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-09-21 12:09:17 -07:00
2020-09-21 12:09:17 -07:00
2020-12-16 09:20:55 -08:00
2021-02-12 21:00:42 -08:00
2020-12-21 08:47:04 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2020-12-16 09:20:55 -08:00
2021-02-07 15:47:10 -08:00
2021-05-11 12:48:29 +07:00
2020-10-14 13:04:27 -04:00
2021-03-24 11:54:05 -04:00
2020-10-14 13:04:27 -04:00
2020-10-14 13:04:27 -04:00
2020-10-14 13:04:27 -04:00
2021-02-13 10:32:27 -08:00
2021-03-24 13:41:10 -04:00
2021-01-29 07:16:30 -05:00
2020-12-14 12:03:00 +03:00
2020-04-08 12:43:44 +01:00
2020-04-09 10:33:02 +01:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-10-22 09:48:19 -07:00
2020-12-14 12:03:00 +03:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-28 18:58:40 +07:00
2020-04-18 08:19:45 -07:00
2020-05-11 14:27:13 +01:00
2020-08-10 18:08:07 +01:00
2020-04-24 13:47:28 +01:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-12-14 12:03:00 +03:00
2021-02-13 10:32:27 -08:00
2020-12-14 12:03:00 +03:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2021-05-07 12:13:36 +02:00
2020-08-19 22:49:04 -07:00
2020-04-18 08:19:45 -07:00
2020-06-01 10:19:41 -07:00
2020-12-14 12:03:00 +03:00
2020-04-18 08:19:45 -07:00
2021-02-13 10:32:27 -08:00
2020-12-14 12:03:00 +03:00
2020-04-18 08:19:45 -07:00
2020-08-19 22:49:04 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-08-20 16:05:27 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2021-02-01 20:52:33 -08:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-22 12:55:26 +01:00
2020-09-21 12:09:17 -07:00
2020-12-14 12:03:00 +03:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-20 13:59:05 +01:00
2021-03-02 11:02:33 +00:00
2020-04-18 08:19:45 -07:00
2021-03-04 11:15:57 +00:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-12-14 12:03:00 +03:00
2020-12-21 08:47:04 -08:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2020-04-18 08:19:45 -07:00
2021-02-13 10:32:27 -08:00
2021-04-16 11:12:29 +02:00
2020-07-12 18:18:54 +02:00
2020-07-31 11:50:55 -07:00
2020-07-31 11:50:55 -07:00
2020-07-31 11:50:55 -07:00
2021-01-29 07:16:30 -05:00
2021-05-14 09:40:32 -07:00
2021-02-07 15:47:10 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-12 21:00:42 -08:00
2021-05-22 17:48:45 -07:00
2021-05-22 17:48:45 -07:00
2021-05-22 17:48:45 -07:00
2021-05-22 17:48:45 -07:00
2021-03-08 08:13:08 -06:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-12-12 16:50:25 -08:00
2021-02-13 10:32:27 -08:00
2020-08-06 15:30:08 -07:00
2020-08-06 15:30:08 -07:00
2020-08-06 15:30:08 -07:00
2020-08-06 15:30:08 -07:00
2020-08-06 15:30:08 -07:00
2020-08-06 15:30:08 -07:00
2021-02-12 21:00:42 -08:00
2020-08-03 16:59:13 -07:00
2021-02-07 15:47:10 -08:00
2020-07-23 08:16:01 -07:00
2020-12-14 12:03:00 +03:00
2020-06-10 14:06:30 +01:00
2021-02-12 21:00:42 -08:00
2021-02-13 10:32:27 -08:00
2020-10-22 09:48:19 -07:00
2020-05-15 11:07:25 -07:00
2021-02-12 21:00:42 -08:00
2021-01-05 19:51:11 -08:00
2021-04-15 15:06:20 +04:00
2020-07-02 15:51:33 +01:00
2020-07-02 15:51:33 +01:00
2020-05-15 11:07:25 -07:00
2020-08-13 08:14:45 -07:00
2021-04-29 08:51:09 -07:00
2020-08-07 22:08:44 -07:00
2021-02-12 21:00:42 -08:00
2020-05-15 11:07:25 -07:00
2021-02-07 15:47:10 -08:00
2021-01-30 00:51:36 -08:00
2021-02-09 00:43:10 -08:00
2020-12-14 09:38:12 -08:00
2021-01-02 12:18:05 -06:00
2020-04-17 08:12:15 -07:00
2020-11-09 13:28:48 +01:00
2020-11-03 11:01:29 +01:00
2021-01-22 19:07:02 -08:00
2020-05-15 11:07:25 -07:00
2020-05-15 11:07:25 -07:00
2020-06-17 17:12:10 -07:00
2021-02-13 10:32:27 -08:00
2020-04-10 17:00:12 -07:00
2021-02-16 14:33:09 -08:00
2020-10-21 10:11:26 -07:00
2021-02-05 21:35:27 -08:00
2021-04-16 12:18:46 -07:00
2021-03-09 09:59:47 -08:00
2021-02-12 21:00:42 -08:00
2021-04-16 12:18:46 -07:00
2020-11-12 09:59:43 -08:00
2020-07-03 09:50:30 -07:00
2020-08-27 12:28:51 +01:00
2020-08-13 09:11:01 -07:00
2020-10-20 09:35:32 -07:00
2020-07-09 19:15:31 +07:00
2020-04-29 15:04:13 -07:00
2020-05-15 11:07:25 -07:00
2021-01-12 00:07:28 -08:00
2021-02-12 21:00:42 -08:00
2020-04-18 08:19:45 -07:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2021-02-13 10:32:27 -08:00
2020-06-01 10:19:41 -07:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-12-14 12:03:00 +03:00
2021-03-18 10:18:19 -07:00
2021-02-13 10:32:27 -08:00
2020-08-25 08:05:39 -07:00
2020-04-13 19:32:44 -05:00
2020-05-05 11:47:51 -05:00
2020-12-14 12:03:00 +03:00
2020-06-09 11:27:34 -07:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-06-01 10:19:41 -07:00
2020-12-21 08:47:04 -08:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-12-21 08:47:04 -08:00
2020-12-14 12:03:00 +03:00
2020-12-21 08:47:04 -08:00
2020-08-07 22:08:44 -07:00
2020-10-15 12:43:14 +01:00
2021-02-05 09:37:37 -08:00
2021-02-13 10:32:27 -08:00
2020-07-14 16:35:17 +07:00
2021-02-13 10:32:27 -08:00
2020-06-10 14:06:30 +01:00
2021-02-08 10:34:57 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-07-03 13:08:56 +01:00
2020-10-28 08:56:42 -07:00
2020-08-17 11:29:05 -07:00
2020-05-04 14:25:25 +01:00
2020-11-03 11:01:29 +01:00
2020-06-01 10:19:41 -07:00
2021-02-07 15:47:10 -08:00
2020-04-15 08:00:50 -07:00
2021-02-13 10:32:27 -08:00
2020-09-21 18:38:19 +03:00
2021-02-28 16:53:41 -08:00
2020-08-27 10:38:42 +01:00
2020-08-27 10:38:42 +01:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2021-02-07 15:47:10 -08:00
2020-12-14 12:03:00 +03:00
2021-02-13 10:32:27 -08:00
2021-02-07 15:47:10 -08:00
2021-02-07 15:47:10 -08:00
2020-12-14 12:03:00 +03:00
2020-07-20 12:17:49 +03:00
2021-02-17 23:17:20 -08:00
2021-02-13 10:32:27 -08:00
2020-06-02 11:44:11 +03:00
2020-12-14 12:03:00 +03:00
2021-04-27 19:04:50 +01:00
2021-02-17 23:17:20 -08:00
2021-02-17 23:17:20 -08:00
2021-02-17 23:17:20 -08:00
2021-04-27 19:04:50 +01:00
2021-02-04 09:17:47 -08:00
2020-08-05 09:10:01 -07:00
2020-08-05 09:10:01 -07:00
2021-02-13 10:32:27 -08:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-06-01 10:19:41 -07:00
2020-06-01 10:19:41 -07:00
2021-01-02 12:18:05 -06:00
2020-06-01 10:19:41 -07:00
2021-01-17 00:02:13 -08:00
2021-01-02 12:18:05 -06:00
2021-04-30 17:19:45 -07:00
2021-04-30 17:19:45 -07:00
2021-04-30 17:19:45 -07:00
2020-08-17 09:09:36 -05:00
2021-03-04 13:27:46 -05:00
2021-04-05 09:13:20 -05:00
2020-08-17 09:09:36 -05:00
2021-02-12 21:00:42 -08:00
2021-02-12 21:00:42 -08:00
2020-07-09 12:39:24 -05:00
2020-08-17 09:36:09 -05:00
2020-08-17 09:09:36 -05:00
2021-04-05 09:13:20 -05:00
2020-08-17 09:09:36 -05:00
2021-02-13 10:32:27 -08:00
2020-12-21 08:47:04 -08:00
2020-08-17 09:09:36 -05:00
2021-03-04 13:27:46 -05:00
2021-03-04 13:27:46 -05:00
2021-03-04 13:27:46 -05:00
2021-03-04 13:27:46 -05:00
2021-03-04 13:27:46 -05:00
2021-02-07 15:47:10 -08:00
2020-09-22 07:37:54 -05:00
2021-03-04 13:27:46 -05:00
2021-05-06 12:00:04 -05:00
2020-09-22 07:37:54 -05:00
2020-08-28 10:40:48 -05:00
2021-03-04 13:27:46 -05:00
2020-08-17 09:09:36 -05:00
2020-07-13 15:18:30 +03:00
2021-01-19 11:42:53 -08:00
2021-01-19 11:42:51 -08:00
2021-01-19 11:42:53 -08:00
2021-04-05 09:13:20 -05:00
2020-07-29 13:01:31 -07:00
2020-06-23 14:59:19 -05:00
2021-01-19 11:42:51 -08:00
2020-05-26 09:35:41 -07:00
2020-05-26 09:35:41 -07:00
2020-05-26 09:35:41 -07:00
2020-05-26 09:35:41 -07:00
2020-05-26 09:35:41 -07:00
2021-04-05 09:13:20 -05:00
2021-04-05 09:13:20 -05:00
2021-03-22 13:15:44 -05:00
2021-04-05 09:13:20 -05:00
2021-04-05 09:13:20 -05:00
2021-04-05 09:13:20 -05:00
2021-02-07 15:47:10 -08:00
2021-02-07 15:47:10 -08:00
2021-03-04 13:27:46 -05:00
2021-03-04 13:27:46 -05:00
2020-04-30 09:16:51 -07:00
2020-08-17 09:09:36 -05:00
2020-08-17 09:09:36 -05:00
2020-04-10 09:21:09 -07:00
2021-02-13 10:32:27 -08:00
2020-04-29 18:04:37 -07:00
2020-12-14 12:03:00 +03:00
2020-06-01 10:19:41 -07:00
2020-07-13 13:59:54 +03:00
2021-05-22 17:48:45 -07:00
2021-02-07 15:47:10 -08:00
2021-04-16 12:18:46 -07:00
2021-02-13 10:32:27 -08:00
2020-12-14 12:03:00 +03:00
2021-02-13 10:32:27 -08:00
2020-04-10 09:21:09 -07:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-12-14 12:03:00 +03:00
2020-04-09 16:06:55 +01:00
2021-01-29 07:16:30 -05:00
2020-04-27 14:01:37 -04:00
2021-02-11 13:29:41 -08:00
2020-04-09 16:06:55 +01:00
2020-04-09 16:06:55 +01:00
2020-04-09 16:06:55 +01:00
2020-04-09 16:06:55 +01:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-09-05 18:36:23 +01:00
2020-12-04 10:34:12 -08:00
2020-06-01 10:19:41 -07:00
2020-06-01 10:19:41 -07:00
2020-12-04 10:34:12 -08:00
2021-04-30 17:19:45 -07:00
2021-04-30 17:19:45 -07:00
2020-12-21 08:47:04 -08:00
2020-12-04 10:34:12 -08:00
2020-11-02 08:37:15 -08:00
2020-05-15 11:07:25 -07:00
2020-06-01 10:19:41 -07:00
2021-03-18 10:18:19 -07:00
2021-03-18 10:18:19 -07:00
2020-07-07 09:48:13 -07:00
2020-05-15 11:07:25 -07:00
2020-04-17 08:12:15 -07:00
2020-04-17 08:12:15 -07:00
2021-05-22 17:48:45 -07:00
2021-02-13 10:32:27 -08:00
2020-06-23 15:59:59 -07:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-01-29 07:16:30 -05:00
2021-02-13 10:32:27 -08:00
2020-12-01 08:59:54 -08:00
2020-12-09 12:14:00 -08:00
2020-09-24 15:02:48 -07:00
2020-08-17 10:00:31 -07:00
2020-04-21 07:56:35 -07:00
2021-01-25 09:58:56 +00:00
2020-12-21 08:47:04 -08:00
2020-05-19 08:56:35 -07:00
2021-05-22 17:48:45 -07:00
2021-02-12 21:00:42 -08:00
2021-02-13 10:32:27 -08:00
2020-11-24 08:51:58 -05:00
2020-06-05 08:44:38 -07:00
2020-11-17 12:20:57 -08:00
2021-02-13 10:32:27 -08:00
2020-05-23 09:55:48 -07:00
2021-02-13 10:32:27 -08:00
2020-06-05 15:59:54 -07:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2021-04-20 11:23:10 -07:00
2021-02-13 10:32:27 -08:00
2021-02-13 10:32:27 -08:00
2020-12-07 10:09:19 -05:00
2020-10-08 08:31:34 -07:00
2021-01-22 09:20:29 -08:00
2021-04-17 00:29:51 -07:00
2021-02-13 10:32:27 -08:00
2020-07-29 14:10:38 +01:00
2021-01-22 09:20:29 -08:00
2020-05-27 16:58:00 -07:00
2020-10-22 09:48:19 -07:00
2020-12-30 09:16:26 -08:00
2020-11-30 08:30:19 -08:00
2020-12-18 23:38:38 +00:00
2021-02-13 10:32:27 -08:00
2021-05-14 10:38:40 -07:00
2020-11-07 20:19:21 -08:00
2020-08-11 08:06:36 -07:00
2020-04-14 13:21:49 +03:00
2021-02-13 10:32:27 -08:00
2020-04-21 15:39:31 -07:00
2020-12-14 12:03:00 +03:00
2021-05-17 00:13:00 +01:00