Bug 241932 - clang9 & ccache: compiling net/netatalk3 gets the -fPIC test wrong with ccache
Summary: clang9 & ccache: compiling net/netatalk3 gets the -fPIC test wrong with ccache
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-13 02:02 UTC by Larry Rosenman
Modified: 2019-11-25 01:19 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Rosenman freebsd_committer 2019-11-13 02:02:27 UTC
previously (clang8), this port worked fine.  WIth clang9 and ccache, the -fPIC test fails due to the output saying clang-cpp and not cc.

swils, bdrewery, and I did a bunch of tests to get to the bottom of this, and believe that the change here:
http://dpaste.com/2GY8FW0

is causing grief.
Comment 1 Larry Rosenman freebsd_committer 2019-11-13 02:04:40 UTC
@dim: Can you weigh in?
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2019-11-13 03:24:39 UTC
Is this for clang in base, or from ports?
Comment 4 Larry Rosenman freebsd_committer 2019-11-13 03:29:36 UTC
clang in base.
Comment 5 Ed Maste freebsd_committer 2019-11-13 15:31:54 UTC
(In reply to Larry Rosenman from comment #0)
> the -fPIC test fails due to the output saying clang-cpp and not cc.

Can you provide the exact command that returns clang-cpp instead of cc (so that I can test my WIP patch)?
Comment 6 Steve Wills freebsd_committer 2019-11-13 15:47:08 UTC
Here you go:

root@head-amd64-default:/wrkdirs/usr/ports/net/netatalk3/work/netatalk-3.1.12 # cc -c -O2 -pipe -I/usr/local/include -L/usr/local/lib -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -fPIC -DPIC -DPIC conftest.c
clang-cpp: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
root@head-amd64-default:/wrkdirs/usr/ports/net/netatalk3/work/netatalk-3.1.12 # /ccache/libexec/ccache/cc -c -O2 -pipe -I/usr/local/include -L/usr/local/lib -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -fPIC -DPIC -DPIC conftest.c
cpp: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
Comment 7 commit-hook freebsd_committer 2019-11-13 21:03:13 UTC
A commit references this bug:

Author: emaste
Date: Wed Nov 13 21:02:18 UTC 2019
New revision: 354692
URL: https://svnweb.freebsd.org/changeset/base/354692

Log:
  llvm: use AT_EXECPATH from ELF auxiliary vectors for getExecutablePath

  /proc/curproc/file and the KERN_PROC_PATHNAME sysctl may not return the
  desired path if there are multiple hardlinks to the file.

  PR:		241932
  Tested by:	ler
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/contrib/llvm/lib/Support/Unix/Path.inc
Comment 8 Ed Maste freebsd_committer 2019-11-13 21:05:16 UTC
Upstream review at https://reviews.llvm.org/D70198.

Brooks is going to update elf_aux_info(3) to support AT_EXECPATH and I will subsequently update the patch to use it instead (so that this works for CHERI).
Comment 9 Ed Maste freebsd_committer 2019-11-14 15:37:09 UTC
Thank you for the report; this is now fixed in HEAD and committed upstream. Clang 8.0 in release branches does not have this issue, and if Clang 9.0 is MFC'd it will include the fix.