From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5823 Path: news.gmane.org!not-for-mail From: u-igbb@aetey.se Newsgroups: gmane.linux.lib.musl.general Subject: Re: compiling musl on x86_64 linux with pcc Date: Wed, 13 Aug 2014 13:22:07 +0200 Message-ID: <20140813112207.GH5170@example.net> References: <20140813091843.GD5170@example.net> <20140813094910.GN22308@port70.net> <20140813102501.GG5170@example.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1407928961 27442 80.91.229.3 (13 Aug 2014 11:22:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 11:22:41 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5829-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 13 13:22:34 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XHWdV-0003fS-LC for gllmg-musl@plane.gmane.org; Wed, 13 Aug 2014 13:22:33 +0200 Original-Received: (qmail 15817 invoked by uid 550); 13 Aug 2014 11:22:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15809 invoked from network); 13 Aug 2014 11:22:32 -0000 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Received-SPF: none receiver=mailfe06.swip.net; client-ip=199.254.238.44; envelope-from=u-igbb@aetey.se Content-Disposition: inline In-Reply-To: <20140813102501.GG5170@example.net> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:5823 Archived-At: On Wed, Aug 13, 2014 at 12:25:01PM +0200, u-igbb@aetey.se wrote: > pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./src/internal -I./include -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -c -o src/env/__init_tls.o src/env/__init_tls.c > src/env/__init_tls.c:112: error: #else in non-conditional section > error: XXXXXX/libexec/cpp terminated with status 1 FWIIW, looks like a limitation of the preprocessor in pcc: __syscall( #ifdef SYS_mmap2 becomes after -E __syscall(#ifdef SYS_mmap2 .... works around easily by moving the conditional out of the parentheses: ------ --- src/env/__init_tls.c.ori 2014-08-13 12:56:35.389032321 +0200 +++ src/env/__init_tls.c 2014-08-13 12:58:49.852815255 +0200 @@ -91,14 +91,17 @@ libc.tls_size = 2*sizeof(void *)+T.size+T.align+sizeof(struct pthread); if (libc.tls_size > sizeof builtin_tls) { - mem = (void *)__syscall( #ifdef SYS_mmap2 + mem = (void *)__syscall( SYS_mmap2, + 0, libc.tls_size, PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); #else + mem = (void *)__syscall( SYS_mmap, -#endif 0, libc.tls_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); +#endif /* -4095...-1 cast to void * will crash on dereference anyway, * so don't bloat the init code checking for error codes and * explicitly calling a_crash(). */ ------ Othwerwise, pcc does not look robust against arithmetic expressions: pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./src/internal -I./include -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -c -o src/math/asinhl.o src/math/asinhl.c src/math/asinhl.c, line 25: compiler error: Cannot generate code, node 0x5be9e0 op TEMP error: XXXXXXXX/libexec/ccom terminated with status 1 src/math/asinhl.c: 24: /* |x| >= 2 */ 25: x = logl(2*x + 1/(sqrtl(x*x+1)+x)); I will check this one on the pcc list. Regards, Rune