Bug 230444 - some CTF data objects are missing a type index
Summary: some CTF data objects are missing a type index
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-07 21:32 UTC by Mark Johnston
Modified: 2018-10-31 18:49 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Johnston freebsd_committer freebsd_triage 2018-08-07 21:32:01 UTC
# ctfdump -d /boot/kernel/kernel | grep vm_radix_node_zone
  [16957] 0    vm_radix_node_zone (24397)

The second number is supposed to be an index into the type table.  For some reason it's not getting filled in, which I believe is a regression.  It does get filled in for some objects, e.g., "ticks".  The lack of a type index means that I can't refer to the symbol in dtrace scripts.
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2018-09-12 21:01:08 UTC
A possibly related issue: some netmap functions are missing from the function table even though they're present in the object files:

$ ctfdump -f netmap_mem2.o | grep netmap_obj_malloc
  [31] FUNC (netmap_obj_malloc) returns: 19 args: (605, 6, 26, 26)
$ ctfdump -f kernel | grep netmap_obj_malloc
$
Comment 2 Mark Johnston freebsd_committer freebsd_triage 2018-09-29 03:25:20 UTC
This seems to be the result of a minor regression in lld.  It stopped emitting
STT_FILE symbols, which ctfmerge relies upon to uniquify function table entries that reference STB_LOCAL symbols.  As a consequence of this, ctfmerge stopped emitting entries for static functions into the function table, and dtrace no longer gets type info for them.

