Fangrui Song
40a42f9f3f
[ELF] Make SORT_INIT_PRIORITY support .ctors.N
...
Input sections `.ctors/.ctors.N` may go to either the output section `.init_array` or the output section `.ctors`:
* output `.ctors`: currently we sort them by name. This patch changes to sort by priority from high to low. If N in `.ctors.N` is in the form of %05u, there is no semantic difference. Actually GCC and Clang do use %05u. (In the test `ctors_dtors_priority.s` and Gold's test `gold/testsuite/script_test_14.s`, we can see %03u, but they are not really produced by compilers.)
* output `.init_array`: users can provide an input section description `SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*)` to mix `.init_array.*` and `.ctors.*`. This can make .init_array.N and .ctors.(65535-N) interchangeable.
With this change, users can mix `.ctors.N` and `.init_array.N` in `.init_array` (PR44698 and PR48096) with linker scripts. As an example:
```
SECTIONS {
.init_array : {
*(SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*))
*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)
}
} INSERT AFTER .fini_array;
SECTIONS {
.fini_array : {
*(SORT_BY_INIT_PRIORITY(.fini_array.* .dtors.*))
*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)
}
} INSERT BEFORE .init_array;
```
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D91187
2020-11-12 08:56:12 -08:00
..
2020-07-28 21:18:01 +01:00
2020-03-05 09:59:53 -08:00
2020-03-19 19:11:11 -07:00
2019-09-16 07:05:34 +00:00
2019-04-20 10:50:27 +00:00
2020-03-15 17:48:36 -07:00
2020-02-12 21:54:50 -08:00
2020-04-02 01:21:36 +09:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-05 09:59:53 -08:00
2020-03-05 09:59:53 -08:00
2020-03-19 19:11:11 -07:00
2019-03-15 01:29:57 +00:00
2020-03-04 10:48:36 -08:00
2019-05-01 05:49:01 +00:00
2019-09-24 21:44:14 +00:00
2019-09-24 21:44:14 +00:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2020-01-06 10:25:48 -08:00
2020-03-15 17:48:36 -07:00
2020-02-12 21:54:50 -08:00
2020-05-04 08:07:34 -07:00
2019-05-01 05:49:01 +00:00
2020-03-19 19:11:11 -07:00
2020-02-12 21:54:50 -08:00
2019-05-16 23:33:06 +00:00
2020-08-20 16:05:27 -07:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2020-08-06 08:27:15 -07:00
2020-02-19 22:01:42 -08:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2020-03-23 10:30:06 -07:00
2019-05-01 05:49:01 +00:00
2020-07-28 21:18:01 +01:00
2019-05-01 05:49:01 +00:00
2020-02-12 21:54:50 -08:00
2020-02-12 21:54:50 -08:00
2020-02-12 21:54:50 -08:00
2020-02-12 21:54:50 -08:00
2020-02-12 21:54:50 -08:00
2020-07-24 11:38:26 +03:00
2020-03-15 17:48:36 -07:00
2019-12-26 09:54:22 -08:00
2019-11-19 08:54:06 -08:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2019-06-03 05:34:25 +00:00
2020-02-12 21:54:50 -08:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-03-19 18:04:47 -07:00
2019-05-01 05:49:01 +00:00
2019-09-26 17:10:09 +00:00
2020-03-04 10:48:36 -08:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-17 12:58:24 -07:00
2020-02-12 21:54:50 -08:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2020-02-26 10:32:54 -08:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2019-06-28 10:14:14 +00:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2020-05-04 08:07:34 -07:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2020-11-12 08:53:11 -08:00
2020-03-05 18:05:28 -08:00
2020-02-12 21:54:50 -08:00
2020-03-04 10:48:36 -08:00
2020-03-19 19:11:11 -07:00
2020-03-19 19:11:11 -07:00
2020-03-19 19:11:11 -07:00
2020-01-22 12:03:10 +00:00
2019-07-10 14:36:48 +00:00
2020-02-12 21:54:50 -08:00
2019-05-01 05:49:01 +00:00
2019-05-01 06:02:16 +00:00
2020-02-12 21:54:50 -08:00
2020-03-23 10:30:06 -07:00
2020-02-12 21:54:50 -08:00
2020-04-30 20:14:22 +01:00
2020-03-15 17:48:36 -07:00
2020-04-22 12:34:20 -07:00
2020-03-15 17:48:36 -07:00
2020-02-12 08:21:52 -08:00
2020-02-12 08:21:52 -08:00
2020-02-12 21:54:50 -08:00
2020-02-12 08:21:52 -08:00
2020-02-12 21:54:50 -08:00
2019-05-01 05:49:01 +00:00
2020-03-16 07:42:04 -07:00
2020-02-12 21:54:50 -08:00
2020-03-23 10:30:06 -07:00
2020-03-30 15:17:29 -07:00
2020-08-17 11:29:05 -07:00
2020-03-11 09:35:42 -07:00
2020-06-19 09:11:33 -07:00
2020-04-01 08:19:06 -07:00
2020-02-12 21:54:50 -08:00
2020-04-01 08:19:06 -07:00
2020-03-15 17:48:36 -07:00
2020-02-12 21:54:50 -08:00
2020-04-01 08:19:06 -07:00
2018-12-06 09:04:52 +00:00
2020-03-23 10:30:06 -07:00
2020-02-08 22:45:00 -08:00
2020-02-12 21:54:50 -08:00
2020-03-09 08:31:41 -07:00
2019-08-09 01:25:49 +00:00
2020-03-06 14:01:20 -08:00
2020-03-06 14:01:20 -08:00
2020-03-15 17:48:36 -07:00
2020-08-18 09:03:01 -07:00
2020-03-09 08:31:41 -07:00
2020-03-19 19:11:11 -07:00
2020-03-15 17:48:36 -07:00
2019-09-24 11:48:31 +00:00
2020-03-19 19:11:11 -07:00
2020-03-19 19:11:11 -07:00
2020-03-15 17:48:36 -07:00
2019-05-01 06:02:16 +00:00
2019-05-13 16:01:26 +00:00
2018-12-06 08:34:52 +00:00
2020-05-04 08:07:34 -07:00
2020-08-03 20:42:09 -07:00
2020-03-04 10:48:36 -08:00
2020-03-05 18:05:28 -08:00
2020-08-25 13:05:17 +03:00
2020-03-19 19:11:11 -07:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2020-07-27 12:16:43 +03:00
2020-03-19 19:11:11 -07:00
2019-05-01 05:49:01 +00:00
2019-04-30 12:27:06 +00:00
2019-04-23 12:38:52 +00:00
2020-03-23 10:30:06 -07:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2019-03-01 18:53:41 +00:00
2020-03-12 08:00:18 -07:00
2020-02-21 08:12:00 -08:00
2020-03-19 19:11:11 -07:00
2020-02-12 21:54:50 -08:00
2020-02-12 21:54:50 -08:00
2020-04-01 08:19:06 -07:00
2019-05-01 05:49:01 +00:00
2020-03-04 10:48:36 -08:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2020-08-25 13:05:17 +03:00
2019-05-01 05:49:01 +00:00
2019-01-22 09:35:47 +00:00
2020-03-04 10:48:36 -08:00
2019-05-01 05:49:01 +00:00
2019-04-22 07:57:07 +00:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-03-19 19:11:11 -07:00
2020-03-15 17:48:36 -07:00
2020-03-19 19:11:11 -07:00
2020-03-11 09:35:42 -07:00
2020-03-11 09:35:42 -07:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2019-01-28 15:03:47 +00:00
2020-03-15 17:48:36 -07:00
2020-03-19 19:11:11 -07:00
2020-08-18 09:03:01 -07:00
2020-03-19 12:49:25 +03:00
2020-08-18 09:03:01 -07:00
2019-02-05 21:01:01 +00:00
2020-03-04 10:48:36 -08:00
2020-03-19 19:11:11 -07:00
2020-11-12 08:53:11 -08:00
2020-11-12 08:56:12 -08:00
2020-03-15 17:48:36 -07:00
2019-03-14 03:47:45 +00:00
2020-03-15 17:48:36 -07:00
2020-04-02 01:21:36 +09:00
2019-05-01 05:49:01 +00:00
2020-03-23 10:30:06 -07:00
2019-08-26 10:23:31 +00:00
2019-08-26 10:23:31 +00:00
2020-08-20 16:05:27 -07:00
2020-03-04 10:48:36 -08:00
2019-05-31 08:20:43 +00:00
2020-03-04 10:48:36 -08:00
2020-03-04 12:22:12 -08:00
2019-05-01 05:49:01 +00:00
2020-03-15 17:48:36 -07:00
2019-05-02 00:39:03 +00:00
2020-03-05 09:59:53 -08:00
2020-03-05 09:59:53 -08:00
2020-08-18 09:03:01 -07:00
2020-03-05 09:59:53 -08:00
2020-03-19 19:11:11 -07:00
2020-03-05 09:59:53 -08:00
2020-03-05 09:59:53 -08:00
2019-05-01 05:49:01 +00:00
2020-05-02 22:49:23 +01:00
2019-05-01 06:02:16 +00:00
2020-03-04 10:48:36 -08:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2020-03-15 17:48:36 -07:00
2019-05-01 05:49:01 +00:00
2020-02-12 21:54:50 -08:00
2019-06-11 12:59:30 +00:00
2020-03-15 17:48:36 -07:00
2020-11-12 08:46:53 -08:00