移植GNU工具链到新的体系架构

上传人:宝路 文档编号:21453033 上传时间:2017-11-23 格式:DOC 页数:4 大小:38.82KB
返回 下载 相关 举报
移植GNU工具链到新的体系架构_第1页
第1页 / 共4页
移植GNU工具链到新的体系架构_第2页
第2页 / 共4页
移植GNU工具链到新的体系架构_第3页
第3页 / 共4页
移植GNU工具链到新的体系架构_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《移植GNU工具链到新的体系架构》由会员分享,可在线阅读,更多相关《移植GNU工具链到新的体系架构(4页珍藏版)》请在金锄头文库上搜索。

1、移植 GNU 工具链到新的体系架构字体: 小 中 大 | 打印 发表于: 2008-4-08 20:31 作者: beforewind 来源: EDA 中国门户网站 链接地址:http:/osdev.gro.clinux.org/toolchain/toolchain_guide_for_tot.html2007-12-11 从何开始有个新的 CPU, 或者新的操作系统,该怎么样搞个 tool chain 出来? 如何构建一个 self host的操作系统? 或许不为真的要去构造, 仅仅满足一下好奇心而已. 当然打算从 gnu toolchain 入手, 又不是为了写编译器.(来自互联网的内容

2、已尽力标明出处)tool chain 的结构GCC 的 tool chain 包括几个部分? 根据印象, 应是有 gcc,cpp,cc1,gas,ld,gdb, ar, nm,strip,objdump .emulator? 忘了, 还有重要的 libc. 汗.看一个以上几部分都已经都存在的 tool chain 的构建,我们需要下面的几个部分才能构建一个完整的 tool chain:binutils :gas,ld,ar,nm,strip,objdump.gun-gcc: gcc,cpp,cc1,libc: a c lib for applicationsgdb: for debugging

3、 .模拟器.以上各个部分,缺了就不好受 .Binutils估计 as 是我们最想搞到的部分. 没有 as,ld,nm,ar. 即使移植了 Gcc 也是不能工作.binutils 包含如下各个部分:主要部分: ld - the GNU linker. as - the GNU assembler.其他(很有用哦): addr2line - Converts addresses into filenames and line numbers. ar - A utility for creating, modifying and extracting from archives. c+filt -

4、Filter to demangle encoded C+ symbols. gprof - Displays profiling information. nlmconv - Converts object code into an NLM. nm - Lists symbols from object files. objcopy - Copys and translates object files. objdump - Displays information from object files. ranlib - Generates an index to the contents

5、of an archive. readelf - Displays information from any ELF format object file. size - Lists the section sizes of an object or archive file. strings - Lists printable strings from files. strip - Discards symbols. windres - A compiler for Windows resource files.预备知识:1.阅读如 binutils 自己的文档gas/doc/interna

6、ls.texibfd/doc/bfdint.texiPreliminary Notes on Porting BFD2.读源代码.?3.找个 cpu 的实例来分析 ,比如这个 Add new target to Binutils 还有 PS3 的 cell CPU 的proting: New port to Cell SPU 也比较全面.移植的基本步骤,建议仔细阅读 CGEN, the Cpu tools GENerator 的各种文档:移植完整的 Tool chain 到一个 CPU(target),需要按顺序( 不一定,但是这么做是有道理的)移植如下模块: DejaGNU DejaGNU

7、是一个测试工具 DejaGNU 的 Home Page BFD Binary File Driver Preliminary Notes on Porting BFD CGEN 为 GNU tool Chain 提供 CPU 描述, 产生基础文件 pcodes, GAS, and simulator,refer to M32R port Opcodes opcodes 目录完全由 CGEN 产生 CGEN Porting GAS CGEN 只产生部分代码 ,主要是测试 CGEN Porting Binutils ld 搞完 ld, binutils 就全了. newlib libgloss s

8、imulator CGEN Porting GCC GDB可以看到 CGEN 的重要作用,困难的 Opcodes 部分他已经帮着做了. 对于 binutils, CGEN 为 CPU 产生如下文件:Opcodes:include/opcodes/FOO.h - Port specific ISA encodingopcodes/FOO-dis.c - Port specific disassembler routinesopcodes/FOO-opc.c - Port specific ISA encodingsize=-1ISA: Instruction Set Architecture .

9、 然后,by hand 吧,最头痛的部分可能是 BFD/*-Foo.c 的编写了, 好像是重定位的方式很是不好,RedHat 为此搞了一个新的重定位的方式,但是, 没有公开.:BFD: bfd/elf32|coff-FOO.c - Port specific relocation handlersbfd/cpu-FOO.c - Port specific description of the CPUGAS:gas/config/tc-FOO.h - Customisation of generic parts of the assemblergas/config/tc-FOO.c - Port

10、 specific parts of the assemblerinclude/coff|elf/FOO.h - Port specific header fileLD:ld/scripttempl/FOO.sc - Port specific linker template fileld/emulparam/FOO.sh - Port specific linker customisation最后是各种配置文件的修改:opcodes/configure.inopcodes/disassemble.copcodes/Makefile.ambfd/configure.inbfd/config.b

11、fdbfd/archures.cbfd/reloc.cbfd/targets.cbfd/Makefile.am Run make dep-am.gas/configure.ingas/configure.tgt Add new cpu support.gas/Makefile.am Run make dep-amld/configure.inld/makefile.aminclude/dis-asm.hbinutils/readelf.c: Add SPU support.binutils/Makefile.am: Run make dep-am.include/elf/common.h (EM_foo): Define.更详细的请参考 New port to Cell SPU 或者 Add new target to Binutils:Score.这个是个不小的工程.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号