Bug 248818 - clang11 import breaks WANT_LINKER_VERSION check forcing extra cross-tools to be built
Summary: clang11 import breaks WANT_LINKER_VERSION check forcing extra cross-tools to ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Bjoern A. Zeeb
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-08-21 21:49 UTC by Bjoern A. Zeeb
Modified: 2020-09-07 14:24 UTC (History)
4 users (show)

See Also:
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb freebsd_committer freebsd_triage 2020-08-21 21:49:57 UTC
Hi,

the clang11 import changed the #defines in Version.inc for lld; see:

https://svnweb.freebsd.org/base/head/lib/clang/include/lld/Common/Version.inc?r1=361410&r2=364284


This makes the Makefile.inc1 WANT_LINKER_VERSION check to fail (becomes empty).

I don't know if changing the Version.inc back to have the other #defines is the right solution or to change the check in Makefile.inc1.  The latter done as follows does fix the later checks and we do not built cross-tools lib/clang/* anymore for LLD:

Index: Makefile.inc1
===================================================================
--- Makefile.inc1       (revision 364456)
+++ Makefile.inc1       (working copy)
@@ -264,7 +264,7 @@ _WANT_LINKER_FREEBSD_VERSION!= \
 WANT_LINKER_FREEBSD_VERSION=${_WANT_LINKER_FREEBSD_VERSION:C/.*-(.*)/\1/}
 WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
 WANT_LINKER_VERSION!= \
-       awk '$$2 == "LLD_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
+       awk '$$2 == "LLD_VERSION_STRING" { gsub("\"", "", $$3); split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
        ${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown
 .else
 WANT_LINKER_FREEBSD_VERSION_FILE=
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2020-08-21 22:08:33 UTC
The Version.inc is as generated by upstream's CMake scripts, and they don't use the LLD_VERSION, LLD_VERSION_MAJOR and LLD_VERSION_MINOR macros anymore.

So indeed parsing LLD_VERSION_STRING is probably the best way forward. That will also work for the earlier Version.inc headers.
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-08-21 22:32:44 UTC
A commit references this bug:

Author: bz
Date: Fri Aug 21 22:31:46 UTC 2020
New revision: 364466
URL: https://svnweb.freebsd.org/changeset/base/364466

Log:
  After the clang/llvm version 11 import LLD_VERSION is no longer used
  upstream so Version.inc now only defines LLD_VERSION_STRING.

  This breaks the WANT_LINKER_VERSION magic and might lead to us building
  more than needed (e.g., for croos-tools).

  Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
  which not only unbreaks the current situation but should also be backwards
  compatible as dim points out.

  PR:		248818
  Reviewed by:	emaste, dim (seems right and the way to go)
  MFC after:	4 weeks
  X-MFC before:	364284

Changes:
  head/Makefile.inc1
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2020-08-24 02:36:59 UTC
^Triage: Leave In Progress until merged (assuming MFC still applies, per original commit log message)
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-09-07 14:23:22 UTC
A commit references this bug:

Author: bz
Date: Mon Sep  7 14:22:27 UTC 2020
New revision: 365416
URL: https://svnweb.freebsd.org/changeset/base/365416

Log:
  MFC r364466:

    After the clang/llvm version 11 import LLD_VERSION is no longer used
    upstream so Version.inc now only defines LLD_VERSION_STRING.

    This breaks the WANT_LINKER_VERSION magic and might lead to us building
    more than needed (e.g., for croos-tools).

    Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
    which not only unbreaks the current situation but should also be backwards
    compatible as dim points out.

    Merging this before r364284 will ensure that stable/12 won't break.

    PR:		248818
    Reviewed by:	emaste, dim (seems right and the way to go)

Changes:
_U  stable/12/
  stable/12/Makefile.inc1