All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Feng Tang <feng.tang@intel.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: lkp <lkp@intel.com>,
	"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: {standard input}:577: Error: unsupported relocation against base
Date: Tue, 16 Feb 2021 20:36:02 +1100	[thread overview]
Message-ID: <87lfbouzgd.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20210205100821.GA71063@shbuild999.sh.intel.com>

Feng Tang <feng.tang@intel.com> writes:
> Hi Christophe and Michael,
>
> On Mon, Jan 18, 2021 at 10:24:08PM +0800, Christophe Leroy wrote:
>> 
>> Le 05/01/2021 ? 11:58, kernel test robot a 閏rit :
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
>> > commit: 8b8319b181fd9d6821703fef1228b4dcde613a16 powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
>> 
>> I see no link with that commit. Looks like the problem has been existing for some time.
>> It exists on the commit before that one, it exists on v5.9 and it exists on v5.10 with that commit
>> reverted.
>  
> Yes, this seems to be a long-standing issue, and we just double checked
> this compile error. 
>
> It happend when compiling arch/powerpc/platforms/44x/fsp2.c, macro
> 'mfdcr' requirs an instant number as parameter, while is not met by
> show_plbopb_regs(). Changing show_plbopb_regs() from function to
> a macro fixes the error, as the patch below:
>
> Thanks,
> Feng
>
>
> From 3bcb9638afc873d0e803aea1aad4f77bf1c2f6f6 Mon Sep 17 00:00:00 2001
> From: Feng Tang <feng.tang@intel.com>
> Date: Fri, 5 Feb 2021 16:08:43 +0800
> Subject: [PATCH] powerpc/44x/fsp2: fix a compiling error regarding macro
>  'mdfcr'
>
> 0day's kbuild test found error:
>
> "
>   CC      arch/powerpc/platforms/44x/fsp2.o
>
>   {standard input}:577: Error: unsupported relocation against base
>   {standard input}:580: Error: unsupported relocation against base
>   {standard input}:583: Error: unsupported relocation against base
> "
>
> The reason is macro 'mfdcr' requirs an instant number as parameter,
> which is not met by show_plbopb_regs().

It doesn't require a constant, it checks if the argument is constant:

#define mfdcr(rn)						\
	({unsigned int rval;					\
	if (__builtin_constant_p(rn) && rn < 1024)		\
		asm volatile("mfdcr %0," __stringify(rn)	\
		              : "=r" (rval));			\
	else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR)))	\
		rval = mfdcrx(rn);				\
	else							\
		rval = __mfdcr(rn);				\
	rval;})

But the error you're seeing implies the compiler is choosing the first
leg of the if, even when rn == "base + x", which is surprising.

We've had cases in the past of __builtin_constant_p() returning false
for things that a human can see are constant at build time, but I've
never seen the reverse.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: kbuild-all@lists.01.org
Subject: Re: {standard input}:577: Error: unsupported relocation against base
Date: Tue, 16 Feb 2021 20:36:02 +1100	[thread overview]
Message-ID: <87lfbouzgd.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20210205100821.GA71063@shbuild999.sh.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2449 bytes --]

Feng Tang <feng.tang@intel.com> writes:
> Hi Christophe and Michael,
>
> On Mon, Jan 18, 2021 at 10:24:08PM +0800, Christophe Leroy wrote:
>> 
>> Le 05/01/2021 ? 11:58, kernel test robot a 閏rit :
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
>> > commit: 8b8319b181fd9d6821703fef1228b4dcde613a16 powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
>> 
>> I see no link with that commit. Looks like the problem has been existing for some time.
>> It exists on the commit before that one, it exists on v5.9 and it exists on v5.10 with that commit
>> reverted.
>  
> Yes, this seems to be a long-standing issue, and we just double checked
> this compile error. 
>
> It happend when compiling arch/powerpc/platforms/44x/fsp2.c, macro
> 'mfdcr' requirs an instant number as parameter, while is not met by
> show_plbopb_regs(). Changing show_plbopb_regs() from function to
> a macro fixes the error, as the patch below:
>
> Thanks,
> Feng
>
>
> From 3bcb9638afc873d0e803aea1aad4f77bf1c2f6f6 Mon Sep 17 00:00:00 2001
> From: Feng Tang <feng.tang@intel.com>
> Date: Fri, 5 Feb 2021 16:08:43 +0800
> Subject: [PATCH] powerpc/44x/fsp2: fix a compiling error regarding macro
>  'mdfcr'
>
> 0day's kbuild test found error:
>
> "
>   CC      arch/powerpc/platforms/44x/fsp2.o
>
>   {standard input}:577: Error: unsupported relocation against base
>   {standard input}:580: Error: unsupported relocation against base
>   {standard input}:583: Error: unsupported relocation against base
> "
>
> The reason is macro 'mfdcr' requirs an instant number as parameter,
> which is not met by show_plbopb_regs().

It doesn't require a constant, it checks if the argument is constant:

#define mfdcr(rn)						\
	({unsigned int rval;					\
	if (__builtin_constant_p(rn) && rn < 1024)		\
		asm volatile("mfdcr %0," __stringify(rn)	\
		              : "=r" (rval));			\
	else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR)))	\
		rval = mfdcrx(rn);				\
	else							\
		rval = __mfdcr(rn);				\
	rval;})

But the error you're seeing implies the compiler is choosing the first
leg of the if, even when rn == "base + x", which is surprising.

We've had cases in the past of __builtin_constant_p() returning false
for things that a human can see are constant@build time, but I've
never seen the reverse.

cheers

  reply	other threads:[~2021-02-16  9:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 10:58 {standard input}:577: Error: unsupported relocation against base kernel test robot
2021-01-05 10:58 ` kernel test robot
2021-01-18 14:24 ` Christophe Leroy
2021-02-05 10:08   ` Feng Tang
2021-02-05 10:08     ` Feng Tang
2021-02-16  9:36     ` Michael Ellerman [this message]
2021-02-16  9:36       ` Michael Ellerman
2021-02-16 22:06       ` Segher Boessenkool
2021-02-17  5:43         ` Michael Ellerman
2021-02-17  5:43           ` Michael Ellerman
2021-02-17 15:37           ` Segher Boessenkool
2021-02-17 10:49       ` Feng Tang
2021-02-17 10:49         ` Feng Tang
2021-02-18 11:08         ` Michael Ellerman
2021-02-18 11:08           ` Michael Ellerman

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=87lfbouzgd.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=christophe.leroy@csgroup.eu \
    --cc=feng.tang@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=segher@kernel.crashing.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.