#
# (C) Copyright 2000-2008
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundatio; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
VERSION = 1
PATCHLEVEL = 3
SUBLEVEL = 4
EXTRAVERSION =
# 这里U_BOOT_VERSION = 1.3.4
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
VERSION_FILE = $(obj)include/version_autogenerated.h
# 打印机器硬件名。
# 将“i.86”(.表示一个任意字符)转换为“i386”;
# 将“sun4u”转换为“sparc64”;
# 将“arm.*”(.*表示零个或多个字符任意)转换为“arm”;
# 将“sa110”转换为“arm”;
# 将“powerpc”转换为“ppc”;
# 将“ppc64”转换为“ppc”;
# 将“macppc”转换为“ppc”;
# 笔者的电脑是“x86_64”,不符合替换规则,不替换。
HOSTARCH := $(shell uname -m | \
sed -e s/i.86/i386/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/powerpc/ppc/ \
-e s/ppc64/ppc/ \
-e s/macppc/ppc/)
# 打印内核名。
# 将所有大写字母转换为小写字母;
# 将“(cygwin).*”(.*表示零个或多个字符任意)转换为“cygwin”;
# 笔者的电脑是“Linux”,替换为“linux”。
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e 's/\(cygwin\).*/cygwin/')
export HOSTARCH HOSTOS
# Deal with colliding definitions from tcsh etc.
VENDOR=
#########################################################################
# Allow for silent builds
# 假如在MAKEFLAGS变量中发现字符s
ifeq (,$(findstring s,$(MAKEFLAGS)))
# 有回显
XECHO = echo
else
# 无回显
XECHO = :
endif
#########################################################################
#
# U-boot build supports producing a object files to the separate external
# directory. Two use cases are supported:
#
# 1) Add O= to the make command line
# 'make O=/tmp/build all'
#
# 2) Set environement variable BUILD_DIR to point to the desired location
# 'export BUILD_DIR=/tmp/build'
# 'make'
#
# The second approach can also be used with a MAKEALL script
# 'export BUILD_DIR=/tmp/build'
# './MAKEALL'
#
# Command line 'O=' setting overrides BUILD_DIR environent variable.
#
# When none of the above methods is used the local build is performed and
# the object files are placed in the source directory.
#
# 假如定义了O
ifdef O
# 假如O来源于命令行
ifeq ("$(origin O)", "command line")
# 展开再复制,即将O里面的一些变量之类的展开,BUILD_DIR的值为一个定值字符串,不会再变化,除非修改它。
BUILD_DIR := $(O)
endif
endif
# 假如BUILD_DIR不等于空,或BUILD_DIR未定义
ifneq ($(BUILD_DIR),)
# saved-output等于BUILD_DIR扩展后的值
saved-output := $(BUILD_DIR)
# Attempt to create a output directory.
# 判断是否存在目录${BUILD_DIR},如果不存在,则创建目录${BUILD_DIR}
$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
# Verify if it was successful.
# 进入目录$(BUILD_DIR),并打印出绝对地址
BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
# 假如$(BUILD_DIR)为空或未定义,则输出错误信息
$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
endif # ifneq ($(BUILD_DIR),)
# 假如$(BUILD_DIR)值不为空,则OBJTREE:=$(BUILD_DIR),否则$(BUILD_DIR):=$(CURDIR)
# 这里是$(BUILD_DIR):=$(CURDIR)
OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
SRCTREE := $(CURDIR)
TOPDIR := $(SRCTREE)
LNDIR := $(OBJTREE)
# 导出变量,使其它makefile文件可以使用导出的变量
export TOPDIR SRCTREE OBJTREE
MKCONFIG := $(SRCTREE)/mkconfig
export MKCONFIG
# 假如$(OBJTREE)和$(SRCTREE)不相等。平时编译都没有设置变量O,因此,这里是相等的,都为$(CURDIR)
ifneq ($(OBJTREE),$(SRCTREE))
REMOTE_BUILD := 1
export REMOTE_BUILD
endif
# $(obj) and (src) are defined in config.mk but here in main Makefile
# we also need them before config.mk is included which is the case for
# some targets like unconfig, clean, clobber, distclean, etc.
# 假如$(OBJTREE)和$(SRCTREE)不相等。平时编译都没有设置变量O,因此,这里是相等的,都为$(CURDIR)
ifneq ($(OBJTREE),$(SRCTREE))
obj := $(OBJTREE)/
src := $(SRCTREE)/
else
# 上面比较的两个是相等的,所以这下面两个变量为空值。
obj :=
src :=
endif
export obj src
# Make sure CDPATH settings don't interfere
# 不导出变量CDPATH,防止干扰到其它makefile文件中的这个变量
unexport CDPATH
#########################################################################
# 假如$(obj)include/config.mk和$(wildcard $(obj)include/config.mk)相等
# `$(wildcard PATTERN)' 为扩展后面跟随的字符串里面的通配符
ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
# load ARCH, BOARD, and CPU configuration
# 包含$(obj)include/config.mk,这里是包含include/config.mk。如果没有找到这个文件,会生成一条警告消息。
include $(obj)include/config.mk
# 上面的makefile文件包含下面几个变量的值:
# ARCH = arm
# CPU = s5pc11x
# BOARD = smdkc110
# VENDOR = samsung
# SOC = s5pc110
export ARCH CPU BOARD VENDOR SOC
# 交叉编译器的路径,根据自己交叉编译器所在路径进行适当修改
CROSS_COMPILE = /home/shq/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-
export CROSS_COMPILE
# load other configuration
# 包含$(TOPDIR)/config.mk,这里是包含config.mk。如果没有找到这个文件,会生成一条警告消息。
include $(TOPDIR)/config.mk
#########################################################################
# U-Boot objects....order is important (i.e. start must be first)
OBJS = cpu/$(CPU)/start.o
OBJS := $(addprefix $(obj),$(OBJS))
LIBS = lib_generic/libgeneric.a
LIBS += cpu/$(CPU)/lib$(CPU).a
LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
LIBS += lib_$(ARCH)/lib$(ARCH).a
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
LIBS += net/libnet.a
LIBS += disk/libdisk.a
LIBS += drivers/bios_emulator/libatibiosemu.a
LIBS += drivers/block/libblock.a
LIBS += drivers/dma/libdma.a
LIBS += drivers/hwmon/libhwmon.a
LIBS += drivers/i2c/libi2c.a
LIBS += drivers/input/libinput.a
LIBS += drivers/misc/libmisc.a
LIBS += drivers/mmc/libmmc.a
LIBS += drivers/mtd/libmtd.a
LIBS += drivers/mtd/nand/libnand.a
LIBS += drivers/mtd/nand_legacy/libnand_legacy.a
LIBS += drivers/mtd/onenand/libonenand.a
LIBS += drivers/mtd/ubi/libubi.a
LIBS += drivers/mtd/spi/libspi_flash.a
LIBS += drivers/net/libnet.a
LIBS += drivers/net/sk98lin/libsk98lin.a
LIBS += drivers/pci/libpci.a
LIBS += drivers/pcmcia/libpcmcia.a
LIBS += drivers/spi/libspi.a
LIBS += drivers/rtc/librtc.a
LIBS += drivers/serial/libserial.a
LIBS += drivers/usb/libusb.a
LIBS += drivers/video/libvideo.a
LIBS += common/libcommon.a
#LIBS += libfdt/libfdt.a
#LIBS += api/libapi.a
#LIBS += post/libpost.a
# `$(addprefix PREFIX,NAMES...)' 添加前缀
LIBS := $(addprefix $(obj),$(LIBS))
.PHONY : $(LIBS) $(VERSION_FILE)
LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
# Add GCC lib
# -print-libgcc-file-name 输出libgcc.a的完整绝对路径
# -L DIRECTORY 将DIRECTORY添加到库搜索路径
# -lgcc 当连接时不使用标准库
# ‘-lgcc’, use with ‘-nodefaultlibs’
# ‘-lgcc’, use with ‘-nostdlib’
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
SUBDIRS = tools \
examples \
#api_examples
.PHONY : $(SUBDIRS)
# `$(subst FROM,TO,TEXT)' 将TEXT中的东西从FROM变为TO
__OBJS := $(subst $(obj),,$(OBJS))
__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
#########################################################################
#########################################################################
ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND) $(obj)u-boot.dis
all: $(ALL)
# -O srec 创建一个输出文件,用srec格式
# $< 第一个依赖的文件名
# #@ 规则的目标文件名
$(obj)u-boot.srec: $(obj)u-boot
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
# -O binary 创建一个输出文件,用binary格式
$(obj)u-boot.bin: $(obj)u-boot
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
# -d 显示可执行部分的汇编内容
$(obj)u-boot.dis: $(obj)u-boot
$(OBJDUMP) -d $< > $@
# -x 显示所有头文件的目录
# sed -n 无声模式
# -e 将脚本添加作为执行的命令
# --start-group archives --end-group 指定的存档(archives)会被重复搜索直到没有新创建的未定义引用。
# -Map=mapfile 打印一个mapfile文件的规划图
# -o output 用output作为ld程序生成的文件名
$(obj)u-boot: depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-Map u-boot.map -o u-boot
# -C dir, --directory=dir 切换到dir目录前,读取makefile或做其它事情
# `$(notdir NAMES...)' 抽取‘NAMES’中每一个文件名中除路径部分外一切字符(真正的文件名)。
$(OBJS): depend $(obj)include/autoconf.mk
$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
$(LIBS): depend $(obj)include/autoconf.mk
$(MAKE) -C $(dir $(subst $(obj),,$@))
$(LIBBOARD): depend $(LIBS) $(obj)include/autoconf.mk
$(MAKE) -C $(dir $(subst $(obj),,$@))
$(SUBDIRS): depend $(obj)include/autoconf.mk
$(MAKE) -C $@ all
$(LDSCRIPT): depend $(obj)include/autoconf.mk
$(MAKE) -C $(dir $@) $(notdir $@)
$(NAND_SPL): $(VERSION_FILE) $(obj)include/autoconf.mk
$(MAKE) -C nand_spl/board/$(BOARDDIR) all
$(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
$(ONENAND_IPL): $(VERSION_FILE) $(obj)include/autoconf.mk
$(MAKE) -C $(obj)onenand_bl1/$(BOARD) all
$(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
cat $(obj)onenand_bl1/$(BOARD)/BL1.bin.padding $(obj)u-boot.bin > $(U_BOOT_ONENAND)
# cmp -s 禁止一切正常输出
# rm -f 忽略不存在的文件,不提示
# mv -f 在覆盖之前不提示
$(VERSION_FILE):
@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
'$(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR))' \
) > $@.tmp
@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
gdbtools:
$(MAKE) -C tools/gdb all || exit 1
updater:
$(MAKE) -C tools/updater all || exit 1
env:
$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
depend dep: $(VERSION_FILE)
for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
TAG_SUBDIRS += include
TAG_SUBDIRS += lib_generic board/$(BOARDDIR)
TAG_SUBDIRS += cpu/$(CPU)
TAG_SUBDIRS += lib_$(ARCH)
TAG_SUBDIRS += fs/cramfs
TAG_SUBDIRS += fs/fat
TAG_SUBDIRS += fs/fdos
TAG_SUBDIRS += fs/jffs2
TAG_SUBDIRS += net
TAG_SUBDIRS += disk
TAG_SUBDIRS += common
TAG_SUBDIRS += drivers/bios_emulator
TAG_SUBDIRS += drivers/block
TAG_SUBDIRS += drivers/hwmon
TAG_SUBDIRS += drivers/i2c
TAG_SUBDIRS += drivers/input
TAG_SUBDIRS += drivers/misc
TAG_SUBDIRS += drivers/mmc
TAG_SUBDIRS += drivers/mtd
TAG_SUBDIRS += drivers/mtd/nand
TAG_SUBDIRS += drivers/mtd/nand_legacy
TAG_SUBDIRS += drivers/mtd/onenand
TAG_SUBDIRS += drivers/mtd/spi
TAG_SUBDIRS += drivers/net
TAG_SUBDIRS += drivers/net/sk98lin
TAG_SUBDIRS += drivers/pci
TAG_SUBDIRS += drivers/pcmcia
TAG_SUBDIRS += drivers/qe
TAG_SUBDIRS += drivers/rtc
TAG_SUBDIRS += drivers/serial
TAG_SUBDIRS += drivers/spi
TAG_SUBDIRS += drivers/usb
TAG_SUBDIRS += drivers/video
tags ctags:
ctags -w -o $(obj)ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \
-name '*.[ch]' -print`
etags:
etags -a -o $(obj)etags `find $(SUBDIRS) $(TAG_SUBDIRS) \
-name '*.[ch]' -print`
cscope:
find $(SUBDIRS) $(TAG_SUBDIRS) -name '*.[ch]' -print \
> cscope.files
cscope -b -q -k
$(obj)System.map: $(obj)u-boot
@$(NM) $< | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(obj)System.map
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)
#
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
# the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file.
$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
@$(XECHO) Generating $@ ; \
set -e ; \
: Generate the dependancies ; \
$(CC) -x c -DDO_DEPS_ONLY -M $(HOST_CFLAGS) $(CPPFLAGS) \
-MQ $(obj)include/autoconf.mk include/common.h > $@
$(obj)include/autoconf.mk: $(obj)include/config.h
@$(XECHO) Generating $@ ; \
set -e ; \
: Extract the config macros ; \
$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
sed -n -f tools/scripts/define2mk.sed > $@
sinclude $(obj)include/autoconf.mk.dep
#########################################################################
else # !config.mk
all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
$(SUBDIRS) $(VERSION_FILE) gdbtools updater env depend \
dep tags ctags etags cscope $(obj)System.map:
@echo "System not configured - see README" >&2
@ exit 1
endif # config.mk
#########################################################################
unconfig:
@rm -f $(obj)include/config.h $(obj)include/config.mk \
$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
$(obj)board/$(VENDOR)/$(BOARD)/config.mk
# $(@:_config=) 将$@即目标名,_config替换为空
smdkv210single_config : unconfig
@$(MKCONFIG) $(@:_config=) arm s5pc11x smdkc110 samsung s5pc110
@echo "TEXT_BASE = 0xc3e00000" > $(obj)board/samsung/smdkc110/config.mk
#########################################################################
#########################################################################
#########################################################################
clean:
@rm -f $(obj)examples/82559_eeprom $(obj)examples/eepro100_eeprom \
$(obj)examples/hello_world $(obj)examples/interrupt \
$(obj)examples/mem_to_mem_idma2intr \
$(obj)examples/sched $(obj)examples/smc91111_eeprom \
$(obj)examples/test_burst $(obj)examples/timer
@rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \
$(obj)tools/env/{fw_printenv,fw_setenv} \
$(obj)tools/envcrc \
$(obj)tools/gdb/{astest,gdbcont,gdbsend} \
$(obj)tools/gen_eth_addr $(obj)tools/img2srec \
$(obj)tools/mkimage $(obj)tools/mpc86x_clk \
$(obj)tools/ncb $(obj)tools/ubsha1
@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \
$(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin} \
$(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom \
$(obj)board/{integratorap,integratorcp}/u-boot.lds \
$(obj)board/{bf533-ezkit,bf533-stamp,bf537-stamp,bf561-ezkit}/u-boot.lds \
$(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
@rm -f $(obj)include/bmp_logo.h
@rm -f $(obj)nand_spl/{u-boot-spl,u-boot-spl.map,System.map}
@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}
@rm -f $(obj)api_examples/demo $(VERSION_FILE)
@find $(OBJTREE) -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' \) -print \
| xargs rm -f
clobber: clean
@find $(OBJTREE) -type f \( -name .depend \
-o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
-print0 \
| xargs -0 rm -f
@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
$(obj)cscope.* $(obj)*.*~
@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
@rm -f $(obj)tools/{crc32.c,environment.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
@rm -f $(obj)include/regs.h
@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -lname "*" -print | xargs rm -f
@[ ! -d $(obj)api_examples ] || find $(obj)api_examples -lname "*" -print | xargs rm -f
ifeq ($(OBJTREE),$(SRCTREE))
mrproper \
distclean: clobber unconfig
else
mrproper \
distclean: clobber unconfig
rm -rf $(obj)*
endif
backup:
F=`basename $(TOPDIR)` ; cd .. ; \
gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
#########################################################################
-print-libgcc-file-name
Same as ‘-print-file-name=libgcc.a’.
This is useful when you use ‘-nostdlib’ or ‘-nodefaultlibs’ but you do want
to link with ‘libgcc.a’. You can do
gcc -nostdlib files ... ‘gcc -print-libgcc-file-name‘
-print-file-name=library
Print the full absolute name of the library file library that would be used when
linking—and don’t do anything else. With this option, GCC does not compile
or link anything; it just prints the file name.
-L DIRECTORY, --library-path DIRECTORY
Add DIRECTORY to library search path
-nodefaultlibs
Do not use the standard system libraries when linking. Only the libraries you
specify will be passed to the linker, options specifying linkage of the system
libraries, such as -static-libgcc or -shared-libgcc, will be ignored. The
standard startup files are used normally, unless ‘-nostartfiles’ is used. The
compiler may generate calls to memcmp, memset, memcpy and memmove. These
entries are usually resolved by entries in libc. These entry points should be
supplied through some other mechanism when this option is specified.
-nostdlib
Do not use the standard system startup files or libraries when linking. No
startup files and only the libraries you specify will be passed to the linker,
options specifying linkage of the system libraries, such as -static-libgcc or
-shared-libgcc, will be ignored. The compiler may generate calls to memcmp,
memset, memcpy and memmove. These entries are usually resolved by entries in
libc. These entry points should be supplied through some other mechanism
when this option is specified.
One of the standard libraries bypassed by ‘-nostdlib’ and ‘-nodefaultlibs’
is ‘libgcc.a’, a library of internal subroutines which GCC uses to overcome
shortcomings of particular machines, or special needs for some languages. (See
Section “Interfacing to GCC Output” in GNU Compiler Collection (GCC) In-
ternals, for more discussion of ‘libgcc.a’.) In most cases, you need ‘libgcc.a’
even when you want to avoid other standard libraries. In other words, when you
specify ‘-nostdlib’ or ‘-nodefaultlibs’ you should usually specify ‘-lgcc’ as
well. This ensures that you have no unresolved references to internal GCC
library subroutines. (For example, ‘__main’, used to ensure C++ constructors
will be called; see Section “collect2” in GNU Compiler Collection (GCC)
Internals.)
-O --output-target <bfdname>
Create an output file in format <bfdname>
-d, --disassemble
Display assembler contents of executable sections
-x, --all-headers
Display the contents of all headers
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
--start-group archives --end-group
The archives should be a list of archive files. They may be either explicit file
names, or ‘-l’ options.
The specified archives are searched repeatedly until no new undefined references
are created. Normally, an archive is searched only once in the order that it is
specified on the command line. If a symbol in that archive is needed to resolve
an undefined symbol referred to by an object in an archive that appears later
on the command line, the linker would not be able to resolve that reference.
By grouping the archives, they all be searched repeatedly until all possible
references are resolved.
Using this option has a significant performance cost. It is best to use it only
when there are unavoidable circular references between two or more archives.
-Map=mapfile
Print a link map to the file mapfile. See the description of the ‘-M’ option,
above.
-o output
--output=output
Use output as the name for the program produced by ld; if this option is not
specified, the name ‘a.out’ is used by default. The script command OUTPUT
can also specify the output file name.
-C dir, --directory=dir
Change to directory dir before reading the makefiles or doing
anything else. If multiple -C options are specified, each is interpreted
relative to the previous one: -C / -C etc is equivalent to -C /etc.
This is typically used with recursive invocations of make.