Re: [PATCH] arm64: build with -mcmodel=large

2016-01-22 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 22.01.2016 03:14, Colin Watson wrote:
> On Fri, Dec 25, 2015 at 06:18:55PM +, Leif Lindholm wrote:
>> So, it seems this toolchain generates the HI21/LO12 relocation combo:
>> - R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_ADR_PREL_PG_HI21_NC
>> - R_AARCH64_LDST16_ABS_LO12_NC
>> - R_AARCH64_LDST32_ABS_LO12_NC
>> - R_AARCH64_LDST64_ABS_LO12_NC
>> - R_AARCH64_LDST128_ABS_LO12_NC
>>
>> So I'll implement support for these.
> 
> I found a temporary workaround for this via
> https://bugs.launchpad.net/bugs/1533009, which refers to
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63304; given that set of
> clues, I've confirmed that TARGET_CFLAGS='-Os
> -mpc-relative-literal-loads' fixes my build for the time being.
> 
> This isn't necessarily a good solution for upstream, because only
> certain versions of GCC support it (although perhaps we could detect it
> in configure.ac until such time as appropriate relocation support is
> added?), but I'm mentioning it here in case any other distributors have
> the same problem.
> 
I have implemented and committed the support for needed relocations



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] arm64: build with -mcmodel=large

2016-01-21 Thread Colin Watson
On Fri, Dec 25, 2015 at 06:18:55PM +, Leif Lindholm wrote:
> So, it seems this toolchain generates the HI21/LO12 relocation combo:
> - R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_ADR_PREL_PG_HI21_NC
> - R_AARCH64_LDST16_ABS_LO12_NC
> - R_AARCH64_LDST32_ABS_LO12_NC
> - R_AARCH64_LDST64_ABS_LO12_NC
> - R_AARCH64_LDST128_ABS_LO12_NC
> 
> So I'll implement support for these.

I found a temporary workaround for this via
https://bugs.launchpad.net/bugs/1533009, which refers to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63304; given that set of
clues, I've confirmed that TARGET_CFLAGS='-Os
-mpc-relative-literal-loads' fixes my build for the time being.

This isn't necessarily a good solution for upstream, because only
certain versions of GCC support it (although perhaps we could detect it
in configure.ac until such time as appropriate relocation support is
added?), but I'm mentioning it here in case any other distributors have
the same problem.

-- 
Colin Watson   [cjwat...@ubuntu.com]

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] arm64: build with -mcmodel=large

2015-12-31 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 25.12.2015 19:18, Leif Lindholm wrote:
> On Thu, Dec 24, 2015 at 04:20:29AM +, Colin Watson wrote:
>> On Thu, Dec 24, 2015 at 04:14:20AM +, Colin Watson wrote:
>>> This fixes a build failure with very current GCC versions, such as the one
>>> in Ubuntu xenial.  Leif (or anyone with suitable arm64 systems), would you
>>> mind testing that this doesn't break things?  I've tested that it builds
>>> cleanly now, but I don't have a particularly convenient way to do any
>>> run-time tests.
>>
>> Never mind, I spoke too soon and withdraw this patch, since this doesn't
>> actually fix the problem, which is:
>>
>>   $ obj/grub-efi-arm64/grub-mkimage -O arm64-efi -o test.efi -d 
>> obj/grub-efi-arm64/grub-core -p /boot/grub -v ext2
>>   obj/grub-efi-arm64/grub-mkimage: info: the total module size is 0x37e8.
> 
> *snip*
> 
>>   obj/grub-efi-arm64/grub-mkimage: info: dealing with the relocation section 
>> .rela.text for .text.
>>   obj/grub-efi-arm64/grub-mkimage: error: relocation 0x113 is not 
>> implemented yet.
>>
>> Would anyone arm64-knowledgeable mind taking a look at this?
> 
> So, it seems this toolchain generates the HI21/LO12 relocation combo:
> - R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_ADR_PREL_PG_HI21_NC
> - R_AARCH64_LDST16_ABS_LO12_NC
> - R_AARCH64_LDST32_ABS_LO12_NC
> - R_AARCH64_LDST64_ABS_LO12_NC
> - R_AARCH64_LDST128_ABS_LO12_NC
> 
> So I'll implement support for these.
> 
I'm looking forward for those patches
Unfortunately missing relocation support is common problem. I added a
verifier in build system to catch it on build time rather than runtime
> With regards to your -mcmodel=large patch - that didn't change
> anything because I already hardcoded that into
> conf/Makefile.common. Your suggested patch is probably the better way
> of doing it - so do consider pushing that anyway (dropping the
> Makefile.common stanza at the same time).
> 
> /
> Leif
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] arm64: build with -mcmodel=large

