デフォルトのリンカ・スクリプトの場所
以前「スタックの指定はどこにあるのだろう?」みたいなことを書いたが、セクションの配置はリンクのお仕事なので、オプションに指定がなければ、リンカ・スクリプトにあるだろうとは察しがついていた。
今まではソースコード中心に見てきたので放っておくことにしたが、あらかたソースコードは見たので、リンカ・スクリプトを読むことにする。
デフォルトのリンカ・スクリプトは、Windowsの標準でインストールしたなら以下のディレクトリに格納されている。
C:\Program Files\Atmel\AVR Tools\AVR32 Toolchain\avr32\lib\ldscripts
ただし、ファイルは1つでない。すべてAT32UC3B0256のELF作成用である。descriptionは、各ファイル先頭に記述されたコメントを書き写したもので、内容を理解してはいない。
file name | description |
---|---|
avr32elf_uc3b0256.x | Default linker script, for normal executables |
avr32elf_uc3b0256.xbn | Script for -N: mix text and data on same page; don't align data |
avr32elf_uc3b0256.xn | Script for -n: mix text and data on same page |
avr32elf_uc3b0256.xr | Script for ld -r: link without relocation |
avr32elf_uc3b0256.xu | Script for ld -Ur: link w/out relocation, do create constructors |
avr32elf_uc3b0256.xwr | Linker script for writable rodata |
はて?スタンドアローン版で読み込まれるのはどれだろう?たぶん.xか.xwrだろうけど。とりあえずavr32elf_uc3b0256.xのファイル名を変更した上でビルドしてみると
toolchain/bin/../lib/gcc/avr32/4.3.2/../../../../avr32/bin/ld.exe: cannot open linker script file ldscripts/avr32elf_uc3b0256.x: No such file or directory
めでたく(?)avr32elf_uc3b0256.xであることが確認出来た。
今後、リンカ・スクリプトも勉強目的で読む予定。