Comments (8)
Which version of qemu are you using? When I follow the steps you took, using GCC 5 and qemu 2.8.95 I get the expected results.
from sel4-tutorials.
I'm using default packages on Ubuntu 16.10, which have versions:
- QEMU: QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu5.4)
- gcc: gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
- arm-none-eabi-gcc: arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)
I'll try using a newer QEMU and report back
from sel4-tutorials.
I tried two versions of QEMU: the latest master branch from git, and 2.9.0. Neither worked.
Next, I tried upgrading Ubuntu to 17.04, because I had a problem building seL4test with ld 2.27 (the version shipping with Ubuntu 16.10)
I'm now running these versions:
- QEMU emulator version 2.8.0
- gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
- GNU ld (GNU Binutils for Ubuntu) 2.28
Unfortunately this didn't help either, and I still get the same error message. I did try using the Virtualbox appliance however, and that worked as expected.
It seems unlikely that gcc/ld would produce code that QEMU can't run, so perhaps they are not producing the right kind of file.
Indeed, I did discover a difference in the output files, namely the kernel image produced by my box (not the .ova) is dynamically linked! I'm assuming this is very wrong.
For clarity, here's the output of file images/*
for my box, and the test OVA:
My box:
hello-1-image-ia32-pc99: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
kernel-ia32-pc99: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
Virtualbox appliance:
hello-1-image-ia32-pc99: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
kernel-ia32-pc99: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
I'm guessing this has happened due to a change in the ld
command line flags. I'm not sure how to fix this however - I would appreciate any tips!
I messed about with LDFLAGS in kernel/Makefile, but to no avail. I tried adding -Bstatic
and changing -m,elf_i386
to -melf_i386
but neither worked.
I'm not sure how to tell GCC to static link the kernel ELF image, so I kinda guessed: I changed kernel/Makefile
line 582 to add the -static flag. My version now reads:
$(Q)${CHANGED} $@ ${CC} ${LDFLAGS} -static -Wl,-T -Wl,linker.lds_pp \
Unfortunately, while my kernel image file now says "statically linked", it still gives the same error when I run it in QEMU.
Copying the kernel image from the virtual machine to my machine works, so it seems like it's only the kernel image that isn't building correctly (I can run the .ova-produced kernel image alongside the application code built on my machine)
Any thoughts on what I can try now?
from sel4-tutorials.
The problem appears to be gcc version 6 which is creating dynamically linked programs even when you request static ones.
I installed gcc 6 and got the same problem you're seeing. I'll see what can be done...
from sel4-tutorials.
Please try this patch.
project kernel/
diff --git a/Makefile b/Makefile
index 5e31f2cd..0deee694 100644
--- a/Makefile
+++ b/Makefile
@@ -389,7 +389,7 @@ WARNINGS = all error strict-prototypes missing-prototypes nested-externs \
CFLAGS += --std=c99 -nostdlib -nostdinc -ffreestanding \
${WARNINGS:%=-W%} ${INCLUDES}
CPPFLAGS += -nostdinc
-LDFLAGS += -nostdlib -nostdinc
+LDFLAGS += -nostdlib -nostdinc -static
LDFLAGS += -Wl,--build-id=none
ASFLAGS += ${INCLUDES}
project projects/tools/
diff --git a/common-tool/Makefile.flags b/common-tool/Makefile.flags
index 0ddb7ad..54aacbb 100644
--- a/common-tool/Makefile.flags
+++ b/common-tool/Makefile.flags
@@ -25,6 +25,9 @@ NK_ASFLAGS =
NK_CCFLAGS =
ldflags-y += $(call cc-ldoption, -Wl$(comma)--build-id=none)
+ldflags-y += $(call cc-ldoption, -Wl$(comma)--no-pie)
+
+ccflags-y += $(call cc-option, -fno-pie)
ifeq ($(CONFIG_ARCH_X86),y)
ccflags-y += $(call cc-option,-fno-stack-protector)
diff --git a/common-tool/common.mk b/common-tool/common.mk
index 321bf1c..e17badc 100644
--- a/common-tool/common.mk
+++ b/common-tool/common.mk
@@ -113,8 +113,8 @@ ifeq (${CONFIG_USER_CFLAGS},)
CFLAGS += $(NK_CFLAGS)
CXXFLAGS += $(NK_CXXFLAGS)
- CFLAGS += -fno-stack-protector
- CXXFLAGS += -fno-stack-protector
+ CFLAGS += -fno-stack-protector $(call cc-option,-fno-pie)
+ CXXFLAGS += -fno-stack-protector $(call, cc-option,-fno-pie)
else
# Override the cflags with Kconfig-specified flags
CFLAGS += ${CONFIG_USER_CFLAGS}
from sel4-tutorials.
Looks like this patch (or an equivalent) is already in later versions of seL4.
from sel4-tutorials.
To try a later version of seL4, do repo sync -m sel4-tutorials-master.xml
-- this will pick up the bleeding edge.
from sel4-tutorials.
Hooray, both your suggestions work!
With patch:
Starting node #0
Hello, World
Ignoring call to sys_exit_group
Without patch:
Hello, World
Either way: thank you very much for your help!
p.s.: I'm curious why the repo sync -m sel4-tutorials-master.xml
is different to the initial mkdir ... cd ... repo init ... repo sync
dance. What is repo sync -m ...
doing that the original repo sync
isn't?
from sel4-tutorials.
Related Issues (20)
- The notification tutorial solution seems to have a race condition
- Update mapping tutorial due to API changes for AArch64 VSpaces
- Mistake in capabilities tutorial HOT 2
- January Commit to camkes-vm-linux breaks camkes-vm-crossvm Tutorial HOT 4
- dynamic-[2,3] comments refer to deprecated function. HOT 3
- How can I use another image?
- mcs tutorial: Simplify passive server initialization protocol example HOT 1
- sel4-tutorials building error, CMake Error: The source directory "xxxxx/projects/sel4-tutorials/settings.cmake" is a file, not a directory. HOT 4
- explain seL4 "bit" sizes more prominently HOT 1
- clarify what "retype" creates
- camkes-vm-linux solution, out-of-the-box: module "poke" is not loading
- Cap fault in dynamic-3 tutorial HOT 3
- Generate clean CMake project HOT 1
- Update VM to provide something with 20.4 at least
- Camkes-VM-Linux Ninja Failed HOT 1
- Not able to input in buildroot camkes-vm-linux
- Not able to run camkes-vm-linux on the AMD platform HOT 1
- Cross-VM connector issue
- Question about seL4_ARCH_PageTable_Map() in the dynamic-2 TASK 4
- Problem on linux vm tutorial HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sel4-tutorials.