Skip to content

Commit

Permalink
Merge pull request #1800 from ghaerr/libelf
Browse files Browse the repository at this point in the history
[build] Fix elf2elks libelf build on Apple M1
  • Loading branch information
ghaerr authored Feb 6, 2024
2 parents e58868f + a3233a5 commit dec1bd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions elks/tools/elf2elks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ elf2elks.o: elf2elks.c $(LIBELF)
# make. To avoid roping in BSD make as yet another dependency, we directly
# run the commands to generate and compile the libelf sources here. This
# still requires m4 as a dependency though.
$(LIBELF): $(ELFTOOLCHAIN).tar.bz2 lib/elftoolchain.patch
$(LIBELF): $(ELFTOOLCHAIN).tar.bz2 lib/elftoolchain.patch lib/elftoolchain2.patch
rm -rf $(ELFTOOLCHAIN)
cd lib && tar -xvjf elftoolchain-0.7.1.tar.bz2
cd $(ELFTOOLCHAIN) && patch -p1 <'$(abspath lib/elftoolchain.patch)'
cd $(ELFTOOLCHAIN) && patch -p1 <'$(abspath lib/elftoolchain.patch)' && patch -p1 <'$(abspath lib/elftoolchain2.patch)'
ifeq "Linux" "$(shell uname -s)"
set -e; \
cd $(ELFTOOLCHAIN)/common; \
Expand Down
13 changes: 13 additions & 0 deletions elks/tools/elf2elks/lib/elftoolchain2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- elftoolchain-0.7.1/libelf/_libelf_config.h 2024-02-06 14:09:41.000000000 -0700
+++ 1 2024-02-06 14:09:27.000000000 -0700
@@ -36,6 +36,10 @@
#define LIBELF_ARCH EM_386
#define LIBELF_BYTEORDER ELFDATA2LSB
#define LIBELF_CLASS ELFCLASS32
+#elif defined(__aarch64__)
+#define LIBELF_ARCH EM_AARCH64
+#define LIBELF_BYTEORDER ELFDATA2LSB
+#define LIBELF_CLASS ELFCLASS64
#endif

#endif /* __DragonFly__ */

0 comments on commit dec1bd5

Please sign in to comment.