Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2012 11:37:33 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Hartmut Brandt <harti@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: clang+VNET -> netstat: no namelist
Message-ID:  <20120521083733.GS2358@deviant.kiev.zoral.com.ua>
In-Reply-To: <201205210651.q4L6pLYI084136@freefall.freebsd.org>
References:  <201205210651.q4L6pLYI084136@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--PpHgzJIASOO9qXt6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, May 21, 2012 at 06:51:21AM +0000, Hartmut Brandt wrote:
> Hi,
>=20
> I'm running a kernel+world compiled with clang (everything fresh from two
> days ago). Kernel and world are in sync. When I run netstat -rn I get a
> 'no namelist'.
>=20
> I tried to track that down and it looks like this is an issue with the sy=
mbol
> dumptid defined in kern_shutdown. libkvm tries to look up this symbol when
> it figures out whether it needs to do a second run on a symbol list with
> all the symbols that have not been found prefixed by vnet_. the kldsym
> system call fails to lookup this symbol when the kernel is compiled with =
clang
> and hence libkvm fails to recognize the VNET kernel.
>=20
> I 'fixed' this by making dumptid non-static, but I wonder how a static
> symbol can be returned by kldsym in the gcc case. To me this looks
> not entirely useful.
>=20
> Maybe someone with more knowledge of the kernel symbol stuff has an idea
> of a real fix.
I think making dumptid not-static is the right thing to do, if it is indeed
looked up by external consumer. The kernel linkers use the normal symbol
table, and not the dynamic symbol table. Taking aside the reasons for this
choice, it just so happens that our version of gcc does not optimize out
the assign-only static dumptid variable.

Clang is more aggressive and dumptid is removed, so it does not appear in
the symbol table.

--PpHgzJIASOO9qXt6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk+5/soACgkQC3+MBN1Mb4huiACdF7HlpOgyzAnrdakDT8oA6pBf
dm4Ani55TMERyJl/z0bUtMCMoUbG9gQi
=iNkR
-----END PGP SIGNATURE-----

--PpHgzJIASOO9qXt6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120521083733.GS2358>