Skip to content

Commit

Permalink
elf: move needed shared library entry to end of dynamic array
Browse files Browse the repository at this point in the history
All other entires will always be present.
  • Loading branch information
mewmew committed Mar 9, 2019
1 parent fa0e190 commit 23cc8df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions elf32/elf32.asm
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,12 @@ dynamic_off equ dynamic - BASE_RODATA

dynamic:

.libc:
dd DT_NEEDED ; tag: Dynamic entry type
dd dynstr.libc_off ; val: Integer or address value

.entsize equ $ - dynamic

.strtab:
dd DT_STRTAB ; tag: Dynamic entry type
dd dynstr ; val: Integer or address value

.entsize equ $ - dynamic

.symtab:
dd DT_SYMTAB ; tag: Dynamic entry type
dd dynsym ; val: Integer or address value
Expand All @@ -187,6 +183,10 @@ dynamic:
dd DT_PLTGOT ; tag: Dynamic entry type
dd got_plt ; val: Integer or address value

.libc:
dd DT_NEEDED ; tag: Dynamic entry type
dd dynstr.libc_off ; val: Integer or address value

.null:
dd DT_NULL ; tag: Dynamic entry type
dd 0 ; val: Integer or address value
Expand Down
12 changes: 6 additions & 6 deletions elf64/elf64.asm
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,12 @@ DT_JMPREL equ 23 ; Address of the relocation entities of the PLT

dynamic:

.libc:
dq DT_NEEDED ; tag: Dynamic entry type
dq dynstr.libc_off ; val: Integer or address value

.entsize equ $ - dynamic

.strtab:
dq DT_STRTAB ; tag: Dynamic entry type
dq dynstr ; val: Integer or address value

.entsize equ $ - dynamic

.symtab:
dq DT_SYMTAB ; tag: Dynamic entry type
dq dynsym ; val: Integer or address value
Expand All @@ -183,6 +179,10 @@ dynamic:
dq DT_PLTGOT ; tag: Dynamic entry type
dq got_plt ; val: Integer or address value

.libc:
dq DT_NEEDED ; tag: Dynamic entry type
dq dynstr.libc_off ; val: Integer or address value

.null:
dq DT_NULL ; tag: Dynamic entry type
dq 0 ; val: Integer or address value
Expand Down

0 comments on commit 23cc8df

Please sign in to comment.