1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00
This commit is contained in:
Rui Ueyama 2021-03-25 18:02:42 +09:00
parent 60029b028f
commit f89e0aa367
4 changed files with 59 additions and 5 deletions

View File

@ -6,7 +6,7 @@ TBB_LIBDIR=$(wildcard $(CURRENT_DIR)/oneTBB/build/linux_intel64_*_release/)
MALLOC_LIBDIR=$(CURRENT_DIR)/mimalloc/out/release
CPPFLAGS=-g -IoneTBB/include -IxxHash -pthread -std=c++20 \
-Wno-deprecated-volatile -Wno-switch -O0 \
-Wno-deprecated-volatile -Wno-switch -O2 \
-DGIT_HASH=\"$(shell git rev-parse HEAD)\"
LDFLAGS=-L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) \
-L$(MALLOC_LIBDIR) -Wl,-rpath=$(MALLOC_LIBDIR) \

View File

@ -209,13 +209,11 @@ static void create_synthetic_sections() {
add(out::got = new GotSection);
add(out::gotplt = new GotPltSection);
add(out::relplt = new RelPltSection);
if (!config.strip_all)
add(out::strtab = new StrtabSection);
add(out::strtab = new StrtabSection);
add(out::shstrtab = new ShstrtabSection);
add(out::plt = new PltSection);
add(out::pltgot = new PltGotSection);
if (!config.strip_all)
add(out::symtab = new SymtabSection);
add(out::symtab = new SymtabSection);
add(out::dynsym = new DynsymSection);
add(out::dynstr = new DynstrSection);
add(out::eh_frame = new EhFrameSection);

26
test/dynamic-linker.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e
cd $(dirname $0)
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/tmp/$(basename -s .sh $0)
mkdir -p $t
cat <<EOF | clang -c -o $t/a.o -x assembler -
.globl _start
_start:
ret
EOF
../mold -o $t/exe $t/a.o
readelf --sections $t/exe > $t/log
! fgrep .interp $t/log
readelf --dynamic $t/exe > $t/log
../mold -o $t/exe $t/a.o --dynamic-linker=/foo/bar
readelf --sections $t/exe > $t/log
fgrep -q .interp $t/log
echo OK

30
test/strip.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -e
cd $(dirname $0)
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/tmp/$(basename -s .sh $0)
mkdir -p $t
cat <<'EOF' | cc -x assembler -c -o $t/a.o -Wa,--keep-locals -
.globl _start, foo
_start:
foo:
bar:
.L.baz:
EOF
../mold -o $t/exe $t/a.o
readelf --symbols $t/exe > $t/log
fgrep -q _start $t/log
fgrep -q foo $t/log
fgrep -q bar $t/log
fgrep -q .L.baz $t/log
../mold -o $t/exe $t/a.o -strip-all
readelf --symbols $t/exe > $t/log
! fgrep -q _start $t/log
! fgrep -q foo $t/log
! fgrep -q bar $t/log
! fgrep -q .L.baz $t/log
echo OK