Fix simultaneous .gcda creation
The intent of the llvm_gcda_start_file function is that only
one process create the .gcda file and initialize it to be updated
by other processes later.
Before this change, if multiple processes are started simultaneously,
some of them may initialize the file because both the first and
second open calls may succeed in a race condition and new_file
becomes 1 in those processes. This leads incorrect coverage counter
values. This often happens in MPI (Message Passing Interface) programs.
The test program added in this change is a simple reproducer.
This change ensures only one process creates/initializes the file by
using the O_EXCL flag.
Differential Revision: https://reviews.llvm.org/D76206