Re: Building on Gentoo/creating a DT_TEXTREL in shared object


David Brown
 

On Wed, May 23, 2018 at 10:05:12AM -0700, Andy Ross wrote:

I'm guessing that these relocations are there everywhere and that yours just
happens to be a binutils recent enough to warn about it.  Have you tried just
removing the "-Wl,--fatal-warnings" bit from sanitycheck manually?  I bet the
test would succeed.

As for why the (pretty dubious) relocation is there at all, I don't have a clue
except to say that it's going to be specific to native_posix as nothing else we
build uses PIC, AFAIK.

The native_posix rig works with the host compiler, so it's subject to this kind
of version skew.  One that bites me (with gcc 8.1.1 on Fedora 28) at the moment
is a static warning about strncpy()'ing a string literal longer than the output
buffer, in a test designed to check the truncation behavior of strncpy()!
I did solve it, at least sort of.

It turns out that Gentoo patches gcc to default to --pic and --pie
when building. The top-level Zephyr CMakeLists.txt file adds in
--no-pic, and --no-pie, which override this. However, it apparently
isn't possible to link objects build with --no-pic/pie with those
build with it enabled, so the link with just the standard library
fails.

I am able to get past this by commenting out these two declarations in
the CMakeLists.txt file. I so far have 4 other failures (it is still
running) that I have to investigate, as I'm not sure if they are
something else, or caused by removing these lines.

It may be that my easiest solution is to just do the sanity builds
inside of the container.

David

Join devel@lists.zephyrproject.org to automatically receive all group messages.