bonzini / qboot

Minimal x86 firmware for booting Linux kernels
GNU General Public License v2.0
704 stars 118 forks source link

eep! wont build. #5

Closed JazzMaster closed 6 years ago

JazzMaster commented 8 years ago

missing a table? main.o: In function main': /home/me/Desktop/code/qboot/main.c:82: undefined reference to_GLOBAL_OFFSETTABLE' code16.o: In function e820_query_map': /home/me/Desktop/code/qboot/code16.c:45: undefined reference to_GLOBAL_OFFSETTABLE' printf.o: In function print_str': /home/me/Desktop/code/qboot/printf.c:36: undefined reference to_GLOBAL_OFFSETTABLE' printf.o: In function print_int': /home/me/Desktop/code/qboot/printf.c:64: undefined reference to_GLOBAL_OFFSETTABLE' printf.o: In function print_unsigned': /home/me/Desktop/code/qboot/printf.c:99: undefined reference to_GLOBAL_OFFSETTABLE' printf.o:/home/me/Desktop/code/qboot/printf.c:141: more undefined references to `_GLOBAL_OFFSETTABLE' follow

Erroneous1 commented 8 years ago

I got it to compile by adding: BIOS_CFLAGS += -fno-pic to line 11 of Makefile. IDK if Position Independent Code is needed here.

bonzini commented 8 years ago

What OS are you building it on?

Erroneous1 commented 8 years ago

I was building on Arch Linux with gcc 6.2.1, running the 4.7.5-1-ARCH kernel (64 bit).

fozog commented 7 years ago

Got same issue and solved using @Erroneous1 patch.

cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.10 DISTRIB_CODENAME=yakkety DISTRIB_DESCRIPTION="Ubuntu 16.10"

gcc --version gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 Copyright (C) 2016 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.

I also would use -mno-red-zone, not to solve a compile issue but to avoid messing with the stack in case qBoot want to handle exceptions or real IRQs in the future.

bonzini commented 7 years ago

Thanks, I'll apply the patch.

-mno-red-zone is not necessary because it only applies to 64-bit mode; 32-bit mode doesn't have a red zone.

PradeepKiruvale commented 7 years ago

I also had the same issue on "Linux ubuntu 4.12.0-rc7+ #2 SMP Thu Aug 10 05:57:30 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux". Adding BIOS_CFLAGS += -fno-pic fixed the issue.

bonzini commented 6 years ago

Fixed now.