From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8714 Path: news.gmane.org!not-for-mail From: Denys Vlasenko Newsgroups: gmane.linux.lib.musl.general Subject: Having hard time adding to CFLAGS Date: Fri, 23 Oct 2015 00:31:09 +0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1445553125 32432 80.91.229.3 (22 Oct 2015 22:32:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Oct 2015 22:32:05 +0000 (UTC) To: musl , Rich Felker Original-X-From: musl-return-8727-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 23 00:31:52 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZpOOj-00034J-VT for gllmg-musl@m.gmane.org; Fri, 23 Oct 2015 00:31:50 +0200 Original-Received: (qmail 21643 invoked by uid 550); 22 Oct 2015 22:31:47 -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 21594 invoked from network); 22 Oct 2015 22:31:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Wa7TxW6Fm72/FT54iRhdEKiyntt7Y/p0QFb3ZLq3ucA=; b=iqylLmX4GyOm39o59Sc9z+kmm7wxtsdWf29Xc3DuSIxkccqOo8iHZdRLFqga2WkgEz NZaX8ztXaGAP3X945HGMyl04gQzCXpRlkoeIyAQKco0dNP2IxHsuvh9Rm678on2yvQwF iPBkiAj59EhiLg+pFjdUNkH1yAQFmXTyGJqwqIc/+daArT269nFrO6Ra7XgBKcAJsP++ dh1sJZHx8G5C0wfQcLw99mXZCh0RB8y7TksQ0BZ+uBKNZ1eSvV4X/Bynl1eMX93Q0ZVN Ezb2WK2/VGJfWRiBxYbMTFiG4ecpjukMdPwvZFFh2dQHqf4gnZDRGGnbgCFZRMwFW2Rm C49g== X-Received: by 10.140.133.209 with SMTP id 200mr23337144qhf.0.1445553088358; Thu, 22 Oct 2015 15:31:28 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:8714 Archived-At: Let's say I need to add a gcc option to my musl build. configure says: ... Some influential environment variables: CC C compiler command [detected] CFLAGS C compiler flags [-Os -pipe ...] CROSS_COMPILE prefix for cross compiler and tools [none] LIBCC compiler runtime library [detected So I try this, combining all possible ways of passing CFLAGS (past experience is that different projects do it differently). CFLAGS is in environment, and on both configure and make command lines: export CFLAGS="-falign-functions=1" # for example ./configure CFLAGS="$CFLAGS" make CFLAGS="$CFLAGS" It does work, but resulting libc.so is twice as big: text data bss dec hex filename 564099 1944 11768 577811 8d113 musl.1/lib/libc.so 917805 2130 11736 931671 e3757 musl.2/lib/libc.so The cause is that gcc invocation for each .c file in both cases start normally: gcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./src/internal -I./include... but then, build without explicit CFLAGS use this: ... -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 -include vis.h -fPIC -DSHARED -c -o src/aio/aio.lo src/aio/aio.c and one with CFLAGS loses these flags, in particular, it has no -Os and no -fPIC: ... -falign-functions=1 -c -o src/aio/aio.o src/aio/aio.c Evidently, my CFLAGS replaced needed flags instead of being added at the end. Can this be fixed? If user needs to use e.g. EXTRA_CFLAGS instead, please fix configure --help.