1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-26 21:20:46 +03:00

Update README

This commit is contained in:
Rui Ueyama 2021-03-24 18:38:08 +09:00
parent f1fc305311
commit d723668a74
4 changed files with 30 additions and 4 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/test/tmp
options.inc
core
ld

View File

@ -18,6 +18,7 @@ OBJS=main.o object_file.o input_sections.o output_chunks.o mapfile.o perf.o \
mold: $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
ln -sf mold ld
$(OBJS): mold.h elf.h Makefile
@ -32,6 +33,6 @@ test: mold
for i in test/*.sh; do $$i || exit 1; done
clean:
rm -f *.o *~ mold
rm -f *.o *~ mold ld
.PHONY: intel_tbb test clean

View File

@ -60,10 +60,33 @@ $ make submodules
$ make
```
To use mold, add `-fuse-ld=<absolute-path-to-mold-executable>` to a
linker command line. Since GCC doesn't support that option,
The last `make` command creates `mold` executable. It also creates a
symbolic link `ld` to `mold` in the build directory.
To use mold, run a build command with the mold build directory at the
beginning of `PATH`. E.g.
```
$ PATH=/path/to/mold/build/dir:$PATH make
```
Alternatively, you can pass `-fuse-ld=<absolute-path-to-mold-executable>`
to a linker command line. Since GCC doesn't support that option,
I recommend using clang.
mold leaves its identification string in `.comment` section in an output
file. You can print it out to verify that you are actually using mold.
```
$ readelf -p .comment <executable-file>
String dump of section '.comment':
[ 0] GCC: (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
[ 2b] mold 9a1679b47d9b22012ec7dfbda97c8983956716f7
```
If `mold` is in `.comment`, the file is created by mold.
## Background
- Even though lld has significantly improved the situation, linking is

View File

@ -1145,7 +1145,8 @@ std::vector<Symbol *> SharedFile::find_aliases(Symbol *sym) {
assert(sym->file == this);
std::vector<Symbol *> vec;
for (Symbol *sym2 : symbols)
if (sym != sym2 && sym->esym->st_value == sym2->esym->st_value)
if (sym2->file == this && sym != sym2 &&
sym->esym->st_value == sym2->esym->st_value)
vec.push_back(sym2);
return vec;
}