This fixes Bug 30385 - SORT_NONE not implemented,
`SORT_NONE' disables section sorting by ignoring the command line
section sorting option.
That is why this patch also implements --sort-section option.
Full rules of applying sorting (from ld manual) are:
When both command line section sorting option and linker scriptsection sorting command are used, section sorting command always takes
precedence over the command line option.If the section sorting command in linker script isn't nested, thecommand line option will make the section sorting command to be treated
as nested sorting command.
- SORT_BY_NAME' (wildcard section pattern ) with --sort-sections alignment' is equivalent to SORT_BY_NAME' (SORT_BY_ALIGNMENT' (wildcard section pattern)).
- SORT_BY_ALIGNMENT' (wildcard section pattern) with --sort-section name' is equivalent to SORT_BY_ALIGNMENT' (SORT_BY_NAME' (wildcard section pattern)).
If the section sorting command in linker script is nested, thecommand line option will be ignored.
Convert this to a switch with a default statement with llvm_unreacahble, so that it reports an error if SortSectionPolicy is not one of Priority, Name nor Alignment.