Commit 54dfada
committed
[LLD][ELF][RISCV] Handle .note.gnu.property sections for Zicfilp/Zicfiss features
RISC-V Zicfilp/Zicfiss features indicate their adoptions as bits in the
`.note.gnu.property` section of ELF files. This patch enables LLD to process
the information correctly by parsing, checking and merging the bits from all
input ELF files and writing the merged result to the output ELF file.
These feature bits are encoded as a mask in each input ELF files and intended
to be "and"-ed together to check that all input files support a particular
feature.
For RISC-V Zicfilp features, there are 2 conflicting bits allocated:
GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED and
GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG. They represent the adoption of
the forward edge protection of control-flow integrity with the "unlabeled" or
"func-sig" policy. Since these 2 policies conflicts with each other, these 2
bits also conflicts with each other. This patch adds the `-z
zicfilp-unlabeled-report=none|warning|error` and `-z
zicfilp-func-sig-report=none|warning|error` commandline options to make LLD
report files that do not have the expected bits toggled on.
For RISC-V Zicfiss feature, there's only one bit allocated:
GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS. This bit indicates that the ELF file
supports Zicfiss-based shadow stack. This patch adds the `-z
zicfiss-report=none|warning|error` commandline option to make LLD report files
that do not have the expected bit toggled on.1 parent 52ed679 commit 54dfada
File tree
7 files changed
+853
-16
lines changed- lld
- ELF
- test/ELF
7 files changed
+853
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
425 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
426 | 436 | | |
427 | 437 | | |
428 | 438 | | |
| |||
1637 | 1647 | | |
1638 | 1648 | | |
1639 | 1649 | | |
1640 | | - | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1641 | 1655 | | |
1642 | 1656 | | |
1643 | 1657 | | |
| |||
2831 | 2845 | | |
2832 | 2846 | | |
2833 | 2847 | | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
2834 | 2851 | | |
2835 | 2852 | | |
2836 | | - | |
| 2853 | + | |
2837 | 2854 | | |
2838 | 2855 | | |
2839 | 2856 | | |
| |||
2885 | 2902 | | |
2886 | 2903 | | |
2887 | 2904 | | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2888 | 2932 | | |
2889 | 2933 | | |
2890 | 2934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
973 | | - | |
| 973 | + | |
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
982 | 998 | | |
983 | 999 | | |
984 | 1000 | | |
| |||
999 | 1015 | | |
1000 | 1016 | | |
1001 | 1017 | | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | 1018 | | |
1007 | 1019 | | |
1008 | 1020 | | |
| |||
1066 | 1078 | | |
1067 | 1079 | | |
1068 | 1080 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1072 | 1084 | | |
1073 | 1085 | | |
1074 | 1086 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
328 | 345 | | |
329 | 346 | | |
330 | 347 | | |
331 | 348 | | |
332 | 349 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | 350 | | |
338 | 351 | | |
339 | 352 | | |
| |||
0 commit comments