mailing list of musl libc
 help / color / mirror / code / Atom feed
* Problems? compiling musl toolchain
@ 2015-09-24 14:23 Ruben Winistörfer
  2015-09-24 15:00 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Ruben Winistörfer @ 2015-09-24 14:23 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2973 bytes --]

Hi Rich

First of all thank you for the work your doing with the musl C library. 
Fantastic.
Compared to others I'm quite new to Linux but even I see, that there's 
far too much bloated software around.
Looking at some projects - e.g. GCC (GNU Compiler Collection) - I see 
black for the programmer's future. At some point it will become 
unmaintainable, if it isn't already...
I think that what you are doing with the C library is essential for the 
future of Linux and other open source OS's and should be done with most 
other software around today... Keep up the work!

At the moment I'm trying to get my homeserver project running. First I 
went with Alpine Linux but ran into some - at least for me at that point 
- unsolvable problems.
So I decided to give the Linux from Scratch idea another chance. A year 
back I already tried to build a musl toolchain from scratch but failed 
due to lack of knowledge and time...
This time it looks like I'm getting it done - but we'll see. ;-)

During bootstrapping and compiling the first parts of the toolchain 
against musl I noticed two things. Maybe they're already known to you...
(A search function for the mailing list would be a nice thing...)



First: Compiling GCC 5.2.0 (and also 4.9.3) with musl 1.1.11 toolchain I 
get a lot of warnings about missing sentinels in function calls. 
Compiling GCC (same versions) with glibc toolchain there's no such 
warning at all.
Replacing the function call sentinels 'NULL' with '(char *)NULL' in the 
affected source code of GCC makes the warnings disappear.

My question: Does the reason for these warnings have some impact on the 
health of the toolchain (is there something wrong?) or are they just a 
byproduct of the correctness and standards-conformance of musl?



Second: Compiling with a musl 1.1.11, GCC 5.2.0 (and 4.9.3), Binutils 
2.25.1 toolchain I get the following info (warning) over an over again:

...ld: copy reloc against protected `stdout' is dangerous
...ld: copy reloc against protected `stdin' is dangerous
...ld: copy reloc against protected `stderr' is dangerous

Same can be seen in Alpine Linux build logs: e.g. 
http://build.alpinelinux.org/buildlogs/build-edge-x86_64/main/patchutils/patchutils-0.3.4-r0.log

Reason for these "warnings" seems to be a change in the linker from 
binutils version 2.25 to 2.25.1.
Lines 2677 to 2680 in 'binutils-2.25.1/bfd/elflink.c' are new and in my 
opinion the source of the issued warning.
My C knowledge is minimal but as far as I can tell this means that the 
problem - if there is one at all - was already there before binutils 
version 2.25.1, the linker just did not print the "warning".

I haven't seen this warning before using glibc. So i guess it has to be 
musl-related.

What do you think? Is there a problem or can I ignore these warnings?


Some additional info:
I'm building on x86_64 for x86_64 using Alpine Linux 3.2.3 as host.


Thank you for the help - much appreciated.

Ruben Winistörfer

[-- Attachment #2: Type: text/html, Size: 5208 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems? compiling musl toolchain
  2015-09-24 14:23 Problems? compiling musl toolchain Ruben Winistörfer
@ 2015-09-24 15:00 ` Rich Felker
  2015-09-24 15:15   ` Szabolcs Nagy
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2015-09-24 15:00 UTC (permalink / raw)
  To: musl

On Thu, Sep 24, 2015 at 04:23:58PM +0200, Ruben Winistörfer wrote:
> First: Compiling GCC 5.2.0 (and also 4.9.3) with musl 1.1.11
> toolchain I get a lot of warnings about missing sentinels in
> function calls. Compiling GCC (same versions) with glibc toolchain
> there's no such warning at all.
> Replacing the function call sentinels 'NULL' with '(char *)NULL' in
> the affected source code of GCC makes the warnings disappear.

This warning is correct; the GCC code is wrong. NULL is not a valid
way to pass a null pointer to a variadic function, especially not in
C++ code.

> My question: Does the reason for these warnings have some impact on
> the health of the toolchain (is there something wrong?) or are they
> just a byproduct of the correctness and standards-conformance of
> musl?

musl has arranged things so that this will work ok (and won't blow up)
at runtime, but what GCC's source is doing formally incorrect and
should be fixed.

> Second: Compiling with a musl 1.1.11, GCC 5.2.0 (and 4.9.3),
> Binutils 2.25.1 toolchain I get the following info (warning) over an
> over again:
> 
> ....ld: copy reloc against protected `stdout' is dangerous
> ....ld: copy reloc against protected `stdin' is dangerous
> ....ld: copy reloc against protected `stderr' is dangerous
> 
> Same can be seen in Alpine Linux build logs: e.g. http://build.alpinelinux.org/buildlogs/build-edge-x86_64/main/patchutils/patchutils-0.3.4-r0.log
> 
> Reason for these "warnings" seems to be a change in the linker from
> binutils version 2.25 to 2.25.1.
> Lines 2677 to 2680 in 'binutils-2.25.1/bfd/elflink.c' are new and in
> my opinion the source of the issued warning.
> My C knowledge is minimal but as far as I can tell this means that
> the problem - if there is one at all - was already there before
> binutils version 2.25.1, the linker just did not print the
> "warning".
> 
> I haven't seen this warning before using glibc. So i guess it has to
> be musl-related.
> 
> What do you think? Is there a problem or can I ignore these warnings?

