This patch is part of the work to make LTO and function multi-versioning work correctly.
Currently, the trap function name users specify on the command line using -ftrap-function is passed to the backend via TargetMachine's TargetOptions. This patch attaches attribute "trap-func-name" to the IR function instead so that we can use -ftrap-function for LTO builds and change the trap function name on a per-function basis.