如何链接C库,我的最终文件将在qemu虚拟机中执行! ? [英] How to link with C libraries wheras my final file will be executed in qemu virtual machine ! ?

查看:265
本文介绍了如何链接C库,我的最终文件将在qemu虚拟机中执行! ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在尝试基于我编写的不同模块从头开始构建内核而不需要C库,所以当我尝试为其添加另一个用C编写的模块作为其他模块但它包含C库,然后当我在虚拟机Qemu中运行可执行文件时;这个链接不起作用!

如果你能帮助我,那对我来说很高兴,因为我需要在我的迷你项目中进行学期结束的研究!

提前谢谢。



我尝试过:



i已经构建了内核映像并在Qemu中对其进行了测试,而没有需要C库的附加模块!

now am trying to build a kernel from scratch based on different modules written by me without the need of the C libraries , so when i tried to add for it another module that's written in C as the others but it includes C libraries , then when i run the executable file in virtual machine Qemu ; that link doesn't work !
please if you can help me it would a big pleasure for me , because i need it in my Mini-Project for the ending semester studies !
thank you in advance .

What I have tried:

i have build the kernel image and tested it in Qemu without the additional module that needs C-libraries !

推荐答案

C标准库实现用于用户模式应用程序。如果您正在编写自己的内核,则必须自己实现所有使用的标准库函数。



应该可以使用现有的库并静态链接。但这要求库是针对相同的处理器体系结构构建的,并且您不使用与任何IO和内存分配操作相关的操作系统相关库函数。
C standard library implementations are for user mode applications. If you are writing your own kernel, you have to implement all used standard library functions yourself.

It should be possible to use an existing library and link that statically. But that requires that the library is build for the same processor architecture and you are not using operating system dependant library functions like any IO and memory allocation operations.


这篇关于如何链接C库,我的最终文件将在qemu虚拟机中执行! ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