[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64812] Support for relocation type in grub2
From: |
Leung Wing Chung |
Subject: |
[bug #64812] Support for relocation type in grub2 |
Date: |
Tue, 24 Oct 2023 21:48:48 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?64812>
Summary: Support for relocation type in grub2
Group: GNU GRUB
Submitter: l00862805
Submitted: Wed 25 Oct 2023 01:48:46 AM UTC
Category: Compilation
Severity: Major
Priority: 5 - Normal
Item Group: Feature Request
Status: None
Privacy: Public
Assigned to: None
Originator Name: Ricky Leung
Originator Email:
Open/Closed: Open
Release: 2.00
Release:
Discussion Lock: Any
Reproducibility: Every Time
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 25 Oct 2023 01:48:46 AM UTC By: Leung Wing Chung <l00862805>
I am a compiler engineer currently working on a project to run Grub2 with
Clang + LLVM instead of GCC. I wanted to reach out to the community to discuss
an issue and inquire about your plans to support relocation type.
When I am building Grub2 with `time osc build --root=$(pwd)/build `, I
received the following error message: "unsupported relocation 0x108".
Upon further investigation, I discovered that this error is due to the
different approaches used by GCC and LLVM when handling relocations.
Specifically, when compiling the code with GCC using the `-mcmodel=large`
flag, the relocation types `R_AARCH64_ADR_PRE`, `R_AARCH64_ADD_ABS`, and
`R_AARCH64_ABS64` were used. However, when using LLVM with the same flag, the
relocation type `R_AARCH64_MOVW_UABS_G0_NC` was encountered. Here's the
example:
test.c:
```c
const char *test(void){
return "xx";
}
```
Execution with GCC:
```cmd
$ gcc -o test.o -c test.c -mcmodel=large
$ readelf -r test.o
Relocation section '.rela.text' at offset 0x200 contains 3 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000000 000200000113 R_AARCH64_ADR_PRE 0000000000000000 .text + 10
000000000004 000200000115 R_AARCH64_ADD_ABS 0000000000000000 .text + 10
000000000010 000500000101 R_AARCH64_ABS64 0000000000000000 .rodata + 0
Relocation section '.rela.eh_frame' at offset 0x248 contains 1 entry:
Offset Info Type Sym. Value Sym. Name +
Addend
00000000001c 000200000105 R_AARCH64_PREL32 0000000000000000 .text + 0
```
Execution with Clang:
```cmd
$ clang -o test.o -c test.c -mcmodel=large
$ readelf -r test.o
Relocation section '.rela.text' at offset 0x1c0 contains 4 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000000 000700000108 R_AARCH64_MOVW_UA 0000000000000000 .rodata.str1.1 +
0
000000000004 00070000010a R_AARCH64_MOVW_UA 0000000000000000 .rodata.str1.1 +
0
000000000008 00070000010c R_AARCH64_MOVW_UA 0000000000000000 .rodata.str1.1 +
0
00000000000c 00070000010d R_AARCH64_MOVW_UA 0000000000000000 .rodata.str1.1 +
0
Relocation section '.rela.eh_frame' at offset 0x220 contains 1 entry:
Offset Info Type Sym. Value Sym. Name +
Addend
00000000001c 000600000104 R_AARCH64_PREL64 0000000000000000 .text + 0
```
To address this issue and ensure compatibility across different compilers, I
would like to know if there are any plans to support relocation type in Grub2.
his would enable seamless compilation and execution of Grub2 using both GCC
and LLVM with the `-mcmodel=large` flag.
Thank you for your time and contributions.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64812>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #64812] Support for relocation type in grub2,
Leung Wing Chung <=