https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105950
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> --- What we said is to use -fsanitize=undefined when linking, not add -lubsan manually. I don't know how I could have said that more clearly than comment 6. This is not different to other flags, there are plenty of other flags that are needed both when compiling and linking.