|
|
Message-ID: <20140813112207.GH5170@example.net>
Date: Wed, 13 Aug 2014 13:22:07 +0200
From: u-igbb@...ey.se
To: musl@...ts.openwall.com
Subject: Re: compiling musl on x86_64 linux with pcc
On Wed, Aug 13, 2014 at 12:25:01PM +0200, u-igbb@...ey.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
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.