From patchwork Thu Feb 12 22:22:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 439347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BC597140182 for ; Fri, 13 Feb 2015 09:22:17 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=yACJIzaP+uoxjJC/IucWYTnYeNb2ZL0PgbpMSkXWyMKeyN t2bJBcaNRW7hgpQFPuE5cUjMorPmZNaOCNoVBZe3PVdp6JiqKD8f7PKiaVvwev12 MKTLTEWnEsV0g+Sxhi7PbbLfrMckNCSoOw3OtTx1zsPWsGBWt5kQ3UhcdFTvc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=C9/PclBiUlMA1Ho0URghNoQTCr0=; b=ACmFwQovhYC+CeBWH0qo 0Wd8WS+lz1a9b4Ba75VZVWA/r0FrKhUNaGyk4ZR0sy5wHNNkC/50ytlyCh+e/EL0 mbYmRUpt/E/jjjH7y3nbASPWY40yV7Vo1nzqJRiY+Vdq90oNT2xzOLENmQt+5ySV pr3TdjLnEWp2BWF/6iwUTN4= Received: (qmail 1847 invoked by alias); 12 Feb 2015 22:22:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 1724 invoked by uid 89); 12 Feb 2015 22:22:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Use -Werror=undef for assembly code. Message-Id: <20150212222206.A8EA32C3C03@topped-with-meat.com> Date: Thu, 12 Feb 2015 14:22:06 -0800 (PST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=sVwLWj6ZUn7nwCk0I0MA:9 a=CjuIK1q_8ugA:10 We want the -Wundef goodness for our assembly code (.S files) and everything else (e.g. %if in various magic files) too. I first tried to put -Wundef and -Werror into CPPFLAGS rather than just CFLAGS. That blew up in various ways, so I've backed off to just adding it for assembly specifically. In the future I think we should rework things so that -Wundef in CPPFLAGS can work. I'll describe the issues I ran into here just for future reference: 1. The uses for .v.i files and the like all blew up badly for lack of -DMODULE_NAME change. I considered trying to make those use -DMODULE_NAME=nonlib or maybe something new like -DMODULE_NAME=build so that IS_IN could be principled in those cases. But it looked like a bootstrapping nightmare or further kludge-o-rama because those uses are dependencies of libc-module.h generation, so I tried the far simpler route of changing libc-symbols.h to define IS_IN to a constant zero if MODULE_NAME is not defined. That covered the .v.i cases OK, and would probably suffice in the future if we have -Wundef in CPPFLAGS. 2. The real killer was that CPPFLAGS comes after CFLAGS, not before. (That seems like it might be backwards from what you really want, but it is the established practice in make's default rules and the like, so it probably should stay as it is.) That meant that -Werror=undef in CPPFLAGS overrode -Wno-error=undef in CFLAGS. I think once we have conquered all the -Wundef warnings still lingering (mostly in test code now), we could safely put -Werror=undef into CPPFLAGS and not worry about --disable-werror affecting -Wundef errors. In the x86_64-linux-gnu build, the only new -Wundef errors were from generated syscall .S files. The make-syscalls.sh change solves those. I've verified that no generated code changes. The sysdeps/arm/Versions change fixes the one real bug that lack of -Wunder for assembly was causing: the SHLIB_COMPAT clause in arm-mcount.S was not hitting correctly. This might cause some new build failures for other machines that I did not test. If so, those were latent bugs that should be fixed in the assembly code. Nobody should be working around these by instead defeating -Wundef. Thanks, Roland * Makeconfig (ASFLAGS): Add -Werror=undef. * sysdeps/arm/Versions (libc: GLIBC_2.19): New (empty) version set. * sysdeps/unix/make-syscalls.sh: Always emit #define's for SYSCALL_CANCELLABLE, SYSCALL_NOERRNO, SYSCALL_ERRVAL, to 1 or 0. --- a/Makeconfig +++ b/Makeconfig @@ -948,7 +948,7 @@ endif ifndef ASFLAGS ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) endif -ASFLAGS += $(ASFLAGS-config) $(asflags-cpu) +ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) ifndef BUILD_CC BUILD_CC = $(CC) --- a/sysdeps/arm/Versions +++ b/sysdeps/arm/Versions @@ -17,4 +17,8 @@ libc { GLIBC_2.8 { __gnu_mcount_nc; } + GLIBC_2.19 { + # This set has to exist in some Versions file so we can use 2.19 in + # SHLIB_COMPAT. Since it didn't exist anywhere else, we add it here. + } } --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -250,14 +250,10 @@ while read file srcfile caller syscall args strong weak; do \$(make-target-directory) (echo '#define SYSCALL_NAME $syscall'; \\ echo '#define SYSCALL_NARGS $nargs'; \\ - echo '#define SYSCALL_SYMBOL $strong'; \\" - [ $cancellable = 0 ] || echo "\ - echo '#define SYSCALL_CANCELLABLE 1'; \\" - [ $noerrno = 0 ] || echo "\ - echo '#define SYSCALL_NOERRNO 1'; \\" - [ $errval = 0 ] || echo "\ - echo '#define SYSCALL_ERRVAL 1'; \\" - echo "\ + echo '#define SYSCALL_SYMBOL $strong'; \\ + echo '#define SYSCALL_CANCELLABLE $cancellable'; \\ + echo '#define SYSCALL_NOERRNO $noerrno'; \\ + echo '#define SYSCALL_ERRVAL $errval'; \\ echo '#include '; \\" ;; esac