Skip to content

Commit

Permalink
lib32: convert to NASM syntax and add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Mar 16, 2019
1 parent a42ab85 commit 4188237
Show file tree
Hide file tree
Showing 2 changed files with 1,619 additions and 793 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
all: lib_32.so lib_elf32.so

%_elf32.so: %_elf32.asm
nasm -f bin -o $@ $<
chmod +x $@

%_32.o: %_32.asm
nasm -f elf32 -o $@ $<

%_64.o: %_64.asm
nasm -f elf64 -o $@ $<

%_32.so: %_32.o
ld -m elf_i386 -shared -I /lib/ld-linux.so.2 -s -o $@ -L/usr/lib32 $<
strip -R .hash $@
#strip -R .gnu.hash $@
strip -R .gnu.version $@
#strip -R .eh_frame $@
strip -R .shstrtab $@

%_64.so: %_64.o
ld -shared -I /lib64/ld-linux-x86-64.so.2 -s -o $@ $< -lc
strip -R .hash $@
strip -R .gnu.hash $@
strip -R .gnu.version $@
strip -R .eh_frame $@
strip -R .shstrtab $@

.PHONY: all clean

clean:
$(RM) -v *.o
$(RM) -v hello_32 hello_64
$(RM) -v hello_elf32
Loading

0 comments on commit 4188237

Please sign in to comment.