Skip to content

Instantly share code, notes, and snippets.

@hackpascal
Last active October 14, 2018 11:46
Show Gist options
  • Save hackpascal/45e41225cc4c3d5cec16f3462a3c7c19 to your computer and use it in GitHub Desktop.
Save hackpascal/45e41225cc4c3d5cec16f3462a3c7c19 to your computer and use it in GitHub Desktop.
Embed a binary file into an object file which can be linked into a program and referenced by other source codes
.align 2
.section ".rodata.data_start", "a"
.globl data_start
.type data_start, @object
data_start:
.incbin "data.bin"
.equ _data_size, . - data_start
.size data_start, _data_size
.align 2
.section ".rodata.data_size", "a"
.globl data_size
.type data_size, @object
data_size:
.word _data_size
.size data_size, . - data_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment