Don't clobber an existing target object file when doing the DTrace

linking process. This is needed because we change the source object
files and the second this dtrace -G is run, no probes will be found.
This hack allows us to build postgres with DTrace probes enabled. I'll
try to find a way to fix this without needing this hack.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Rui Paulo 2010-09-09 11:10:15 +00:00
parent d3555b6fc2
commit 37c380fbb5

View file

@ -1616,6 +1616,18 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
int eprobes = 0, ret = 0;
#if !defined(sun)
if (access(file, R_OK) == 0) {
fprintf(stderr, "dtrace: target object (%s) already exists. "
"Please remove the target\ndtrace: object and rebuild all "
"the source objects if you wish to run the DTrace\n"
"dtrace: linking process again\n", file);
/*
* Several build infrastructures run DTrace twice (e.g.
* postgres) and we don't want the build to fail. Return
* 0 here since this isn't really a fatal error.
*/
return (0);
}
/* XXX Should get a temp file name here. */
snprintf(tfile, sizeof(tfile), "%s.tmp", file);
#endif