retrage / efi-stub

Linux EFI Stub like standalone UEFI application sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`/usr/bin/ld: utils.o:(.bss+0x0): multiple definition of `gImageHandle'; main.o:(.bss+0x0): first defined here`

paulmenzel opened this issue · comments

The build fails on Debian sid/unstable:

$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make
gcc -Wall -Werror -mno-red-zone -fno-builtin -fno-stack-protector -fshort-wchar -Iinclude/edk2/MdePkg/Include -Iinclude/edk2/MdePkg/Include/X64 -Iinclude   -c -o main.o main.c
gcc -Wall -Werror -mno-red-zone -fno-builtin -fno-stack-protector -fshort-wchar -Iinclude/edk2/MdePkg/Include -Iinclude/edk2/MdePkg/Include/X64 -Iinclude   -c -o printf.o printf.c
gcc -Wall -Werror -mno-red-zone -fno-builtin -fno-stack-protector -fshort-wchar -Iinclude/edk2/MdePkg/Include -Iinclude/edk2/MdePkg/Include/X64 -Iinclude   -c -o utils.o utils.c
as   -o eficall.o eficall.s
as   -o entry.o entry.s
as   -o header.o header.s
gcc -nostdlib -Wl,-dT,linker.ld main.o printf.o utils.o eficall.o entry.o header.o -o efi-stub.o
/usr/bin/ld: utils.o:(.bss+0x0): multiple definition of `gImageHandle'; main.o:(.bss+0x0): first defined here
/usr/bin/ld: utils.o:(.bss+0x8): multiple definition of `gST'; main.o:(.bss+0x8): first defined here
/usr/bin/ld: utils.o:(.bss+0x10): multiple definition of `gBS'; main.o:(.bss+0x10): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:34: efi-stub.o] Fehler 1

Commit 8fe2bb0 should fix the link error.

Yes, it did. Thank yout.