x86: chromebook_coral: fix C block comment
PATCH 1/1 x86: chromebook_coral: fix C block comment
Fix a warning seen when compiling this dts file.
--- arch/x86/dts/chromebook_coral.dts | 1 + 1 file changed, 1 insertion(+)
arch/x86/dts/chromebook_coral.dts +1 -0
@@ -825,6 +825,7 @@ * Refer to EDS-Vol2-22.3 * [14:8] steps of delay for HS400, each 125ps * [6:0] steps of delay for SDR104/HS200, each 125ps + */ /* * EMMC TX DATA Delay 2
Signature · 1 line
2.30.2
PATCH 1/1 x86: Fix i8254 ifdef include guard
When building U-Boot with clang, it notices that the i8254.h include guard does not work correctly due to a typo. Fix it.
--- arch/x86/include/asm/i8254.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/i8254.h +1 -1
@@ -7,7 +7,7 @@/* i8254.h Intel 8254 PIT registers */ #ifndef _ASMI386_I8254_H_ -#define _ASMI386_I8954_H_ +#define _ASMI386_I8254_H_#define PIT_T0 0x00/* PIT channel 0 count/status */ #define PIT_T1 0x01/* PIT channel 1 count/status */
Signature · 1 line
2.30.2
PATCH 1/1 efi_loader: Fix link of EFI apps with ld.lld
In reply to Alistair DelvaWhen compiling U-Boot with ld.lld as the linker, the helloworld EFI app example fails to link:
LD lib/efi_loader/helloworld_efi.so
ld.lld: error: section: .dynamic is not contiguous with other relro
sections
LLD will always create RELRO program header regardless of target emulation, whereas BFD may automatically disable it for unsupported targets. Add -znorelro to disable it explicitly in all cases.
--- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
@@ -403,7 +403,7 @@ $(obj)/%.efi: $(obj)/%_efi.so quiet_cmd_efi_ld = LD $@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ - -Bsymbolic -s $^ -o $@ + -Bsymbolic -znorelro -s $^ -o $@ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
Signature · 1 line
2.30.2
PATCH 1/1 arm64: relocate-rela: Add support for ld.lld
In reply to Alistair DelvaCap end of relocations by the binary size.
Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but reloc_rela still tries to relocate them, resulting in attempted read past the end of file.
When linking U-Boot with ld.lld, the STATIC_RELA feature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and without CONFIG_STATIC_RELA.
Originally-from: Elena Petrova <[email protected]>
--- tools/relocate-rela.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tools/relocate-rela.c +17 -3
@@ -63,7 +63,7 @@ int main(int argc, char **argv) {FILE *f;int i, num; -uint64_t rela_start, rela_end, text_base; +uint64_t rela_start, rela_end, text_base, file_size;if (argc !=5 ) {fprintf (stderr,"Statically apply ELF rela relocations\n" );
@@ -87,8 +87,7 @@ int main(int argc, char **argv)return 3 ; } -if (rela_start > rela_end || rela_start < text_base || - (rela_end - rela_start) %sizeof (Elf64_Rela)) { +if (rela_start > rela_end || rela_start < text_base) {fprintf (stderr,"%s: bad rela bounds\n" , argv[0 ]);return 3 ; }
@@ -96,6 +95,21 @@ int main(int argc, char **argv) rela_start -= text_base; rela_end -= text_base; +fseek (f,0 ,SEEK_END ); + file_size =ftell (f); +rewind (f); + +if (rela_end > file_size) { +// Most likely compiler inserted some section that didn't get +// objcopy-ed into the final binary + rela_end = file_size; + } + +if ((rela_end - rela_start) %sizeof (Elf64_Rela)) { +fprintf (stderr,"%s: rela size isn't a multiple of Elf64_Rela\n" , argv[0 ]); +return 3 ; + } + num = (rela_end - rela_start) /sizeof (Elf64_Rela);for (i =0 ; i < num; i++) {
Signature · 1 line
2.30.2
PATCH 1/1 x86: Fix linking u-boot with ld.lld
In reply to Alistair DelvaWhen linking the final u-boot binary with LLD, the following link errors are seen:
ld.lld: error: can't create dynamic relocation R_386_32 against local
symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start.o
referenced by arch/x86/cpu/start.o:(.text.start+0x32)
[...]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start16.o
referenced by arch/x86/cpu/start16.o:(.start16+0x1C)
According to Nick Desaulniers:
"This is a known difference between GNU and LLVM linkers; the GNU
linkers permit relocations in readonly segments (making them not read only), LLVM does not (by default)."
Since U-Boot apparently seems to use relocations in readonly segments, change the global linker flags to permit them when linking with LLD by specifying '-z notext'.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -997,6 +997,9 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL) # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) +# ld.lld support +LDFLAGS_u-boot += -z notext + LDFLAGS_u-boot += --build-id=none ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
Signature · 1 line
2.30.2
PATCH 1/1 RFC: arm: pci: Add PCI cam support to PCI-E ecam driver
In reply to Alistair DelvaWhen booting U-Boot in crosvm, the virtual machine emulates a PCI cam device, not the PCI-E 'ecam' device normally seen on e.g. QEMU. This PCI device can be supported with only trivial changes to the ecam driver.
Instead of adding a completely new driver which is identical besides the initialization step, add support for the PCI version to the existing driver.
--- drivers/pci/pcie_ecam_generic.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/pci/pcie_ecam_generic.c +14 -4
@@ -14,6 +14,8 @@#include <asm/io.h> +#define TYPE_PCI 0x1 +/** * struct generic_ecam_pcie - generic_ecam PCIe controller state * @cfg_base: The base address of memory mapped configuration space
@@ -46,9 +48,16 @@ static int pci_generic_ecam_conf_address(const struct udevice *bus,void *addr; addr = pcie->cfg_base; - addr += (PCI_BUS (bdf) - pcie->first_busno) <<20 ; - addr +=PCI_DEV (bdf) <<15 ; - addr +=PCI_FUNC (bdf) <<12 ; + +if (dev_get_driver_data (bus) ==TYPE_PCI ) { + addr += (PCI_BUS (bdf) - pcie->first_busno) <<16 ; + addr +=PCI_DEV (bdf) <<11 ; + addr +=PCI_FUNC (bdf) <<8 ; + }else { + addr += (PCI_BUS (bdf) - pcie->first_busno) <<20 ; + addr +=PCI_DEV (bdf) <<15 ; + addr +=PCI_FUNC (bdf) <<12 ; + } addr += offset; *paddress = addr;
@@ -158,7 +167,8 @@ static const struct dm_pci_ops pci_generic_ecam_ops = { };static const struct udevice_id pci_generic_ecam_ids[] = { - { .compatible ="pci-host-ecam-generic" }, + { .compatible ="pci-host-ecam-generic" /* PCI-E */ }, + { .compatible ="pci-host-cam-generic" , .data =TYPE_PCI }, { } };
Signature · 1 line
2.30.2
Re: [PATCH] efi_loader: Fix link of EFI apps with ld.lld
In reply to Alistair DelvaQuoted 7 lines · Alistair Delva
When compiling U-Boot with ld.lld as the linker, the helloworld EFI app example fails to link:
LD
lib/efi_loader/helloworld_efi.so
ld.lld: error: section: .dynamic is not contiguous with other relro
sections
Quoted 7 lines
LLD will always create RELRO program header regardless of target emulation, whereas BFD may automatically disable it for unsupported targets. Add -znorelro to disable it explicitly in all cases.
Signed-off-by Alistair Delva <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Nick Desaulniers <[email protected]>
Quoted 18 lines
--- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/Makefile.lib +1
-1@@ -403,7 +403,7 @@ $(obj)/%.efi: $(obj)/%_efi.so quiet_cmd_efi_ld = LD $@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ - -Bsymbolic -s $^ -o $@ + -Bsymbolic -znorelro -s $^ -o $@ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
Quoted 9 lines · Alistair Delva
Fix a warning seen when compiling this dts file.
Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/dts/chromebook_coral.dts | 1 + 1 file changed, 1 insertion(+)
Quoted 15 lines
arch/x86/dts/chromebook_coral.dts +1
-1@@ -825,6 +825,7 @@ * Refer to EDS-Vol2-22.3 * [14:8] steps of delay for HS400, each 125ps * [6:0] steps of delay for SDR104/HS200, each 125ps + */ /* * EMMC TX DATA Delay 2 --2.30.2
Re: [PATCH] x86: Fix i8254 ifdef include guard
In reply to Alistair DelvaQuoted 10 lines · Alistair Delva
When building U-Boot with clang, it notices that the
i8254.hinclude guard does not work correctly due to a typo. Fix it.Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/include/asm/i8254.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH] x86: Fix linking u-boot with ld.lld
In reply to Alistair DelvaQuoted 24 lines · Alistair Delva
When linking the final u-boot binary with LLD, the following link errors are seen:
ld.lld: error: can't create dynamic relocation
R_386_32against local
symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the outputQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start.o
referenced by arch/x86/cpu/start.o:(.text.start+0x32)[...]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start16.o
referenced by arch/x86/cpu/start16.o:(.start16+0x1C)According to Nick Desaulniers:
"This is a known difference between GNU and LLVM linkers; the GNU
linkers permit relocations in readonly segments (making them not read only), LLVM does not (by default)."Since U-Boot apparently seems to use relocations in readonly segments, change the global linker flags to permit them when linking with LLD by specifying '-z notext'.
Quoted 7 lines
Signed-off-by Alistair Delva <[email protected]>Cc Nick Desaulniers <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Quoted 18 lines
Makefile +3
-1@@ -997,6 +997,9 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL) # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) +# ld.lld support +LDFLAGS_u-boot += -z notext + LDFLAGS_u-boot += --build-id=none ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) --2.30.2
Re: [PATCH] arm64: relocate-rela: Add support for ld.lld
In reply to Alistair DelvaQuoted 11 lines · Alistair Delva
Cap end of relocations by the binary size.
Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but
reloc_relastill tries to relocate them, resulting in attempted read past the end of file.When linking U-Boot with ld.lld, the
STATIC_RELAfeature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and withoutCONFIG_STATIC_RELA.
Quoted 5 lines
Originally-from: Elena Petrova <[email protected]>
Signed-off-by Alistair Delva <[email protected]>Cc David Brazdil <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>
Thanks for the patch. Do you have any other changes for LLVM/LLDB support on arm64 platforms? I think I've had a few stumbles whenever I've tried and not been able to cycle back to them.
Signature · 1 line
Tom
Re: [PATCH] arm64: relocate-rela: Add support for ld.lld
-Scott's ancient non-functioning email address
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 11 lines · Alistair Delva
Cap end of relocations by the binary size.
Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but
reloc_relastill tries to relocate them, resulting in attempted read past the end of file.When linking U-Boot with ld.lld, the
STATIC_RELAfeature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and withoutCONFIG_STATIC_RELA.Quoted 5 lines
Originally-from: Elena Petrova <[email protected]>
Signed-off-by Alistair Delva <[email protected]>Cc David Brazdil <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>
Quoted 3 lines
Thanks for the patch. Do you have any other changes for LLVM/LLDB support on arm64 platforms? I think I've had a few stumbles whenever I've tried and not been able to cycle back to them.
I think the patches I posted are enough to get U-Boot to build with LLVM LD for QEMU targets on arm64 and x86_64, but I have some other build problems to work through on physical device targets like rockchip.
Oddly, the arm64 binaries seem to be booting up (as far as we can see in a debugger), but there's no serial output, so there's still some work to do.
I'll keep upstreaming what we find. Our CI system is over here:
https://ci.android.com/builds/branches/aosp_u-boot-mainline/grid?
(using Clang but still ld.bfd for now)
Quoted 2 lines
--
Tom
Re: [PATCH] arm64: relocate-rela: Add support for ld.lld
Quoted 34 lines · Alistair Delva
-Scott's ancient non-functioning email address
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 11 lines · Alistair Delva
Cap end of relocations by the binary size.
Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but
reloc_relastill tries to relocate them, resulting in attempted read past the end of file.When linking U-Boot with ld.lld, the
STATIC_RELAfeature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and withoutCONFIG_STATIC_RELA.Quoted 5 lines
Originally-from: Elena Petrova <[email protected]>
Signed-off-by Alistair Delva <[email protected]>Cc David Brazdil <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>Quoted 3 lines
Thanks for the patch. Do you have any other changes for LLVM/LLDB support on arm64 platforms? I think I've had a few stumbles whenever I've tried and not been able to cycle back to them.
I think the patches I posted are enough to get U-Boot to build with LLVM LD for QEMU targets on arm64 and
x86_64, but I have some other build problems to work through on physical device targets like rockchip.
Quoted 7 lines
Oddly, the arm64 binaries seem to be booting up (as far as we can see in a debugger), but there's no serial output, so there's still some work to do.
I'll keep upstreaming what we find. Our CI system is over here:
https://ci.android.com/builds/branches/aosp_u-boot-mainline/grid?
(using Clang but still ld.bfd for now)
OK, thanks! I would like to see this get to the point of building + booting, so I can hopefully get a platform or two both in CI and my local HW CI loop building with clang as well.
Signature · 1 line
Tom
Quoted 10 lines · Alistair Delva
Fix a warning seen when compiling this dts file.
Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/dts/chromebook_coral.dts | 1 + 1 file changed, 1 insertion(+)
Re: [PATCH] x86: Fix i8254 ifdef include guard
In reply to Alistair DelvaQuoted 16 lines · Alistair Delva
When building U-Boot with clang, it notices that the
i8254.hinclude guard does not work correctly due to a typo. Fix it.Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/include/asm/i8254.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/i8254.h +0
-0
arch/x86/include/asm/i8254.h line 10
Quoted 5 lines
arch/x86/include/asm/i8254.h +1
-1@@ -7,7 +7,7 @@/* i8254.h Intel 8254 PIT registers */ #ifndef _ASMI386_I8254_H_ -#define _ASMI386_I8954_H_ +#define _ASMI386_I8254_H_
There is another I8954 at the end of this file. I can fix it when applying.
arch/x86/include/asm/i8254.h line 13
Quoted 3 lines
arch/x86/include/asm/i8254.h +0
-0#define PIT_T0 0x00/* PIT channel 0 count/status */ #define PIT_T1 0x01/* PIT channel 1 count/status */
Quoted 13 lines · Bin Meng
Quoted 10 lines · Alistair Delva
Fix a warning seen when compiling this dts file.
Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/dts/chromebook_coral.dts | 1 + 1 file changed, 1 insertion(+)
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
Re: [PATCH] x86: Fix i8254 ifdef include guard
In reply to Bin MengQuoted 27 lines · Bin Meng
Quoted 16 lines · Alistair Delva
When building U-Boot with clang, it notices that the
i8254.hinclude guard does not work correctly due to a typo. Fix it.Signed-off-by Alistair Delva <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- arch/x86/include/asm/i8254.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/i8254.h +0
-0arch/x86/include/asm/i8254.h line 10
Quoted 5 lines
arch/x86/include/asm/i8254.h +1
-1@@ -7,7 +7,7 @@/* i8254.h Intel 8254 PIT registers */ #ifndef _ASMI386_I8254_H_ -#define _ASMI386_I8954_H_ +#define _ASMI386_I8254_H_There is another I8954 at the end of this file. I can fix it when applying.
Quoted 1 line
Quoted 4 lines
Quoted 2 lines
#define PIT_T0 0x00 /* PIT channel 0 count/status */ #define PIT_T1 0x01 /* PIT channel 1 count/status */Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
Simon Glass
Reviewed-byRe: [PATCH] x86: Fix linking u-boot with ld.lld
In reply to Simon GlassQuoted 24 lines · Alistair Delva
When linking the final u-boot binary with LLD, the following link errors are seen:
ld.lld: error: can't create dynamic relocation
R_386_32against local
symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the outputQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start.o
referenced by arch/x86/cpu/start.o:(.text.start+0x32)[...]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
defined in
arch/x86/cpu/start16.o
referenced by arch/x86/cpu/start16.o:(.start16+0x1C)According to Nick Desaulniers:
"This is a known difference between GNU and LLVM linkers; the GNU
linkers permit relocations in readonly segments (making them not read only), LLVM does not (by default)."Since U-Boot apparently seems to use relocations in readonly segments, change the global linker flags to permit them when linking with LLD by specifying '-z notext'.
Quoted 7 lines
Signed-off-by Alistair Delva <[email protected]>Cc Nick Desaulniers <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Quoted 1 line
Applied to u-boot-dm, thanks!
Re: [PATCH] arm64: relocate-rela: Add support for ld.lld
In reply to Alistair DelvaQuoted 11 lines · Alistair Delva
Cap end of relocations by the binary size.
Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but
reloc_relastill tries to relocate them, resulting in attempted read past the end of file.When linking U-Boot with ld.lld, the
STATIC_RELAfeature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and withoutCONFIG_STATIC_RELA.
Quoted 5 lines
Originally-from: Elena Petrova <[email protected]>
Signed-off-by Alistair Delva <[email protected]>Cc David Brazdil <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH] RFC: arm: pci: Add PCI cam support to PCI-E ecam driver
In reply to Alistair DelvaQuoted 5 lines · Alistair Delva
When booting U-Boot in crosvm, the virtual machine emulates a PCI cam device, not the PCI-E 'ecam' device normally seen on e.g. QEMU. This PCI device can be supported with only trivial changes to the ecam driver.
Quoted 7 lines
Instead of adding a completely new driver which is identical besides the initialization step, add support for the PCI version to the existing driver.
Signed-off-by Alistair Delva <[email protected]>Cc Tuomas Tynkkynen <[email protected]>Cc Ram Muthiah <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom