Commit d69cd46
authored
Rollup merge of rust-lang#85772 - luqmana:ignored-metadata, r=petrochenkov
Preserve metadata w/ Solaris-like linkers.
rust-lang#84468 moved the `-zignore` linker flag from the `gc_sections` method to `add_as_needed` which is more accurate but Solaris-style linkers will also end up removing an unreferenced ELF sections [1]. This had the unfortunate side effect of causing the `.rustc` section (which has the metada) to be removed which could cause issues when trying to link against the resulting crates or use proc macros.
Since the `-zignore` is positional, we fix this by moving the metadata objects to before the flag.
[1] Specifically a section is considered unreferenced if:
* The section is allocatable
* No other sections bind to (relocate) to this section
* The section provides no global symbols
https://docs.oracle.com/cd/E19683-01/817-3677/6mj8mbtbs/index.html#chapter4-191 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1836 | 1836 | | |
1837 | 1837 | | |
1838 | 1838 | | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
1839 | 1842 | | |
1840 | 1843 | | |
1841 | 1844 | | |
1842 | 1845 | | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1843 | 1849 | | |
1844 | 1850 | | |
1845 | 1851 | | |
| |||
1891 | 1897 | | |
1892 | 1898 | | |
1893 | 1899 | | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | 1900 | | |
1898 | 1901 | | |
1899 | 1902 | | |
| |||
0 commit comments