2015-12-31 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 25.12.2015 19:18, Leif Lindholm wrote:
> On Thu, Dec 24, 2015 at 04:20:29AM +, Colin Watson wrote:
>> On Thu, Dec 24, 2015 at 04:14:20AM +, Colin Watson wrote:
>>> This fixes a build failure with very current GCC versions, such as the one
>>> in Ubuntu xenial.  Leif (or anyone with suitable arm64 systems), would you
>>> mind testing that this doesn't break things?  I've tested that it builds
>>> cleanly now, but I don't have a particularly convenient way to do any
>>> run-time tests.
>>
>> Never mind, I spoke too soon and withdraw this patch, since this doesn't
>> actually fix the problem, which is:
>>
>>   $ obj/grub-efi-arm64/grub-mkimage -O arm64-efi -o test.efi -d 
>> obj/grub-efi-arm64/grub-core -p /boot/grub -v ext2
>>   obj/grub-efi-arm64/grub-mkimage: info: the total module size is 0x37e8.
> 
> *snip*
> 
>>   obj/grub-efi-arm64/grub-mkimage: info: dealing with the relocation section 
>> .rela.text for .text.
>>   obj/grub-efi-arm64/grub-mkimage: error: relocation 0x113 is not 
>> implemented yet.
>>
>> Would anyone arm64-knowledgeable mind taking a look at this?
> 
> So, it seems this toolchain generates the HI21/LO12 relocation combo:
> - R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_ADR_PREL_PG_HI21_NC
> - R_AARCH64_LDST16_ABS_LO12_NC
> - R_AARCH64_LDST32_ABS_LO12_NC
> - R_AARCH64_LDST64_ABS_LO12_NC
> - R_AARCH64_LDST128_ABS_LO12_NC
> 
> So I'll implement support for these.
> 
relocations 264, 266, 268, 269 are also missing
> With regards to your -mcmodel=large patch - that didn't change
> anything because I already hardcoded that into
> conf/Makefile.common. Your suggested patch is probably the better way
> of doing it - so do consider pushing that anyway (dropping the
> Makefile.common stanza at the same time).
> 
> /
> Leif
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] arm64: build with -mcmodel=large

2015-12-25 Thread Leif Lindholm
On Thu, Dec 24, 2015 at 04:20:29AM +, Colin Watson wrote:
> On Thu, Dec 24, 2015 at 04:14:20AM +, Colin Watson wrote:
> > This fixes a build failure with very current GCC versions, such as the one
> > in Ubuntu xenial.  Leif (or anyone with suitable arm64 systems), would you
> > mind testing that this doesn't break things?  I've tested that it builds
> > cleanly now, but I don't have a particularly convenient way to do any
> > run-time tests.
> 
> Never mind, I spoke too soon and withdraw this patch, since this doesn't
> actually fix the problem, which is:
> 
>   $ obj/grub-efi-arm64/grub-mkimage -O arm64-efi -o test.efi -d 
> obj/grub-efi-arm64/grub-core -p /boot/grub -v ext2
>   obj/grub-efi-arm64/grub-mkimage: info: the total module size is 0x37e8.

*snip*

>   obj/grub-efi-arm64/grub-mkimage: info: dealing with the relocation section 
> .rela.text for .text.
>   obj/grub-efi-arm64/grub-mkimage: error: relocation 0x113 is not implemented 
> yet.
> 
> Would anyone arm64-knowledgeable mind taking a look at this?

So, it seems this toolchain generates the HI21/LO12 relocation combo:
- R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_ADR_PREL_PG_HI21_NC
- R_AARCH64_LDST16_ABS_LO12_NC
- R_AARCH64_LDST32_ABS_LO12_NC
- R_AARCH64_LDST64_ABS_LO12_NC
- R_AARCH64_LDST128_ABS_LO12_NC

So I'll implement support for these.

With regards to your -mcmodel=large patch - that didn't change
anything because I already hardcoded that into
conf/Makefile.common. Your suggested patch is probably the better way
of doing it - so do consider pushing that anyway (dropping the
Makefile.common stanza at the same time).

