Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Mar 2020 11:08:22 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Willem Jan Withagen <wjw@digiware.nl>
Cc:        "freebsd-virtualization@freebsd.org" <virtualization@freebsd.org>,  FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: [RFC] Adding a Rados block driver to bhyve
Message-ID:  <CAG6CVpXDunwwg-oXHFaZrpuiFWxPY5XJ5Xvf3%2BB=wJ7n3Ao2BA@mail.gmail.com>
In-Reply-To: <ba937caf-ce4b-eeb9-8915-f9b9910aa711@digiware.nl>
References:  <9c7a8dea-ac8a-4d17-ed33-b6c4e882add8@digiware.nl> <CAOtMX2iyhS230oCysYx3YC72B8TwFrrkcXtCoMCYK85KbFORaQ@mail.gmail.com> <c2090191-920b-3d2f-f797-75a448b18ad6@digiware.nl> <CAOtMX2iwJ1_VVDXOnSP6nui-JcYMwndXMex8fxtyi6qEikUX8A@mail.gmail.com> <936ed7c2-99d2-5df8-de3f-f64f28d2ba6f@digiware.nl> <CAOtMX2gKkh=Fik9wjHoAx9Gt9zwePMjmRaGP63eE2quNTmyDGw@mail.gmail.com> <ba937caf-ce4b-eeb9-8915-f9b9910aa711@digiware.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 10, 2020 at 9:28 AM Willem Jan Withagen <wjw@digiware.nl> wrote:
> >>         problem that libblock_rbd.so is stripped in such a way that
> >>         the symbol I need is removed.
>
> >     So either I'm doing it the wrong way, like special options on the
> >     symbols oid.
>
> > However, I think there's something wrong with your
> > library, too.  The library should be usable even if it's stripped.

Yes, strip only removes local symbols (.symtab), not exported ones (.dynsym).

> I checked with objdump, and the symbol that I need is definitly not
> present in the stripped version.

How are you defining the symbol intended for export?  Is the symbol a
function or data?  Does the compiler flag -fvisibility=hidden get
used?  Which symbol is missing and what are the symptoms?

> And it does not really matter if I declare it static or not.

Not declaring it "static" is necessary, if not sufficient.

Looking at your code on github, here are some issues:

* In block_if.h, you define an object blocklocal_backend.  This is a
header, and every compilation unit that pulls in the header will get
its own copy of blocklocal_backend.  You probably want 'extern
block_backend_t blocklocal_backend;' instead.

* You SET_DECLARE block_backend_set in block_if.c, but I think it
needs to be in block_if.h.

* There is some weirdness around linker sets being removed by the
linker if they are empty, so you may want to add blockbackend_local to
the linker set in the main program.  (It's unclear to me why
blockbackend_local is treated specially regardless.)

However, I'm not quite sure why DATA_SET() in block_rbd.c is not
creating __start_set_block_backend_set / __stop_set_block_backend_set
exported symbols.  As Alan asked, please provide 'nm -D foo.so'.

Best,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXDunwwg-oXHFaZrpuiFWxPY5XJ5Xvf3%2BB=wJ7n3Ao2BA>