📄 linking.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><h2><a name="linking" id="linking">Linking</a></h2><div class="level2"><p> uClinux has optimized the binary loader using a special form of <strong>flat</strong> file format</p><p>A flat file contains a header plus text and data sections and includes basic relocation information and a compiler generated Global Offset Table. This flat file is recognized by the kernel which loads the file into a memory area and then processes all the fixups required to make the code work at the loaded address.</p><p>The <strong>normal</strong> gcc compile and link process has to be <strong><em>interrupted</em></strong> to allow the extra processing to be used to create the flat file output structure.</p><p>Normally a compile and link process that attempts to produce a fully linked executable would use the <strong>bfin-uclinux-ld</strong> utility to produce a relocatable <strong>elf</strong> format file.</p><p>To allow this process to be intercepted, the <strong>bfin-uclinux-ld</strong> command is replaced by a script. This script will call the flat file generator <strong>bfin-uclinux-elf2flt</strong> after <strong><em>normal</em></strong> linking has been completed. </p><p>Under these circumstances the actual toolchain linker executable is called <strong>bfin-uclinux-ld.real</strong></p><p>An example of the <strong><em>interceptor</em></strong> script.</p><pre class="code">#!/bin/sh## allow us to do flat processing if the flag -Wl,-elf2flt (or -elf2flt) to# the 'C' compiler or linker respectively## uses the env. var FLTFLAGS as extra parameters to pass to elf2flt# arguments given like -Wl,-elf2flt="-b 10000 -v" are given before FLTFLAGS#...LINKER="$0.real" # the original renamed-linkerELF2FLT="`expr $0 : '\(.*\)ld'`elf2flt"TOOLDIR="`dirname $0`" # let gcc find the tools for usSHARED_ID=""NEWLDSCRIPT=""if expr "$*" : ".*-elf2flt.*" > /dev/nullthen...[ Steps to do this are not shown for clarity but here we attempt to fully resolve the executable and then convert to a flat file using elf2flt]...# otherwise pretend we aren't here#exec $LINKER "$@"</pre><p> Click <a href="http://www.gnu.org/software/binutils/manual/ld-2.9.1/ld.html" class="urlextern" title="http://www.gnu.org/software/binutils/manual/ld-2.9.1/ld.html" rel="nofollow">here</a> for more information on the GNU linker. </p></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -