From: 张忠山 <zzs213@126.com>
To: barebox@lists.infradead.org
Cc: 我 <zzs213@126.com>
Subject: Re: bugfix: _barebox_image_size wrong if enable
Date: Tue, 18 Jun 2019 18:17:52 +0800 [thread overview]
Message-ID: <af35c2a1-420e-c2a4-0856-c6b667890a5e@126.com> (raw)
In-Reply-To: <20190618074606.iq3i6gb5yazs5bfq@pengutronix.de>
> No, it is corrected during runtime in relocate_to_current_adr(). It
> seems older compilers need a runtime relocation fixup for this.
Yes, in relocate_to_current_adr() the address all be fixed up.
But if _barebox_image_size, __bss_start and __bss_stop all zero. the
barebox_base calculated by arm_mem_barebox_image() would wrong. but because it
align the base to 1M. So mostly it works fine. If the barebox size larger than
1M. It should fail.
>
> AFAIR this only happened for linker variables that point to absolute
> addresses. Differences between addresses also worked with the older
> compilers, and I think this is what your patch does:
No. my patch just for new toolchain. with old toolchain it has no effect,
Because all of the size is zero.
By using the newer toolchain:
arm-poky-eabi-gcc (GCC) 8.2.0
GNU ld (GNU Binutils) 2.31.1.20180818
In barebox config file:
CONFIG_TEXT_BASE=0x23e00000
CONFIG_RELOCATABLE=y
Without my patch, in barebox.map
0x000000000001ff40 __bss_start = .
0x0000000000021bec __bss_stop = .
0x0000000000021bec _end = .
0xffffffffdc21ff40 _barebox_image_size = (__bss_start - 0x23e00000)
In code, printout barebox_base calculated by arm_mem_barebox_image():
barebox_image_size : 0xdc21ff40
__bss_stop : 0x00021bec
__bss_start : 0x0001ff40
membase : 0x20000000
endmem : 0x60000000
barebox_base: 0x83d00000
barebox_base outof memory region!
After using my patch, the outpus is:
barebox_image_size : 0x0001ff40
__bss_stop : 0x00021bec
__bss_start : 0x0001ff40
membase : 0x20000000
endmem : 0x60000000
barebox_base: 0x5ff00000
--
Best Regards,
zzs
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-06-18 10:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 13:37 张忠山
2019-06-18 7:46 ` Sascha Hauer
2019-06-18 10:17 ` 张忠山 [this message]
2019-06-24 3:37 ` 张忠山
2019-06-26 7:20 ` Sascha Hauer
2019-06-26 9:39 ` 张忠山
2019-06-27 10:30 ` Sascha Hauer
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=af35c2a1-420e-c2a4-0856-c6b667890a5e@126.com \
--to=zzs213@126.com \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox