Skip to content

Instantly share code, notes, and snippets.

@doug65536
Last active May 31, 2021 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doug65536/c30e5cd55054cc717afd5bd72c622d21 to your computer and use it in GitHub Desktop.
Save doug65536/c30e5cd55054cc717afd5bd72c622d21 to your computer and use it in GitHub Desktop.
doug@doug-dt:~/code/dgos/build$ g++ -nostdlib -Wl,-T,emb.ld emb.S -o emb -static -Wl,-no-build-id
/usr/bin/ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
doug@doug-dt:~/code/dgos/build$ objdump -h emb
emb: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .note.gnu.build-id 00000024 00000000ffe00000 00000000ffe00000 00200000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 00200000 00000000ffe00024 00000000ffe00024 00200024 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
doug@doug-dt:~/code/dgos/build$ cat emb.ld
/* -2M */
. = 0xFFE00000;
SECTIONS {
/DISCARD/ : { *(.note.gnu.build-id); }
.text : {
*(.text);
. = (2<<20)-16;
. = .;
*(.text.entry);
. = 2<<20;
}
}
doug@doug-dt:~/code/dgos/build$ cat emb.S
.section .text.entry
entry:
jmp _start
.section .text
_start:
jmp _start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment