1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-11 21:17:28 +03:00

[Mach-O] Add a test for mach-o stub

This commit is contained in:
Rui Ueyama 2021-09-08 19:15:12 +09:00
parent 5dab8612c8
commit 8f10ac5047
6 changed files with 22 additions and 4 deletions

1
.gitignore vendored
View File

@ -8,5 +8,6 @@ compile_commands.json
options.inc
core
ld
ld64.mold
gentoo
out

View File

@ -75,6 +75,7 @@ all: mold mold-wrapper.so
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB)
$(CXX) $(CPPFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
ln -sf mold ld
ln -sf mold ld64.mold
mold-wrapper.so: elf/mold-wrapper.c Makefile
$(CC) -fPIC -shared -o $@ $< -ldl
@ -102,13 +103,12 @@ $(TBB_LIB):
(cd out/tbb; ln -sf *_relwithdebinfo libs)
test tests check: all
$(MAKE) -C test/elf --output-sync --no-print-directory
$(MAKE) -C test --output-sync --no-print-directory
install: all
install -m 755 -d $(DEST)/bin
install -m 755 mold $(DEST)/bin
strip $(DEST)/bin/mold
ln -sf mold $(DEST)/bin/ld.mold
install -m 755 -d $(DEST)/lib/mold
install -m 644 mold-wrapper.so $(DEST)/lib/mold
@ -119,12 +119,15 @@ install: all
rm -f $(DEST)/share/man/man1/mold.1.gz
gzip -9 $(DEST)/share/man/man1/mold.1
ln -sf mold $(DEST)/bin/ld.mold
ln -sf mold $(DEST)/bin/ld64.mold
uninstall:
rm -f $(DEST)/bin/mold $(DEST)/bin/ld.mold
rm -f $(DEST)/share/man/man1/mold.1.gz
rm -rf $(DEST)/lib/mold
clean:
rm -rf *~ mold mold-wrapper.so out ld
rm -rf *~ mold mold-wrapper.so out ld ld64.mold
.PHONY: all test tests check clean

View File

@ -1,8 +1,11 @@
#include "mold.h"
#include <iostream>
namespace mold::macho {
int macho_main(int argc, char **argv) {
std::cout << "mold macho stub\n";
return 0;
}

View File

@ -1,4 +1,4 @@
TESTS = $(wildcard *.sh)
TESTS = $(wildcard elf/*.sh macho/*.sh)
test: $(TESTS)

11
test/macho/basic.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
cd $(dirname $0)
mold=`pwd`/../../ld64.mold
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/../../out/test/elf/$(basename -s .sh $0)
mkdir -p $t
$mold | grep -q 'mold macho stub'
echo OK