Page MenuHomeFreeBSD

Use relative object directories where possible.
AcceptedPublic

Authored by bdrewery on Oct 31 2017, 12:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 4:42 AM
Unknown Object (File)
Mar 18 2024, 6:36 AM
Unknown Object (File)
Jan 27 2024, 7:07 PM
Unknown Object (File)
Dec 23 2023, 12:28 AM
Unknown Object (File)
Nov 29 2023, 7:09 AM
Unknown Object (File)
Aug 15 2023, 10:35 AM
Unknown Object (File)
Jun 30 2023, 11:50 PM
Unknown Object (File)
Jun 26 2023, 12:21 PM
Subscribers

Details

Summary

Make generally runs from the .OBJDIR, so using relative paths improves
namecache lookups.

This can be disabled in /etc/src-env.conf with:

RELOBJTOP= ${OBJTOP}
RELSRCTOP= ${SRCTOP}

Sponsored by: Dell EMC Isilon

This uses RELOBJTOP added in rS325190

Test Plan

Ran buildworld, installworld, buildkernel, installkernel, DIRDEPS_BUILD

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 12311
Build 12600: arc lint + arc unit

Event Timeline

bdrewery edited the summary of this revision. (Show Details)
bdrewery edited the test plan for this revision. (Show Details)

I'm fine with this change. It's pretty straightforward.

gnu/usr.bin/cc/Makefile.inc
78–79

This part of the change seems incorrect (or partial, at the very least) given the conditional on line 78.

This revision is now accepted and ready to land.Oct 31 2017, 2:33 AM
gnu/usr.bin/cc/Makefile.inc
78–79

exists does funny things. If not given ${.OBJDIR} it goes searching in ${.CURDIR} too... really all of .PATH:

exists   Takes a file name as an argument and evaluates to true if the file exists.  The file is searched for on the system search path (see .PATH).

I tried exists(../cc_tools) and exists(./../cc_tools) without having the directory really there (but the .OBJDIR existed for cc/cpp) and got this output:

~/git/freebsd/gnu/usr.bin/cc/cpp # make -V '${CFLAGS:M*cc_tools*}'
-I../cc_tools -I/root/git/freebsd/gnu/usr.bin/cc/cpp/../cc_tools

Only if I used exists(${.OBJDIR}/../cc_tools) did it do the right thing.
Without dir present:

~/git/freebsd/gnu/usr.bin/cc/cpp # make -V '${CFLAGS:M*cc_tools*}'
-I/root/git/freebsd/gnu/usr.bin/cc/cpp/../cc_tools

With dir present:

~/git/freebsd/gnu/usr.bin/cc/cpp # make -V '${CFLAGS:M*cc_tools*}'
-I../cc_tools -I/root/git/freebsd/gnu/usr.bin/cc/cpp/../cc_tools

Hmm, I rather liked the absolute paths that ${.OBJDIR} and ${OBJTOP} introduced. I find relative path output during builds a bit obfuscating. How much performance gain does this change deliver, in exchange for more obscurity?

In D12839#266680, @dim wrote:

Hmm, I rather liked the absolute paths that ${.OBJDIR} and ${OBJTOP} introduced. I find relative path output during builds a bit obfuscating. How much performance gain does this change deliver, in exchange for more obscurity?

I can do some measurements. I could compromise and only enable this for META_MODE since it records all files that are touched and the CWD in the meta file. That makes debugging feasible.