https://sourceware.org/ml/crossgcc/2000-11/msg00004.html
To: jani at virtualro dot ic dot ro
Subject: Re: linker script filename extension
From: Ian Lance Taylor <ian at zembu dot com>
Date: 1 Nov 2000 08:20:53 -0800
CC: crossgcc at sources dot redhat dot com
References: <Pine.LNX.4.10.10011011546110.8088-100000@virtualro.ic.ro>
Date: Wed, 1 Nov 2000 16:00:18 +0200 (EET) From: <jani@virtualro.ic.ro> could anybody tell me what the extensions of the linker script files stand for ?They have names like target.[x|xbn|xu|xn|xr|xs] First I'm going to say that it doesn't matter. There is no functional purpose to those names. If you think it does matter, then you are probably making a mistake. However, there is an answer. From ld/genscripts.sh: # A .x script file is the default script. # A .xr script is for linking without relocation (-r flag). # A .xu script is like .xr, but *do* create constructors (-Ur flag). # A .xn script is for linking with -n flag (mix text and data on same page). # A .xbn script is for linking with -N flag (mix text and data on same page). # A .xs script is for generating a shared library with the --shared
http://lists.llvm.org/pipermail/llvm-dev/2012-December/057390.html
As far as I can tell, ldscripts usually have suffix `.lds` and more rarely `.ld`.
Inside Linux, most linker scripts have suffix `.lds.S`, the `.S` signifying that indicates that they need to be passed through the C preprocessor. This is not as ugly as you may think at first. The C preprocessor is used primarily as a means of sharing common constants and definitions between the linker scripts, assembly code, and C code; it's not clear that there is a better way to accomplish this. The totality of the linker scripts (and related files) I could find in Linux is comprised of: scripts/module-common.lds include/asm-generic/vmlinux.lds.h - common preprocessor definitions used for the linker scripts for kernel image ("vmlinux"). arch/**/*.lds* - There are 71 of these total. Most of these are related to linking the kernel image. The rest are composed of mostly vDSO and bootloader stuff.