mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 17:17:40 +03:00
Compare commits
8 Commits
c6b4078c48
...
dfb4180504
Author | SHA1 | Date | |
---|---|---|---|
|
dfb4180504 | ||
|
b145377c39 | ||
|
08f2a74be7 | ||
|
82fb10fe26 | ||
|
34f4d654d3 | ||
|
091395df33 | ||
|
a38be94064 | ||
|
24f818820b |
@ -61,6 +61,8 @@ target_compile_features(mold PRIVATE cxx_std_20)
|
||||
|
||||
if(MINGW)
|
||||
target_link_libraries(mold PRIVATE dl)
|
||||
else()
|
||||
target_link_libraries(mold PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(NOT "${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
|
||||
|
@ -163,7 +163,7 @@ tool.
|
||||
(i.e. `_start`) or a few other root sections. In mold, we are using
|
||||
multiple threads to mark sections concurrently.
|
||||
|
||||
- Similarly, BFD, gold an lld support Identical Comdat Folding (ICF)
|
||||
- Similarly, BFD, gold and lld support Identical Comdat Folding (ICF)
|
||||
as yet another size optimization. ICF merges two or more read-only
|
||||
sections that happen to have the same contents and relocations.
|
||||
To do that, we have to find isomorphic subgraphs from larger graphs.
|
||||
@ -381,7 +381,7 @@ not plan to implement and why I turned them down.
|
||||
fixing the final file layout.
|
||||
|
||||
The other reason to reject this idea is because there's good a
|
||||
chance for this idea to have a negative impact on linker's overall
|
||||
chance for this idea to have a negative impact on the linker's overall
|
||||
performance. If we copy file contents before fixing the layout, we
|
||||
can't apply relocations to them while copying because symbol
|
||||
addresses are not available yet. If we fix the file layout first, we
|
||||
|
@ -554,8 +554,7 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
|
||||
//
|
||||
// - Static PIE binaries crash on startup in some RISC-V environment if
|
||||
// we write addends to relocated places.
|
||||
if constexpr (is_sparc<E> || is_riscv<E>)
|
||||
ctx.arg.apply_dynamic_relocs = false;
|
||||
ctx.arg.apply_dynamic_relocs = !is_sparc<E> && !is_riscv<E>;
|
||||
|
||||
auto read_arg = [&](std::string name) {
|
||||
for (const std::string &opt : add_dashes(name)) {
|
||||
|
@ -43,6 +43,9 @@ clear-linux-*)
|
||||
swupd update
|
||||
swupd bundle-add c-basic diffutils
|
||||
;;
|
||||
almalinux-*)
|
||||
dnf install -y gcc-toolset-13-gcc-c++ gcc-toolset-13-libstdc++-devel cmake diffutils
|
||||
;;
|
||||
*)
|
||||
echo "Error: don't know anything about build dependencies on $ID-$VERSION_ID"
|
||||
exit 1
|
||||
|
@ -18,14 +18,14 @@ cat <<EOF | $CC -o $t/libbar.so -shared -fPIC -Wl,-soname,libbar.so -xc -
|
||||
int fn2() { return 42; }
|
||||
EOF
|
||||
|
||||
$CC -o $t/exe1 $t/a.o -Wl,-no-as-needed -L$t -lbar -lfoo
|
||||
$CC -B. -o $t/exe1 $t/a.o -Wl,-no-as-needed -L$t -lbar -lfoo
|
||||
|
||||
readelf --dynamic $t/exe1 > $t/log1
|
||||
grep -Fq 'Shared library: [libfoo.so]' $t/log1
|
||||
grep -Fq 'Shared library: [libbar.so]' $t/log1
|
||||
|
||||
$CC -o $t/exe2 $t/a.o -Wl,-as-needed -L$t -lbar -lfoo
|
||||
$CC -B. -o $t/exe2 $t/a.o -Wl,-as-needed -L$t -lbar -lfoo
|
||||
|
||||
readelf --dynamic $t/exe2 > $t/log2
|
||||
! grep -Fq 'Shared library: [libfoo.so]' $t/log2 || false
|
||||
grep -Fq 'Shared library: [libfoo.so]' $t/log2
|
||||
! grep -Fq 'Shared library: [libbar.so]' $t/log2 || false
|
||||
|
@ -65,6 +65,8 @@ $CC -c -o $t/d.o $t/d.c -fPIC -g -ggnu-pubnames -gdwarf-5 -ffunction-sections
|
||||
|
||||
$CC -B. -shared -o $t/e.so $t/a.o $t/b.o $t/c.o $t/d.o -Wl,--gdb-index
|
||||
readelf -WS $t/e.so 2> /dev/null | grep -Fq .gdb_index
|
||||
readelf --debug=gdb_index $t/e.so 2> /dev/null | grep -q 'fn1: .* \[global, function\]'
|
||||
readelf --debug=gdb_index $t/e.so 2> /dev/null | grep -q 'char: .* \[static, type\]'
|
||||
|
||||
cat <<EOF | $CC -c -o $t/f.o -fPIC -g -ggnu-pubnames -gdwarf-5 -xc - -gz
|
||||
void fn1();
|
||||
@ -76,6 +78,7 @@ EOF
|
||||
|
||||
$CC -B. -o $t/exe $t/e.so $t/f.o -Wl,--gdb-index
|
||||
readelf -WS $t/exe 2> /dev/null | grep -Fq .gdb_index
|
||||
readelf --debug=gdb_index $t/exe 2> /dev/null | grep -q 'main: .* \[global, function\]'
|
||||
|
||||
$QEMU $t/exe | grep -q 'Hello world'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user