现在的位置: 首页 > 综合 > 正文

gcc and ld

2011年11月02日 ⁄ 综合 ⁄ 共 672字 ⁄ 字号 评论关闭
gcc可以通过-Wl将参数传入ld命令

GCC:
-Wl,option

Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas.

LD:
-Tbss org
-Tdata org
-Ttext org
Same as –section-start, with .bss, .data or .text as the sectionname.

-T scriptfile
--script=scriptfile
Use scriptfile as the linker script. This script replaces ld's default linker script (rather than adding to it), so commandfile must specify everything necessary to describe the output file. See Scripts. If scriptfile does not exist in the current directory, ld looks for it in the directories specified by any preceding -L options. Multiple -T options accumulate.

例子:
gcc  -g  -nostdlib -Wl,-N,-Ttext,7C00 -Wl,-T../ldscript -o stage1.exec.exe  stage1.o 

objcopy -O binary stage1.exec.exe stage1

抱歉!评论已关闭.