/
Leif

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] arm64: build with -mcmodel=large

2015-12-23 Thread Colin Watson
This fixes a build failure with very current GCC versions, such as the one
in Ubuntu xenial.  Leif (or anyone with suitable arm64 systems), would you
mind testing that this doesn't break things?  I've tested that it builds
cleanly now, but I don't have a particularly convenient way to do any
run-time tests.

Colin Watson (1):
  arm64: build with -mcmodel=large

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.6.4

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] arm64: build with -mcmodel=large

2015-12-23 Thread Colin Watson
This matches some other 64-bit architectures, and fixes a build failure
with current GCC versions: when using the default (small) memory model,
they generate relocations that grub-mkimage doesn't understand.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 3300545..bbb7b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1083,7 +1083,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
 
 LDFLAGS="$TARGET_LDFLAGS"
 
-if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then
+if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test 
"$target_cpu" = arm64; then
   # Use large model to support 4G memory
   AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
 CFLAGS="$TARGET_CFLAGS -mcmodel=large"
-- 
2.6.4

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] arm64: build with -mcmodel=large

2015-12-23 Thread Colin Watson
On Thu, Dec 24, 2015 at 04:14:20AM +, Colin Watson wrote:
> This fixes a build failure with very current GCC versions, such as the one
> in Ubuntu xenial.  Leif (or anyone with suitable arm64 systems), would you
> mind testing that this doesn't break things?  I've tested that it builds
> cleanly now, but I don't have a particularly convenient way to do any
> run-time tests.

Never mind, I spoke too soon and withdraw this patch, since this doesn't
actually fix the problem, which is:

  $ obj/grub-efi-arm64/grub-mkimage -O arm64-efi -o test.efi -d 
obj/grub-efi-arm64/grub-core -p /boot/grub -v ext2
  obj/grub-efi-arm64/grub-mkimage: info: the total module size is 0x37e8.
  obj/grub-efi-arm64/grub-mkimage: info: reading 
obj/grub-efi-arm64/grub-core/kernel.img.
  obj/grub-efi-arm64/grub-mkimage: info: locating the section .text at 0x0.
  obj/grub-efi-arm64/grub-mkimage: info: locating the section .rodata at 0xa200.
  obj/grub-efi-arm64/grub-mkimage: info: locating the section .rodata.str1.1 at 
0xa2a6.
  obj/grub-efi-arm64/grub-mkimage: info: locating the section .data at 0xbbf8.
  obj/grub-efi-arm64/grub-mkimage: info: locating the section .bss at 0xcc60.
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0x400 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0xa600 (0xa600).
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0xa6a6 (0xa6a6).
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0xbff8 (0xbff8).
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0xd060 (0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating  at 0x400 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_strlen at 0x83e4 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_net_poll_cards_idle at 
0xeda0 (0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_finish_boot_services 
at 0x3368 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_disk_get_size at 0x5ac8 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_file_progress_hook at 
0x18e88 (0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efidisk_fini at 0xd44 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_arm64_set_26_offset 
at 0x9a0 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_puts_ at 0x80c0 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_millisleep at 0x45e8 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_fs_autoload_hook at 
0xeb80 (0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_allocate_pages_max 
at 0x30c0 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_fs_blocklist at 0xc150 
(0xbff8).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_errmsg at 0x18d80 
(0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_strncmp at 0x819c 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_strtoull at 0x850c 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_system_table at 
0xeda8 (0xd060).
  obj/grub-efi-arm64/grub-mkimage: info: locating memmove at 0x8064 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_disk_open at 0x5528 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_locate_protocol at 
0x1dc4 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_env_update_get_sorted at 
0x6c90 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_strcpy at 0x80a8 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_partition_probe at 
0x99d0 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_strrchr at 0x81fc 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_partition_get_name at 
0x9c10 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_dl_load at 0x68c0 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_stall at 0x1fe0 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_efi_get_filename at 
0x2498 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_env_export at 0x6db0 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_xvasprintf at 0x9340 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_error_push at 0x6ed8 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating __bswapsi2 at 0xa4d0 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_rescue_run at 0xa208 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_xasprintf at 0x93e0 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_realloc at 0x4510 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_exit at 0x2020 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating memcpy at 0x8064 (0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_memmove at 0x8064 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating grub_device_open at 0x4cd0 
(0x400).
  obj/grub-efi-arm64/grub-mkimage: info: locating 
grub_register_exported_symbols