Git Product home page Git Product logo

ld-linker-script's Introduction

一、什么是ld linker script

        程序链接时,目标文件根据一系列规则合并成可执行文件。这一步骤同时伴随着复杂的符号重定位、段合并和地址空间分配等步骤。

        ld linker scriptld提供的操作界面,用以对链接过程进行精确把控。使用ld linker script可以控制段的合并顺序、地址空间分配和链接符号导出。

二、为什么需要掌握ld linker script

        涉及u-bootkernel开发时,编译产出需要根据硬件环境进行特殊适配。例如,需要把指定指令放入固定存储空间内。甚至编译产出为binary类型文件,对指令和数据的分配都有硬性要求。这些对编译产出的精确控制,都离不开ld linker script的帮助。

三、受众群体

ld linker script主要面向bootloaderkernelsoc开发人员。这类环境需要对编译产出格式严格控制。另外应用开发仍然有必要了解这门技术,了解空间地址分配其对程序调试仍有裨益。

四、此博客有哪些特性

        毫无疑问地说,ld linker script仍然是十分冷门的技术,并且牵涉到大量底层的延伸技术细节。中文资料对这门技术的讲解仍然稀少,只有部分博客上有零零散散的介绍。

        此博客立足于现状,对整个技术做个全面介绍。所有章节都以官方文档(https://sourceware.org/binutils/docs/ld/)为中心,每个章节对应目录都配有演示示例。建议读者仔细阅读示例,多动手尝试实现细节,从而提高掌握水平。

五、我需要掌握哪些技术背景

        此博客需要读者具备一定的C应用开发经验,对程序的执行加载有所了解。同事要求读者尽可能具备深入的ELF技术储备。


文章地址:https://github.com/iDalink/ld-linker-script ###

章节目录

  • 01 基本概念
  • 02 格式
  • 03 简要示例
  • 04 简要链接指令
  • 05 符号值分配
  • 06 SECTIONS指令
  • 07 MEMORY指令
  • 08 PHDRS指令
  • 09 VERSION指令
  • 10 Linker Scripts中的表达式
  • 11 构建可运行程序
  • 12 抛弃glibc依赖

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.