Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Fri, 14 Sep 2018 16:29:13 -0400
From: Rich Felker <dalias@...ifal.cx>
To: Christian Lamparter <chunkeey@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: Compiler issue due to 'reduce spurious inclusion of libc.h'

On Fri, Sep 14, 2018 at 10:18:15PM +0200, Christian Lamparter wrote:
> Hello,
> 
> I noticed that you published a ton of new patches for 1.1.20+ and since
> I'm currently doing a OpenWrt patch to include musl 1.1.20 I had to test
> them out on my OpenWrt powerpc target.
> 
> I can report that everything compiled fine, but I had this little hick-up
> along the way:
> 
> |src/conf/sysconf.c: In function 'sysconf':
> |src/conf/sysconf.c:190:10: error: 'PAGE_SIZE' undeclared (first use in this function); did you mean 'JT_PAGE_SIZE'?
> |     return PAGE_SIZE;
> |            ^~~~~~~~~
> |src/conf/sysconf.c:190:10: note: each undeclared identifier is reported only once for each function it appears in
> 
> >From what I can tell, the file had a #include "libc.h" that got
> removed by the 'reduce spurious inclusion of libc.h' patch. For
> my local testing, I just added it back. 
> 
> Thank you for your great work,
> Christian

Thanks for the catch! I was testing on i386 where PAGE_SIZE is a
constant and libc.h is not needed to get it.

$ grep -L libc.h $(grep -rl PAGE_SIZE src/)
src/aio/lio_listio.c
src/internal/libc.h
src/conf/sysconf.c

Looks like in principle there's one other file that has the issue, but
it's including pthread_arch.h which includes libc.h.

I'm thinking about breaking up the libc struct -- the original purpose
of it was to be a single point where declaring hidden visibility was
needed, with a fallback to using an accessor function call and
-Bsymbolic to achieve the same thing on theoretical compilers without
visibility, but that was dropped a long time ago. If I do this, I'll
just make it an external hidden __page_size and have a wrapper for
limits.h that defines it, so libc.h isn't needed. This situation of
having whether it breaks being arch-specific is not nice.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.