From patchwork Sun Sep 21 08:11:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 391642 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 A38CF1400E7 for ; Sun, 21 Sep 2014 18:11:57 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=tDJ obAyzsI8Shu7AOBNmus4ZvK3NagCnXxoVrIFAXn5TYVqwccsatf9Tz1RPnML1hBx peWetU19bcoEdKAUqEUnXhqV12x5B+/p6Qw6oZBnn76XhhR8QTABFmCDwUxHNL/u /g+0Ax78LUFtXQ9WTxE6xQs5CnrubYnhY5bOsup0= 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:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=nO1kHzfDg umaOuw50KZn3jjEjQQ=; b=doYlbxzNHggIOttA6zck3Ir31RZwI2Rz2r7Ge0MrC hOjjsWobmNctiMWa/J3p2uBCYfeCXR8bEg6QG3sWcPgSYb567F1KuOvUPQQFirte WO6PVZsY91EM/TlDgzg0y4CuT41MoSprSLUVyjNJadZmBNf/BBbTa+S608gW3S8V MQ= Received: (qmail 20315 invoked by alias); 21 Sep 2014 08:11:37 -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 20292 invoked by uid 89); 21 Sep 2014 08:11:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f45.google.com X-Received: by 10.66.227.161 with SMTP id sb1mr13334818pac.51.1411287092578; Sun, 21 Sep 2014 01:11:32 -0700 (PDT) Message-ID: <541E883C.1020600@gmail.com> Date: Sun, 21 Sep 2014 16:11:40 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Michael Eager , roland@hack.frob.com, libc-alpha@sourceware.org, gcc-patches List Subject: [PATCH] glibc/sysdeps/microblaze/bits/atomic.h: Avoid include recursion to cause compiling break The related definitions are in 'atomic.h', which also need include 'lowlevellock.h', which also need the related functions in 'atomic.h'. The related configuration: ../glibc/configure --prefix /upstream/release/ \ --target=microblaze-linux-gnu --with-headers=/upstream/release/kernel \ --host=microblaze-linux-gnu [root@localhost build-glibc]# cat configparms CC=/usr/local/bin/microblaze-gchen-linux-gcc BUILD_CC=gcc LD=/usr/local/bin/microblaze-gchen-linux-ld NM=/usr/local/bin/microblaze-gchen-linux-nm AS=/usr/local/bin/microblaze-gchen-linux-as AR=/usr/local/bin/microblaze-gchen-linux-ar RANLIB=/usr/local/bin/microblaze-gchen-linux-ranlib The related error: /usr/local/bin/microblaze-gchen-linux-gcc assert.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -Werror=implicit-function-declaration -DFATAL_PREPARE_INCLUDE='' -I../include -I/upstream/build-glibc/assert -I/upstream/build-glibc -I../sysdeps/unix/sysv/linux/microblaze -I../sysdeps/microblaze/nptl -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/microblaze -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include -isystem /upstream/release/kernel -D_LIBC_REENTRANT -include ../include/libc-symbols.h -o /upstream/build-glibc/assert/assert.o -MD -MP -MF /upstream/build-gli bc/assert/assert.o.dt -MT /upstream/build-glibc/assert/assert.o In file included from ../nptl/descr.h:30:0, from ../sysdeps/microblaze/nptl/tls.h:54, from ../include/errno.h:27, from ../sysdeps/unix/sysv/linux/microblaze/sysdep.h:27, from ../sysdeps/microblaze/bits/atomic.h:20, from ../include/atomic.h:50, from assert.c:19: ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_cond_lock': ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:208:27: error: implicit declaration of function 'atomic_exchange_acq' [-Werror=implicit-function-declaration] if (__builtin_expect (atomic_exchange_acq (futex, 2), 0)) ^ ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_timedlock': ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:226:25: error: implicit declaration of function 'atomic_compare_and_exchange_val_acq' [-Werror=implicit-function-declaration] if (__builtin_expect (atomic_compare_and_exchange_val_acq (futex, 1, 0), 0) != 0) ^ ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_robust_timedlock': ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:238:25: error: implicit declaration of function 'atomic_compare_and_exchange_bool_acq' [-Werror=implicit-function-declaration] if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, id, 0), 0)) ^ cc1: some warnings being treated as errors Signed-off-by: Chen Gang --- sysdeps/microblaze/bits/atomic.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sysdeps/microblaze/bits/atomic.h b/sysdeps/microblaze/bits/atomic.h index 77004a0..c8d8d9c 100644 --- a/sysdeps/microblaze/bits/atomic.h +++ b/sysdeps/microblaze/bits/atomic.h @@ -17,7 +17,6 @@ . */ #include -#include typedef int8_t atomic8_t; @@ -267,3 +266,13 @@ typedef uintmax_t uatomic_max_t; }) #define atomic_decrement(mem) ({ atomic_decrement_val (mem); (void) 0; }) + +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + ({ /* Cannot use __oldval here, because macros later in this file might \ + call this macro with __oldval argument. */ \ + __typeof (oldval) __atg3_old = (oldval); \ + atomic_compare_and_exchange_val_acq (mem, newval, __atg3_old) \ + != __atg3_old; \ + }) + +#include