Skip to content

Instantly share code, notes, and snippets.

@hangingman
Created November 23, 2016 06:17
Show Gist options
  • Save hangingman/792074e02a8d4dd33042b3dbe7febdef to your computer and use it in GitHub Desktop.
Save hangingman/792074e02a8d4dd33042b3dbe7febdef to your computer and use it in GitHub Desktop.
object から .hrb 形式変換のためのリンカスクリプト(from: http://vanya.jp.net/os/haribote.html)
OUTPUT_FORMAT("binary");
SECTIONS
{
.head 0x0 : {
LONG(64 * 1024) /* 0 : stack+.data+heap の大きさ(4KBの倍数) */
LONG(0x69726148) /* 4 : シグネチャ "Hari" */
LONG(0) /* 8 : mmarea の大きさ(4KBの倍数) */
LONG(0x310000) /* 12 : スタック初期値&.data転送先 */
LONG(SIZEOF(.data)) /* 16 : .dataサイズ */
LONG(LOADADDR(.data)) /* 20 : .dataの初期値列のファイル位置 */
LONG(0xE9000000) /* 24 : 0xE9000000 */
LONG(HariMain - 0x20) /* 28 : エントリアドレス - 0x20 */
LONG(0) /* 32 : heap領域(malloc領域)開始アドレス */
}
.text : { *(.text) }
.data 0x310000 : AT ( ADDR(.text) + SIZEOF(.text) ) {
*(.data)
*(.rodata*)
*(.bss)
}
/DISCARD/ : { *(.eh_frame) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment