-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
link: do not modify the input object files unless changed
process_obj() and the various implementations of dt_modtext() go to considerable lengths to not modify the input .o files unless they actually need to change (dtrace -G differs from a linker in this, since it modifies its input object files as well as creating an output). But if it finds probes, it unconditionally declares the file modified and (eventually) calls elf_update() on it, even if all the modifications were already done by a prior invocation of dtrace -G on the same inputs. This leads to needless re-make(1)s and is entirely unnecessary. (The output is still modified regardless, of course.) (nca: wrote test, commit log) Orabug: 35417184 Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
2 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at | ||
# http://oss.oracle.com/licenses/upl. | ||
# | ||
if [ $# != 1 ]; then | ||
echo expected one argument: '<'dtrace-path'>' | ||
exit 2 | ||
fi | ||
|
||
dtrace=$1 | ||
CC=/usr/bin/gcc | ||
CFLAGS= | ||
|
||
DIRNAME="$tmpdir/usdt-link-idempotence.$$.$RANDOM" | ||
mkdir -p $DIRNAME | ||
cd $DIRNAME | ||
|
||
cat > prov.d <<EOF | ||
provider test_prov { | ||
probe go(); | ||
}; | ||
EOF | ||
|
||
$dtrace -h -s prov.d | ||
if [ $? -ne 0 ]; then | ||
echo "failed to generate header file" >& 2 | ||
exit 1 | ||
fi | ||
|
||
cat > test.c <<EOF | ||
#include <sys/types.h> | ||
#include "prov.h" | ||
int | ||
main(int argc, char **argv) | ||
{ | ||
if (TEST_PROV_GO_ENABLED()) { | ||
TEST_PROV_GO(); | ||
} | ||
} | ||
EOF | ||
|
||
${CC} ${CFLAGS} -c test.c | ||
if [ $? -ne 0 ]; then | ||
echo "failed to compile test.c" >& 2 | ||
exit 1 | ||
fi | ||
$dtrace -G -s prov.d test.o | ||
if [ $? -ne 0 ]; then | ||
echo "failed to create DOF" >& 2 | ||
exit 1 | ||
fi | ||
${CC} ${CFLAGS} -o test test.o prov.o | ||
DTRACE_DEBUG=t $dtrace -G -s prov.d test.o | ||
if [ $? -ne 0 ]; then | ||
echo "failed to regenerate DOF" >& 2 | ||
exit 1 | ||
fi | ||
if [ test.o -nt test ]; then | ||
exit 1 | ||
fi | ||
|
||
exit 0 |