为定制平台构建 newlib 时指示 libgloss 机器

发布于 2024-07-16 23:24:50 字数 349 浏览 6 评论 0原文

我正在为没有操作系统的定制 PowerPC 平台编译 newlib。 阅读网上的信息我意识到我需要在 libgloss 的 子目录中实现存根函数。

我的困惑是,当我编译 newlib 时,将如何拾取这一点。 它是配置 --target 参数的最后一部分,例如 powerpc-ibm- 吗?

如果是这样的话,那么我想我在编译 binutils 和 gcc 时应该使用相同的 --target 吗?

谢谢

I'm compiling newlib for a bespoke PowerPC platform with no OS. Reading information on the net I realise I need to implement stub functions in a <newplatform> subdirectory of libgloss.

My confusion is to how this is going to be picked up when I compile newlib. Is it the last part of the --target argument to configure e.g. powerpc-ibm-<newplatform> ?

If this is the case, then I guess I should use the same --target when compiling binutils and gcc?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赤濁 2024-07-23 23:24:50

我自己也移植了newlib和GCC。 我记得我不需要做太多事情就可以让 newlib 工作(移植 GCC、gas 和 libbfd 是大部分工作)。

只需调整一些有关浮点数的文件,关闭一些 POSIX/SomeOtherStandard 标志,使其不使用一些更复杂的函数,并为 longjmp / setjmp 编写支持代码将寄存器状态加载和存储到跳转缓冲区中。 但是您当然必须使用 --target 告诉它目标,以便它使用正确的机器子目录等等。 我记得我必须向 configure.sub 添加小代码,以使其了解我的目标并打印出完整的配置三元组(cpu-manufacturer-os 或类似的)。 刚刚发现我也必须编辑一个名为 configure.host 的文件,它为您的目标设置一些选项(例如,操作系统是否处理由 raise 引发的信号,或者newlib 本身是否应该模拟处理)。

我使用 Anthony Green 的这个博客作为指导,他在其中描述了 GCC、newlib 和 binutils 的移植。 我认为当你必须自己做时,这是一个很好的来源。 无论如何,读起来很有趣。 总共花了 2 个月的时间来编译和运行一些有趣的 C 程序,这些程序只需要独立的 C 语言(带有写入模拟器终端的虚拟读/写函数)。

所以我认为工作量当然是可以管理的。 让我几乎抓狂的是 libgloss 的构建脚本。 我确实迷失在那些 autoconf 魔法中了:) 不管怎样,我祝你好运! :)

I ported newlib and GCC myself too. And i remember i didn't have to do much stuff to make newlib work (porting GCC, gas and libbfd was most of the work).

Just had to tweak some files about floating point numbers, turn off some POSIX/SomeOtherStandard flags that made it not use some more sophisticated functions and write support code for longjmp / setjmp that load and store register state into the jump buffers. But you certainly have to tell it the target using --target so it uses the right machine sub-directory and whatnot. I remember i had to add small code to configure.sub to make it know about my target and print out the complete configuration trible (cpu-manufacturer-os or similar). Just found i had to edit a file called configure.host too, which sets some options for your target (for example, whether an operation systems handles signals risen by raise, or whether newlib itself should simulate handling).

I used this blog of Anthony Green as a guideline, where he describes porting of GCC, newlib and binutils. I think it's a great source when you have to do it yourself. A fun read anyway. It took a total of 2 months to compile and run some fun C programs that only need free-standing C (with dummy read/write functions that wrote into the simulator's terminal).

So i think the amount of work is certainly manageable. The one that made me nearly crazy was libgloss's build scripts. I certainly was lost in those autoconf magics :) Anyway, i wish you good luck! :)

故人爱我别走 2024-07-23 23:24:50

查看移植 Newlib

引用:

在经历了极其困难的一周尝试将 newlib 移植到我自己的操作系统之后,我决定编写一个教程,概述移植 newlib 的要求以及如何实际执行它。 我假设您已经可以从某处加载二进制文件,并且这些二进制文件是编译后的 C 代码。 我还假设您已经设置了系统调用接口。 为什么要等? 让我们开始吧!

Check out Porting Newlib.

Quote:

I decided that after an incredibly difficult week of trying to get newlib ported to my own OS that I would write a tutorial that outlines the requirements for porting newlib and how to actually do it. I'm assuming you can already load binaries from somewhere and that these binaries are compiled C code. I also assume you have a syscall interface setup already. Why wait? Let's get cracking!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文