Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do you have the plan for draft UEFI Specification for LoongArch about relocation type in PE format(LoongArch specially)? #9

Open
TYDQSoft opened this issue Jul 2, 2024 · 8 comments

Comments

@TYDQSoft
Copy link

TYDQSoft commented Jul 2, 2024

I have read the code in binutils for loongarch and it only provide three relocation constant.It is too few to use,I think.Do you have the plan for loongarch UEFI specification (for PE format in loongarch)?

@SixWeining
Copy link
Collaborator

Did you mean this https://learn.microsoft.com/en-us/windows/win32/debug/pe-format that already supports LoongArch?

image

@SixWeining
Copy link
Collaborator

Cc @yetist @kilaterlee who may know more details.

@xen0n
Copy link

xen0n commented Jul 8, 2024

Context (in Chinese): https://bbs.loongarch.org/d/443

I guess maybe the OP wants more complete relocs in PE, similar to the full set of R_LARCH_B*, R_LARCH_ABS*, R_LARCH_PCALA* etc., so that a complete PE toolchain could be made.

I agree that the OP should provide more information regarding their motivation and background etc. so we don't have to guess as much.

@TYDQSoft
Copy link
Author

TYDQSoft commented Jul 9, 2024

Did you mean this https://learn.microsoft.com/en-us/windows/win32/debug/pe-format that already supports LoongArch?

image

However,I need more loongarch-specific relocation constants such as IMAGE_REL_LOONGARCH_ABSOLUTE.

@driver1998
Copy link

driver1998 commented Jul 15, 2024

There are two constants defined in .NET PAL, not documented in PE spec (not sure if they are .NET specific):

IMAGE_REL_LOONGARCH64_PC
IMAGE_REL_LOONGARCH64_JIR

https://github.com/dotnet/runtime/blob/a5cc707d976a14495462c9c492a921ff0927b8f5/src/coreclr/pal/inc/rt/ntimage.h#L1021
implementation: https://github.com/dotnet/runtime/blob/af5e7150362294696d3d52aa2302062e4b7c8095/src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs#L542

@shushanhf
Copy link

shushanhf commented Jul 15, 2024

There are two constants defined in .NET PAL, not documented in PE spec (not sure if they are .NET specific):
IMAGE_REL_LOONGARCH64_PC IMAGE_REL_LOONGARCH64_JIR

No, these are only used for .NET and only LoongArch64's AOT within .NET.

@TYDQSoft
Copy link
Author

TYDQSoft commented Jul 15, 2024

There are two constants defined in .NET PAL, not documented in PE spec (not sure if they are .NET specific):

IMAGE_REL_LOONGARCH64_PC IMAGE_REL_LOONGARCH64_JIR

https://github.com/dotnet/runtime/blob/a5cc707d976a14495462c9c492a921ff0927b8f5/src/coreclr/pal/inc/rt/ntimage.h#L1021 implementation: https://github.com/dotnet/runtime/blob/af5e7150362294696d3d52aa2302062e4b7c8095/src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs#L542

So that's why draft UEFI specification for LoongArch about relocation type in PE format matters.I need a LoongArch64 relocation table for free pascal compiler.These .NET only constants are so disappointed for free pascal compiler users.

@driver1998
Copy link

From the code it looks like there is really only one relocation type supported in UEFI: IMAGE_REL_BASED_LOONGARCH64_MARK_LA.

So if you need to target UEFI, this is the one you need to use.

https://github.com/tianocore/edk2/blob/1bb9f47739ae7993191a36bea76c5a2157fdd10f/MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c#L43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants