HomePhabricator

OpenMP: Fix object clobbering issue when using save-temps

Authored by pdhaliwal on Feb 23 2021, 4:43 AM.

Description

OpenMP: Fix object clobbering issue when using save-temps

There are two preconditions to reproduce the issue,

  1. Use -save-temps option
  2. Provide the -o option with name equal to the input file name without the file extension. For e.g. clang a.c -o a

With the -o specified, the AssembleJobAction after OffloadWrapperJobAction
will produce the object file with same name as host code object file.
Due to this clash, the OffloadWrapperAction overwrites the initial host
object file, which results in lld error. This also fixes the multiple definition of __dummy.omp_offloading.entry' issue in D96769 .

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D97273