An input section description consists of a file name optionally followed by a list of section names in parentheses.

The file name and the section name may be wildcard patterns, which we describe further below (see Input Section Wildcards).

一个输入section描述由一个文件名,后面加上在大括号里的可选的一组section名称所组成.

The most common input section description is to include all input sections with a particular name in the output section. For example, to include all input ‘.text’ sections, you would write:

大多数公共输入section描述会在输出section中使用一个特殊的名称来包含所有输入section. 比如, 包含所有输入'.text'section,你可以这样写:

     *(.text)

Here the ‘*’ is a wildcard which matches any file name. To exclude a list of files from matching the file name wildcard, EXCLUDE_FILE may be used to match all files except the ones specified in the EXCLUDE_FILE list. For example:

这里的'*'是一个用于匹配所有文件名的通配符. 要从配置文件名的通配符中排除一组文件, 使用EXCLUDE_FILE可以在所有匹配文件中排除EXCLUDE_FILE列表中指定的文件. 比如:

     *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)

will cause all .ctors sections from all files except crtend.o and otherfile.o to be included.

There are two ways to include more than one section:

在所有文件中,使.ctors sections不会包含crtend.o和otherfile.o.

有两种方法用于包含多于一个section:

     *(.text .rdata)*(.text) *(.rdata)

The difference between these is the order in which the ‘.text’ and ‘.rdata’ input sections will appear in the output section. In the first example, they will be intermingled, appearing in the same order as they are found in the linker input. In the second example, all ‘.text’ input sections will appear first, followed by all ‘.rdata’ input sections.

它们之间的不同是在输出section中'.text'和'.rdata'输入section出现的顺序. 第一个例子中,这两个section将被混合一起,按照链接器输入的顺序排布.在第二个例子中, 所有'.text'输入section将先出现, 随后跟上所有'.rdata'输入section.

You can specify a file name to include sections from a particular file. You would do this if one or more of your files contain special data that needs to be at a particular location in memory. For example:

你可以指定一个文件名来实现中包含一个特定文件的section. 如果一个或多个文件的特殊数据需要被放在存储中的指定位置, 你就应该这样做.比如

     data.o(.data)

To refine the sections that are included based on the section flags of an input section, INPUT_SECTION_FLAGS may be used.

基于输入section的section flags改善被包含的section, INPUT_SECTION_FLAGS可以被使用.

Here is a simple example for using Section header flags for ELF sections:

这是一个关于使用ELF section的section头部flags的简单实例:

     SECTIONS {.text : { INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) }.text2 :  { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) }}

In this example, the output section ‘.text’ will be comprised of any input section matching the name *(.text) whose section header flags SHF_MERGE and SHF_STRINGS are set. The output section ‘.text2’ will be comprised of any input section matching the name *(.text) whose section header flag SHF_WRITE is clear.

在这个例子中, 输出section '.text'将由匹配了*(.text)并且section头部标志SHF_MERGE和SHF_STGRINGS被设置的输入section组成. 输出section '.text2'将由匹配了*(.text)并且section头部标志SHF_WRITE被清除的输入section组成.

You can also specify files within archives by writing a pattern matching the archive, a colon, then the pattern matching the file, with no whitespace around the colon.

你也可以通过写一个模式匹配档案包,一个冒号, 然后模式匹配文件,并且冒号旁边不能带空格, 来实现指定档案包中的文件.

‘archive:file’
matches file within archive 
匹配档案包中的文件
‘archive:’
matches the whole archive
匹配整个档案包.
‘:file’
matches file but not one in an archive
匹配一个文件,除了空的档案包

Either one or both of ‘archive’ and ‘file’ can contain shell wildcards. On DOS based file systems, the linker will assume that a single letter followed by a colon is a drive specifier, so ‘c:myfile.o’ is a simple file specification, not ‘myfile.o’ within an archive called ‘c’. ‘archive:file’ filespecs may also be used within an EXCLUDE_FILE list, but may not appear in other linker script contexts. For instance, you cannot extract a file from an archive by using ‘archive:file’ in an INPUTcommand.

'archive'和'file'都是可以包含shell通配符.在基于DOS文件系统上,链接器会认为单个字母后跟一个冒号是一个驱动符,因此'c:myfile.o' 是一个简单的文件文档,而不是所谓'c'档案包的文件'myfile.o'. 'archive:file'文件规范也可能被用在一个EXCLUDE_FILE列表里面,但是不能出现在其它链接器脚本的上下文中. 例如, 你不能在INPUT命令中使用'archive:file'从一个档案包中解压一个文件.

If you use a file name without a list of sections, then all sections in the input file will be included in the output section. This is not commonly done, but it may by useful on occasion. For example:

如果你使用一个没有带一组section的文件名称,那么输入文件中的所有section将被包含到输出section中. 这是不常用的做法,但是在某个场合中可能是很有用的.比如

     data.o

When you use a file name which is not an ‘archive:file’ specifier and does not contain any wild card characters, the linker will first see if you also specified the file name on the linker command line or in an INPUT command. If you did not, the linker will attempt to open the file as an input file, as though it appeared on the command line. Note that this differs from an INPUT command, because the linker will not search for the file in the archive search path.

