Compiler should not emit these types of relocations unless it knows
they will never refer imported symbols. However, it looks like GCC 7
emits these relocations against global symbols with STB_GNU_UNIQUE
attribute, which can be resolved to a symbol in other ELF module at
runtime. It looks like the bug only exists in GCC 7 and fixed in
recent versions of GCC.
mold verifies the above conditions and reports an error if the
condition is violated. On the other hand, GNU ld and LLVM lld don't
verify and simply create a shared library that is not always
guaranteed to work.
Give this situation, I decided to simply remove the verification code
from mold. This is what other linkers do, and it make mold "compatible"
with GCC 7.
Fixes https://github.com/rui314/mold/issues/145
When we are creating a DSO, unresolved undefined symbols are promoted to
dynamic symbols by default so that they will get another chance to be
resolved at runtime.
You can suppress this behavior by passing `-z defs`. If that option is
given, remaining undefs are reported as errors instead of being silently
promoted.
It looks like `-warn-undefined-symbols` negates the effect of `-z defs`.
So, if both options are given, remaining undefs are promoted to dynamic
symbols. mold previously silently make such symbols absolute symbols with
value 0.
Fixed https://github.com/rui314/mold/issues/152
This allows the caller to pass extra build options if desired.
Moreover, it is possible to run `./build-static.sh test` in order to
execute the testsuite inside the container.
Signed-off-by: Christoph Erhardt <github@sicherha.de>
These packages contain the i686 toolchain as well as the `file` and
`hexdump` utilities. They increase the size of the container image by
approximately 10 % (70 MiB).
Signed-off-by: Christoph Erhardt <github@sicherha.de>
* Append the `Z` option for the mounted volume
* Add `--userns=keep-id` if Podman's `docker` wrapper is used
Signed-off-by: Christoph Erhardt <github@sicherha.de>
This reverts commit 1baac27e8c.
In order to link gcc 7's output, relaxing this error check wasn't
enough as reported on https://github.com/rui314/mold/issues/145.
We need to remove more error checks or keep them as-is.
For now, I'll restore all the error checks, but before making another
release, I may remove all error checks to accept gcc 7's buggy
output files.
Once object files are linked into an executable or a shared object file,
sections are no longer splittable. So these bits don't make sense anymore.
Previously, we cleared the bits. But it looks like there are tools that
are picky about them. So we'll just leave them as-is.
Fixes https://github.com/rui314/mold/issues/155
This is an attempt to speed up version script application.
It looks like RE2 is faster than libstdc++'s std::regex.
This change reduces libQt6Gui.so.6.3.0's link time by about 30%.
https://github.com/rui314/mold/issues/156
In some environment, XXH3 isn't available as a binary package.
If you do not like to use the imported xxhash library but instead
link to system's libxxhash.so, invoke make with `SYSTEM_XXHASH=1`.
These test files are not only invoked by make by also directly by hand.
Unsetting `LANG` on each file so that they don't fail in a non-English
environment.
This change is mechanically created by the following command:
sed -i '1 a export LANG=' test/*/*.sh
If the tests are executed in a different locale like French, some logs (ex: ```out/test/elf/auxiliary/log```) can contain output like:
```La section dynamique à l'offset 0x2000 contient 10 entrées :```
which of course doesn't work as the grep is
```
fgrep -q 'Auxiliary library: [foo]' $t/log
```
Signed-off-by: Sylvestre Ledru <sylvestre@debian.org>
Previously, if the following conditions are met:
- we are creating a shared object file,
- there's an undefined symbol in an input object file that are
to be promoted to a dynamic symbol, and
- a version script defining a default version is given,
then the symbol gets the default version. But that's a wrong behavior
because version scripts should not affect symbols that are not defined
in an output file.
This change fixes the issue by not setting version to such symbol.
Fixes https://github.com/rui314/mold/issues/151