You can safely ignore them. I do plan to find a way to make them go
away in the next release though, since they're confusing and
concerning to many users.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems? compiling musl toolchain
  2015-09-24 15:00 ` Rich Felker
@ 2015-09-24 15:15   ` Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2015-09-24 15:15 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2015-09-24 11:00:01 -0400]:
> On Thu, Sep 24, 2015 at 04:23:58PM +0200, Ruben Winistörfer wrote:
> > First: Compiling GCC 5.2.0 (and also 4.9.3) with musl 1.1.11
> > toolchain I get a lot of warnings about missing sentinels in
> > function calls. Compiling GCC (same versions) with glibc toolchain
> > there's no such warning at all.
> > Replacing the function call sentinels 'NULL' with '(char *)NULL' in
> > the affected source code of GCC makes the warnings disappear.
> 
> This warning is correct; the GCC code is wrong. NULL is not a valid
> way to pass a null pointer to a variadic function, especially not in
> C++ code.
> 
> > My question: Does the reason for these warnings have some impact on
> > the health of the toolchain (is there something wrong?) or are they
> > just a byproduct of the correctness and standards-conformance of
> > musl?
> 
> musl has arranged things so that this will work ok (and won't blow up)
> at runtime, but what GCC's source is doing formally incorrect and
> should be fixed.
> 

the glibc definition, __null (gcc builtin), is not strictly conforming.

in c++11 it is possible to define NULL in such a way that it does
not warn, std::nullptr, but even that's not correct to use in
variadic functions unless the argument type is (void*) or (char*),
so probably the warning is a good thing.

> > Second: Compiling with a musl 1.1.11, GCC 5.2.0 (and 4.9.3),
> > Binutils 2.25.1 toolchain I get the following info (warning) over an
> > over again:
> > 
> > ....ld: copy reloc against protected `stdout' is dangerous
> > ....ld: copy reloc against protected `stdin' is dangerous
> > ....ld: copy reloc against protected `stderr' is dangerous
> > 
> > Same can be seen in Alpine Linux build logs: e.g. http://build.alpinelinux.org/buildlogs/build-edge-x86_64/main/patchutils/patchutils-0.3.4-r0.log
> > 
> > Reason for these "warnings" seems to be a change in the linker from
> > binutils version 2.25 to 2.25.1.
> > Lines 2677 to 2680 in 'binutils-2.25.1/bfd/elflink.c' are new and in
> > my opinion the source of the issued warning.
> > My C knowledge is minimal but as far as I can tell this means that
> > the problem - if there is one at all - was already there before
> > binutils version 2.25.1, the linker just did not print the
> > "warning".
> > 
> > I haven't seen this warning before using glibc. So i guess it has to
> > be musl-related.
> > 
> > What do you think? Is there a problem or can I ignore these warnings?
> 
> You can safely ignore them. I do plan to find a way to make them go
> away in the next release though, since they're confusing and
> concerning to many users.

the warning is disabled on targets that has extern_protected_data
handling since

http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=889c2a67967f7047c245779a0a0fd8ba8796846e

but binutils has a yearly release cycle so we will have to wait.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-24 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24 14:23 Problems? compiling musl toolchain Ruben Winistörfer
2015-09-24 15:00 ` Rich Felker
2015-09-24 15:15   ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).