Applying https://reviews.llvm.org/D45261 fixes the problem for me.  Dmitry,
are you planning to merge proejcts/clang700 before 12.0 branches?
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2018-09-29 12:20:13 UTC
(In reply to Mark Johnston from comment #2)
> This seems to be the result of a minor regression in lld.  It stopped
> emitting
> STT_FILE symbols, which ctfmerge relies upon to uniquify function table
> entries that reference STB_LOCAL symbols.  As a consequence of this,
> ctfmerge stopped emitting entries for static functions into the function
> table, and dtrace no longer gets type info for them.
> 
> Applying https://reviews.llvm.org/D45261 fixes the problem for me.  Dmitry,
> are you planning to merge proejcts/clang700 before 12.0 branches?

There is still a dialog going on in re@ about this, but I am unsure whether it is going to make it.  I will merge the above change right away, since it is fairly trivial, and it can be MFC'd to stable/11 in 3 days.
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-09-29 14:12:58 UTC
A commit references this bug:

Author: dim
Date: Sat Sep 29 14:12:04 UTC 2018
New revision: 339013
URL: https://svnweb.freebsd.org/changeset/base/339013

Log:
  Pull in r329557 from upstream lld trunk (by George Rimar):

    [ELF] - Allow LLD to produce file symbols.

    This is for PR36716 and
    this enables emitting STT_FILE symbols.

    Output size affect is minor:
    lld binary size changes from 52,883,408 to 52,949,400
    clang binary size changes from 83,136,456 to 83,219,600

    Differential revision: https://reviews.llvm.org/D45261

  This fixes a regression in lld that made it stop emitting STT_FILE
  symbols, which ctfmerge relies upon to uniquify function table entries
  that reference STB_LOCAL symbols.  Consequently, ctfmerge stopped
  emitting entries for static functions into the function table, and
  dtrace no longer gets type info for them.

  Approved by:	re (kib)
  Reported by:	markj
  PR:		230444
  MFC after:	3 days

Changes:
  head/contrib/llvm/tools/lld/ELF/Writer.cpp
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2018-09-29 15:39:46 UTC
(In reply to Dimitry Andric from comment #3)
Nice, thanks!  Sorry for misspelling your name in my previous comment.
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-10-18 19:20:06 UTC
A commit references this bug:

Author: dim
Date: Thu Oct 18 19:19:45 UTC 2018
New revision: 339429
URL: https://svnweb.freebsd.org/changeset/base/339429

Log:
  MFC r339013:

  Pull in r329557 from upstream lld trunk (by George Rimar):

    [ELF] - Allow LLD to produce file symbols.

    This is for PR36716 and
    this enables emitting STT_FILE symbols.

    Output size affect is minor:
    lld binary size changes from 52,883,408 to 52,949,400
    clang binary size changes from 83,136,456 to 83,219,600

    Differential revision: https://reviews.llvm.org/D45261

  This fixes a regression in lld that made it stop emitting STT_FILE
  symbols, which ctfmerge relies upon to uniquify function table entries
  that reference STB_LOCAL symbols.  Consequently, ctfmerge stopped
  emitting entries for static functions into the function table, and
  dtrace no longer gets type info for them.

  Reported by:	markj
  PR:		230444

Changes:
_U  stable/11/
  stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-10-26 21:20:25 UTC
A commit references this bug:

Author: dim
Date: Fri Oct 26 21:20:07 UTC 2018
New revision: 483054
URL: https://svnweb.freebsd.org/changeset/ports/483054

Log:
  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	brooks (maintainer)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  MFH:		2018Q4
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
  head/devel/llvm60/Makefile
  head/devel/llvm60/files/clang/patch-head-r331066.diff
  head/devel/llvm60/files/clang/patch-head-r336227.diff
  head/devel/llvm60/files/clang/patch-head-r338697.diff
  head/devel/llvm60/files/clang/patch-head-r339019.diff
  head/devel/llvm60/files/lld/
  head/devel/llvm60/files/lld/patch-head-r331731.diff
  head/devel/llvm60/files/lld/patch-head-r333401.diff
  head/devel/llvm60/files/lld/patch-head-r336664.diff
  head/devel/llvm60/files/lld/patch-head-r336972.diff
  head/devel/llvm60/files/lld/patch-head-r337282.diff
  head/devel/llvm60/files/lld/patch-head-r338251.diff
  head/devel/llvm60/files/lld/patch-head-r338682.diff
  head/devel/llvm60/files/lld/patch-head-r339013.diff
  head/devel/llvm60/files/lld/patch-head-r339304.diff
  head/devel/llvm60/files/lldb/
  head/devel/llvm60/files/lldb/patch-head-r332849.diff
  head/devel/llvm60/files/lldb/patch-head-r332965.diff
  head/devel/llvm60/files/patch-head-r308867.diff
  head/devel/llvm60/files/patch-head-r330686.diff
  head/devel/llvm60/files/patch-head-r331065.diff
  head/devel/llvm60/files/patch-head-r331366.diff
  head/devel/llvm60/files/patch-head-r336969.diff
  head/devel/llvm60/files/patch-head-r336970.diff
  head/devel/llvm60/files/patch-head-r337615.diff
  head/devel/llvm60/files/patch-head-r338689.diff
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-10-31 18:49:47 UTC
A commit references this bug:

Author: dim
Date: Wed Oct 31 18:49:08 UTC 2018
New revision: 483602
URL: https://svnweb.freebsd.org/changeset/ports/483602

Log:
  MFH: r481120

  Update to a new snapshot.

  Update LICENSE data per mailing list feedback and move to a seperate
  Makefile.LICENSE for use by other llvm ports.

  MFH: r483054

  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	portmgr (miwi)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
_U  branches/2018Q4/
  branches/2018Q4/devel/llvm-devel/Makefile
  branches/2018Q4/devel/llvm-devel/Makefile.LICENSE
  branches/2018Q4/devel/llvm-devel/Makefile.snapshot
  branches/2018Q4/devel/llvm-devel/distinfo
  branches/2018Q4/devel/llvm-devel/files/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
  branches/2018Q4/devel/llvm-devel/pkg-plist
  branches/2018Q4/devel/llvm60/Makefile
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff
  branches/2018Q4/devel/llvm60/files/lld/
  branches/2018Q4/devel/llvm60/files/lldb/
  branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336969.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336970.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r337615.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r338689.diff