DTrace build dependency rules

From: Mark Johnston <markj(at)FreeBSD(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: DTrace build dependency rules
Date: 2015-08-15 22:45:41
Message-ID: 20150815224541.GA35493@charmander
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

There seems to be a bug in the make rules when DTrace is enabled. It
causes dtrace -G to be invoked twice when building PostgreSQL as a
FreeBSD port: once during the build itself, and once during
installation. For a long time this has been worked around on FreeBSD
with a change to libdtrace itself, but this workaround is proving
problematic and I'd like to fix the problem properly. I'm not sure
whether the problem has been observed on other operating systems that
support DTrace.

The bug is in src/backend/Makefile. probes.o, the dtrace(1)-generated
object file, depends on the objfiles.txt for each of the backend
subdirs. These files depend in turn on the object files themselves; if
objfiles.txt is out of date with respect to one of its object files, the
mtime of objfiles.txt is updated with "touch" (see backend/common.mk).
The problem is that dtrace -G, which runs at the end of the build,
modifies a number of object files (it overwrites their probe sites with
NOPs), thus making their corresponding objfiles.txt out of date. Then,
when "make install" traverses the backend subdirs, it updates
objfiles.txt, which causes probes.o to be rebuilt, resulting in an error
from dtrace(1).

The attached patch fixes the problem by having probes.o depend on object
files directly, rather than on objfiles.txt. I've tested it with
PostgreSQL 9.0-9.4 on FreeBSD CURRENT.

Thanks!
-Mark

Attachment Content-Type Size
postgres_dtrace_rule.diff text/x-diff 618 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2015-08-15 22:47:58 Re: Autonomous Transaction is back
Previous Message Jeff Janes 2015-08-15 21:58:16 Potential GIN vacuum bug