Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
smol
Commits
4389c2e0
Commit
4389c2e0
authored
Mar 09, 2020
by
PoroCYon
Committed by
PoroCYon
Jul 11, 2020
Browse files
add more detailed exported symbols, useful for compressed code size listings
parent
e0bde71b
Changes
5
Hide whitespace changes
Inline
Side-by-side
rt/header32.asm
View file @
4389c2e0
...
...
@@ -6,6 +6,8 @@
%include "elf.inc"
global
_EHDR
_EHDR:
ehdr:
; e_ident
db
0x7F
,
"ELF"
...
...
@@ -47,6 +49,8 @@ ehdr:
; dd (PHDR_R | PHDR_W)
; dd 0x1;000
%else
global
_PHDR
_PHDR:
phdr:
%endif
%ifdef USE_INTERP
...
...
@@ -81,6 +85,8 @@ phdr.end:
%ifdef USE_INTERP
[
section
.rodata.interp
]
global
_INTERP
_INTERP:
interp:
db
"
/
lib
/
ld
-
linux.so.2
"
,
0
interp.end:
...
...
rt/header64.asm
View file @
4389c2e0
...
...
@@ -6,6 +6,8 @@
%include "elf.inc"
global
_EHDR
_EHDR:
ehdr:
; e_ident
db
0x7F
,
"ELF"
...
...
@@ -32,6 +34,8 @@ ehdr:
ehdr.end:
%endif
global
_PHDR
_PHDR:
phdr:
%ifdef USE_INTERP
phdr.interp:
...
...
@@ -88,6 +92,8 @@ phdr.end:
%ifdef USE_INTERP
[
section
.rodata.interp
]
global
_INTERP
_INTERP:
interp:
db
"
/
lib64
/
ld
-
linux
-
x86
-
64
.so.2
"
,
0
interp.end:
...
...
rt/loader32.asm
View file @
4389c2e0
...
...
@@ -12,12 +12,15 @@
%endif
%ifndef USE_DNLOAD_LOADER
global
_smol_priv_data
_smol_priv_data:
_smol_linkmap:
dd
0
_smol_linkoff:
dd
0
%endif
global
_smol_start
_smol_start:
mov
eax
,
[
esp
-
32
]
; ???
...
...
@@ -273,4 +276,8 @@ repne scasd
;jmp short _start
; by abusing the linker script, _start ends up right here :)
%ifdef ELF_TYPE
global
_smol_rt_end
:
_smol_rt_end:
%endif
rt/loader64.asm
View file @
4389c2e0
...
...
@@ -23,6 +23,7 @@ extern _symbols
global
_start
_start:
%endif
global
_smol_start
:
_smol_start:
%ifdef USE_DL_FINI
xchg
r13
,
rdx
; _dl_fini
...
...
@@ -250,5 +251,9 @@ repne scasd ; technically, scasq should be used, but meh. this is 1 byte smaller
xchg
rsi
,
r13
; _dl_fini
%endif
; fallthru to _start
%ifdef ELF_TYPE
global
_smol_rt_end
:
_smol_rt_end:
%endif
;.loopme: jmp short .loopme
src/smolemit.py
View file @
4389c2e0
...
...
@@ -60,6 +60,7 @@ dynamic.end:
"""
)
outf
.
write
(
'[section .rodata.neededlibs]
\n
'
)
outf
.
write
(
'global _strtab
\n
'
)
outf
.
write
(
'_strtab:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
outf
.
write
(
'
\t
_symbols.{}: db "{}",0
\n
'
.
format
(
shorts
[
library
],
library
))
...
...
@@ -68,6 +69,7 @@ dynamic.end:
if
not
nx
:
outf
.
write
(
'[section .text.smolplt]
\n
'
)
outf
.
write
(
'global _symbols
\n
'
)
outf
.
write
(
'_symbols:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
for
sym
,
reloc
in
symrels
:
...
...
@@ -90,6 +92,7 @@ dynamic.end:
outf
.
write
(
'_symbols.end:
\n
'
)
if
nx
:
outf
.
write
(
'global _smolplt
\n
'
)
outf
.
write
(
'_smolplt:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
for
sym
,
reloc
in
symrels
:
...
...
@@ -139,12 +142,14 @@ dynamic.end:
outf
.
write
(
'[section .rodata.neededlibs]
\n
'
)
outf
.
write
(
'global _strtab
\n
'
)
outf
.
write
(
'_strtab:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
outf
.
write
(
'
\t
_symbols.{}: db "{}",0
\n
'
.
format
(
shorts
[
library
],
library
))
outf
.
write
(
'[section .data.smolgot]
\n
'
)
outf
.
write
(
'global _symbols
\n
'
)
outf
.
write
(
'_symbols:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
for
sym
,
reloc
in
symrels
:
...
...
@@ -166,6 +171,7 @@ global {name}
outf
.
write
(
'db 0
\n
'
)
outf
.
write
(
'_symbols.end:
\n
'
)
outf
.
write
(
'global _smolplt
\n
'
)
outf
.
write
(
'_smolplt:
\n
'
)
for
library
,
symrels
in
libraries
.
items
():
for
sym
,
reloc
in
symrels
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment