[U-Boot] undefined reference to `environment'

Hi Simon / Tom,
It seems the SH4 build is failing with the current trunk. Or at least my test build is failing and the change seems to have nothing to do with the failure.
https://travis-ci.org/jhershbe/u-boot/jobs/269330102
Cheers, -Joe

+Thomas
Hi Joe,
On 29 August 2017 at 06:59, Joe Hershberger joe.hershberger@ni.com wrote:
Hi Simon / Tom,
It seems the SH4 build is failing with the current trunk. Or at least my test build is failing and the change seems to have nothing to do with the failure.
A bisect shows this came in with:
f40ad66f (refs/bisect/bad) arch/sh: don't bring common/env_embedded.o into the link
Thomas, could you please take a look?
Cheers, -Joe
Regards, Simon

Hello,
On Wed, 30 Aug 2017 04:16:39 +0800, Simon Glass wrote:
Hi Joe,
On 29 August 2017 at 06:59, Joe Hershberger joe.hershberger@ni.com wrote:
Hi Simon / Tom,
It seems the SH4 build is failing with the current trunk. Or at least my test build is failing and the change seems to have nothing to do with the failure.
A bisect shows this came in with:
f40ad66f (refs/bisect/bad) arch/sh: don't bring common/env_embedded.o into the link
Thomas, could you please take a look?
Sure, I'll have a look. I guess I should be able to reproduce by building ms7722se_defconfig ?
Best regards,
Thomas

Hello,
On Wed, 30 Aug 2017 04:16:39 +0800, Simon Glass wrote:
A bisect shows this came in with:
f40ad66f (refs/bisect/bad) arch/sh: don't bring common/env_embedded.o into the link
Thomas, could you please take a look?
env/embedded.o is missing in the link. It is added to extra-y by:
extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
I dumped extra-y right after this line, and it does contain embedded.o. However, it does not get added to the link stage.
Why is this an extra-$() rather than an obj-$() ?
Best regards,
Thomas

On Tue, Aug 29, 2017 at 4:50 PM, Thomas Petazzoni thomas.petazzoni@free-electrons.com wrote:
Hello,
On Wed, 30 Aug 2017 04:16:39 +0800, Simon Glass wrote:
A bisect shows this came in with:
f40ad66f (refs/bisect/bad) arch/sh: don't bring common/env_embedded.o into the link
Thomas, could you please take a look?
env/embedded.o is missing in the link. It is added to extra-y by:
extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
I dumped extra-y right after this line, and it does contain embedded.o. However, it does not get added to the link stage.
Why is this an extra-$() rather than an obj-$() ?
So there's something extra funny going on in the linking. See https://patchwork.ozlabs.org/patch/806263/ which I have included, but haven't been able to push out.

Hello,
On Tue, 29 Aug 2017 17:18:24 -0400, Tom Rini wrote:
So there's something extra funny going on in the linking. See https://patchwork.ozlabs.org/patch/806263/ which I have included, but haven't been able to push out.
At this point, I don't think it's the correct fix. I don't see why it should be the responsibility of the linker script to include env/embedded.o. Almost no other architecture has env/embedded.o referenced in its linker script. Only a few m68k platforms, with custom linker script in their include/configs/.h file include env/embedded.o in their linker script, plus one Freescale platform.
Again, changing extra- to obj- in env/Makefile also fixes the issue.
Thomas

On Wed, Aug 30, 2017 at 6:07 AM, Thomas Petazzoni thomas.petazzoni@free-electrons.com wrote:
Hello,
On Tue, 29 Aug 2017 17:18:24 -0400, Tom Rini wrote:
So there's something extra funny going on in the linking. See https://patchwork.ozlabs.org/patch/806263/ which I have included, but haven't been able to push out.
At this point, I don't think it's the correct fix. I don't see why it should be the responsibility of the linker script to include env/embedded.o. Almost no other architecture has env/embedded.o referenced in its linker script. Only a few m68k platforms, with custom linker script in their include/configs/.h file include env/embedded.o in their linker script, plus one Freescale platform.
Again, changing extra- to obj- in env/Makefile also fixes the issue.
Yep, looks to me obj- is the correct way to fix.
Regards, Bin

Hello,
On Tue, 29 Aug 2017 17:18:24 -0400, Tom Rini wrote:
env/embedded.o is missing in the link. It is added to extra-y by:
extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
I dumped extra-y right after this line, and it does contain embedded.o. However, it does not get added to the link stage.
Why is this an extra-$() rather than an obj-$() ?
So there's something extra funny going on in the linking. See https://patchwork.ozlabs.org/patch/806263/ which I have included, but haven't been able to push out.
How did you end up solving this problem? As I said, I don't think https://patchwork.ozlabs.org/patch/806263/ is the correct solution.
Best regards,
Thomas

On Thu, Sep 14, 2017 at 12:29:11AM +0200, Thomas Petazzoni wrote:
Hello,
On Tue, 29 Aug 2017 17:18:24 -0400, Tom Rini wrote:
env/embedded.o is missing in the link. It is added to extra-y by:
extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
I dumped extra-y right after this line, and it does contain embedded.o. However, it does not get added to the link stage.
Why is this an extra-$() rather than an obj-$() ?
So there's something extra funny going on in the linking. See https://patchwork.ozlabs.org/patch/806263/ which I have included, but haven't been able to push out.
How did you end up solving this problem? As I said, I don't think https://patchwork.ozlabs.org/patch/806263/ is the correct solution.
It wasn't my favorite patch but I wouldn't have let the original in if I had noticed the fail-to-build in the first place. So coming up with a better rework (and understanding of) why only that combination of settings was failing without forcing env/embedded.o being linked in is on the TODO list somewhere.
participants (5)
-
Bin Meng
-
Joe Hershberger
-
Simon Glass
-
Thomas Petazzoni
-
Tom Rini