[U-Boot] [PATCH 4/4] WIP: travis: Add qemu-x86_64 target for test.py testing

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Oct 12 21:02:04 UTC 2018


On 10/12/2018 03:45 AM, Bin Meng wrote:
> Hi Heinrich,
> 
> On Fri, Oct 12, 2018 at 6:10 AM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>
>> On 10/11/2018 03:57 AM, Bin Meng wrote:
>>> Hi Heinrich,
>>>
>>> On Thu, Oct 11, 2018 at 9:48 AM Bin Meng <bmeng.cn at gmail.com> wrote:
>>>>
>>>> Add qemu-x86_64 to the list of targets we use for test.py runs.
>>>>
>>>> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>>>>
>>>> ---
>>>> testp.py testing is currently failing at 'bootefi selftest'.
>>>>
>>>
>>> Can you try this series for the 'bootefi selftest' testing?
>>
>> I am clueless why the EFI subsystems is failing completely on
>> qemu-x86_64_defconfig.
>>
>> Any printf() or puts() statement I put into
>> lib/efi_loader/efi_boottime.c leads to no output at all.
>>
>> I connected gdb with
>>
>> gdb u-boot -ex 'target remote localhost:1234'
>> add-symbol-file u-boot <relocaddr>
>>
>> But the debugger did not stop at breakpoints.
> 
> I encountered exactly the same issue that breakpoint is not hit when
> debugging this endless loop issue. And I finally figured it out:
> 
> The symbol table should not be loaded to <relocaddr>, instead it needs
> to be loaded to <relocaddr + .text - .text.start>.
> 
> The .text.start was introduced in commit
> 7e21fbca26d18327cf7cabaad08df276a06a07d8 "efi_loader: Rename sections
> to allow for implicit data", and its commit message mentioned: [agraf:
> Fix x86_64 breakage], although I was not sure what x86_64 breakage was
> fixed.
> 
> Please have a try.
> 
> Regards,
> Bin
> 

Hello Bin,

thanks for your hint. Now I was able to debug the problem.

The code is not correctly relocated.

Function do_elf_reloc_fixups64() only analyzes re_src->r_offset but not
the relocation type.

I put a print statement into the relocation loop and found the
relocation type of the first relocation to be reported as having an
illegal value of 0x10ff70. All other relocation types were reported as
0x8 as expected.

diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index ed10755d9c..095374830f 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -55,6 +55,7 @@ static void do_elf_reloc_fixups64(unsigned int
text_base, uintptr_t size,
do {
.   /* Get the location from the relocation entry */
.   offset_ptr_rom = (Elf64_Addr *)(uintptr_t)re_src->r_offset;
+   printf("Reloc type %llx\n", ELF64_R_TYPE(re_src->r_info));
.
.   /* Check that the location of the relocation is in .text */
.   if (offset_ptr_rom >= (Elf64_Addr *)(uintptr_t)text_base &&


Reloc type 10ff70
Reloc type 8
Reloc type 8
Reloc type 8
..


The relocation types in efi_runtime_relocate() are complete garbage:

efi_runtime_relocate: 8
efi_runtime_relocate: 30
efi_runtime_relocate: b0
efi_runtime_relocate: 8
efi_runtime_relocate: 50
efi_runtime_relocate: 20
efi_runtime_relocate: 8
efi_runtime_relocate: 60
efi_runtime_relocate: 20
efi_runtime_relocate: 8
efi_runtime_relocate: a0
efi_runtime_relocate: b5
efi_runtime_relocate: 8
efi_runtime_relocate: b0
efi_runtime_relocate: aa
efi_runtime_relocate: 8
efi_runtime_relocate: c0
efi_runtime_relocate: c0
efi_runtime_relocate: 8
efi_runtime_relocate: d0
efi_runtime_relocate: 68
efi_runtime_relocate: 8
efi_runtime_relocate: e0
efi_runtime_relocate: b5
efi_runtime_relocate: 8
efi_runtime_relocate: f0
efi_runtime_relocate: cb
efi_runtime_relocate: 8
efi_runtime_relocate: 0
efi_runtime_relocate: e1

I will send a patch for efi_runtime_relocate().

Bin, can you please, have a look at the first problem.

Best regards

Heinrich




More information about the U-Boot mailing list