LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sfr@canb.auug.org.au
Cc: mingo@elte.hu, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: linux-next: build failure
Date: Thu, 28 Aug 2008 00:40:32 -0700 (PDT) [thread overview]
Message-ID: <20080828.004032.234293354.davem@davemloft.net> (raw)
In-Reply-To: <20080825212833.38550575.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 25 Aug 2008 21:28:33 +1000
> Hi Ingo,
>
> Today's linux-next build (sparc64 defconfig) failed like this:
>
> ERROR: "__BUILD_BUG_ON_non_constant" [drivers/net/sunvnet.ko] undefined!
> ERROR: "__BUILD_BUG_ON_non_constant" [drivers/block/sunvdc.ko] undefined!
>
> Probably intorduced by commit f5b5d41dd51a31fe70e3a04fb80a3b90b84c6a4e
> ("debug: fix BUILD_BUG_ON() for non-constant expressions").
I think __builtin_constant_p() is not seeing something it
should here.
It isn't accepting:
--------------------
static inline __attribute__((const))
bool is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}
--------------------
and thus is_power_of_2(256) as being a constant.
If a 'const' inline function being passed a const argument isn't
constant, what is! :-)
I bet the problem is the fact that is_power_of_2() is a function.
I did some tests and I can only trigger this problem with gcc-3.4 on
sparc, gcc-4.1 and gcc-4.2 worked fine.
It triggers with both -O2 and -Os for the following simple test case:
static inline __attribute__((const))
int is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}
extern int bar;
int main(void)
{
if (!__builtin_constant_p(is_power_of_2(256)))
bar++;
return 0;
}
davem@sunset:~/src/GIT/linux-2.6$ gcc-3.4 -Os -o x x.c
/tmp/ccy8FzD8.o: In function `main':
x.c:(.text+0x0): undefined reference to `bar'
x.c:(.text+0x4): undefined reference to `bar'
x.c:(.text+0xc): undefined reference to `bar'
collect2: ld returned 1 exit status
davem@sunset:~/src/GIT/linux-2.6$ gcc-3.4 -O2 -o x x.c
/tmp/ccQNzZuj.o: In function `main':
x.c:(.text+0x0): undefined reference to `bar'
x.c:(.text+0x4): undefined reference to `bar'
x.c:(.text+0xc): undefined reference to `bar'
collect2: ld returned 1 exit status
davem@sunset:~/src/GIT/linux-2.6$
next prev parent reply other threads:[~2008-08-28 7:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-25 11:28 Stephen Rothwell
2008-08-25 12:40 ` Ingo Molnar
2008-08-28 7:40 ` David Miller [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-11-08 16:51 linux-next " Mark Salter
2013-10-30 15:27 Mark Salter
2013-10-30 20:37 ` Stephen Rothwell
2013-10-30 20:50 ` Andrew Morton
2013-10-30 23:17 ` Stephen Rothwell
2008-10-20 12:04 linux-next: " Stephen Rothwell
2008-10-20 15:48 ` Greg KH
2008-10-20 16:33 ` J.R. Mauro
2008-10-20 16:51 ` Greg KH
2008-10-20 20:47 ` Greg KH
2008-10-20 22:34 ` J.R. Mauro
2008-10-20 22:31 ` Stephen Rothwell
2008-07-29 6:23 Stephen Rothwell
2008-07-29 8:00 ` Ingo Molnar
2008-07-29 8:03 ` Stephen Rothwell
2008-07-29 8:58 ` Ingo Molnar
2008-07-29 11:28 ` KOSAKI Motohiro
2008-07-29 11:40 ` Ingo Molnar
2008-07-29 14:31 ` Mike Travis
2008-07-29 14:33 ` Mike Travis
2008-07-29 16:33 ` Linus Torvalds
2008-07-29 16:42 ` Ingo Molnar
2008-07-29 16:44 ` Linus Torvalds
2008-07-29 8:14 ` Wenji Huang
2008-07-29 16:26 ` Linus Torvalds
2008-07-28 5:07 Stephen Rothwell
2008-07-28 4:44 Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080828.004032.234293354.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sfr@canb.auug.org.au \
--subject='Re: linux-next: build failure' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).