当你使用一个不是"archive:file'标识的文件名称,并且没有包含任何通配符, 链接器将首先看你是否也在链接器命令行中或输入命令中指定文件名称.如果你没有, 链接器将尝试去以输入文件打开该文件, 就象它出现在命令行一样.  注: 这是与输入命令不同的, 因为链接器将不会在档案搜索路径中搜索文件的.

[LinkerScript.18] SECTION命令: Input Section Description : 输入section的基础相关推荐

  1. 汇编中的.section命令及汇编语言程序都至少声明的3个段

    汇编语言中最重要的命令之一是.section命令.这个命令定义内存段,汇编语言程序在其中定义元素.所有汇编语言程序都至少具有3个必须声明的段落: ·数据段 ·bss段 ·文本段 数据段用于声明为程序存 ...

  2. B 字符串处理1000MS64MB Description 输入一个英文名字。去掉该英文名字两端的空格,并首字母大写后,输出问候语Hello, 加名字 Input 一个英文名字 Output 去

    B 字符串处理1000MS64MB Description 输入一个英文名字.去掉该英文名字两端的空格,并首字母大写后,输出问候语"Hello, "加名字 Input 一个英文名字 ...

  3. Description 输入3个数,代表三角形的三条边长,判断这三条边是否能构成三角形,如果能, 计算并输出三角形的面积,否则输出NO。 Input 输入包括多组测试数据,每组有三个数,中间用空格隔开

    /*Description 输入3个数,代表三角形的三条边长,判断这三条边是否能构成三角形,如果能, 计算并输出三角形的面积,否则输出NO. Input 输入包括多组测试数据,每组有三个数,中间用空格 ...

  4. Python零基础入门(2)——常用的快捷命令、数据类型、输入输出格式、变量介绍

    1.常用快捷名命令 pycharm设置界面(ctrl + alt + s) 快速创建文件(alt + insert) 格式化python代码(ctrl + alt + l) 快速注释代码(ctrl + ...

  5. 监控 Linux 性能的 18 个命令行工具

    对于系统和网络管理员来说每天监控和调试Linux系统的性能问题是一项繁重的工作.在IT领域作为一名Linux系统的管理员工作5年后,我逐渐认识到监控和保持系统启动并运行是多么的不容易.基于此原因,我们 ...

  6. AutoCAD 2011、Map 3D 2011, Civil 3D 2011命令行中不能输入中文的修复补丁

    问题描述 该修复补丁能够修复一个导致用户无法在AutoCAD® 2011产品的命令行窗口中输入亚洲字符的问题. 适用产品 AutoCAD® 2011 AutoCAD® Architecture 201 ...

  7. CMD命令行接收用户输入信息

    CMD命令行接收用户输入信息 可以把下面的代码块Copy到一个以bat为后缀的文件中,双击就可以看到效果 ********************************************** ...

  8. [转载]监控 Linux 性能的 18 个命令行工具

    转自:http://www.kuqin.com/shuoit/20140219/338066.html 对于系统和网络管理员来说每天监控和调试Linux系统的性能问题是一项繁重的工作.在IT领域作为一 ...

  9. matlab在命令行注册,在命令行窗口中输入语句

    在命令行窗口中输入语句 当您在 MATLAB® 中工作时,可以在命令行窗口中输入各个语句.例如,通过在命令行中键入以下语句来创建名为 a 的变量: a = 1 MATLAB 会立即将变量 a 添加到工 ...

最新文章

  1. CentOS7修改时区,你会吗?
  2. 计算公式1!+2!+3!+...+10!的和
  3. 纪念计算机之父阿兰·图灵诞辰109周年
  4. elk6.3.1版本+metricbeat监控收集swarm的资源使用情况
  5. 微信支付报错:app没有获取微信支付权限
  6. 分享:一个简单的线程池的实现
  7. 深圳SEO外包公司×××,如何选择合适的SEO外包公司?
  8. 深入理解javascript之this
  9. 【微信小程序】组件只读
  10. java-native方法,通过JNI实现c的动态库的加载,实现软硬件之间的交互,跨平台的基础之一
  11. 如何写好接口(php写app移动端接口示例)
  12. maven 整体打包_Maven打包方式整理
  13. BZOJ1086[SCOI2005] 王室联邦
  14. excel下拉列表多选框_将列表框添加到Excel工作表
  15. UMD算法讲义——Lecture 2:算法设计:稳定婚姻问题
  16. TextView scrollbars setting
  17. P1084 [NOIP2012 提高组] 疫情控制
  18. 2020年12月31日flash禁用后网页如何播放rtmp视频流
  19. 家长会计算机教师致辞,家长会教师致辞最新
  20. 分享四个一键生成神器:Logo、App、小程序、H5等五分钟快速搞定

热门文章

  1. bash permission denied
  2. 电子计算机储存五次信息革命,每一次的信息革命,带来的影响都是不可估量的...
  3. CloudCompare多个pcd文件的拼接为1个pcd
  4. 阿里巴巴开发规范——OOP 规约
  5. jquery中each用法
  6. 终于等到有学生来答疑了
  7. 男人女人都应该知道的网络黑话大全
  8. VScode调试中出现“没有可用的调试程序,无法发送‘variables’“问题
  9. hibernate.cfg.xml
  10. 具有超强阅读理解能力的人工智能(Maluuba机器人)