mirror of
https://github.com/rui314/mold.git
synced 2024-09-17 16:09:43 +03:00
-r: Do not emit .eh_frame if there's no input .eh_frame
This commit is contained in:
parent
3a4166a066
commit
556a5cabf9
@ -2020,6 +2020,14 @@ template <typename E>
|
||||
void EhFrameSection<E>::construct(Context<E> &ctx) {
|
||||
Timer t(ctx, "eh_frame");
|
||||
|
||||
// If .eh_frame is missing in all input files, we don't want to
|
||||
// create an output .eh_frame section.
|
||||
if (std::all_of(ctx.objs.begin(), ctx.objs.end(),
|
||||
[](ObjectFile<E> *file) { return file->cies.empty(); })) {
|
||||
this->shdr.sh_size = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove dead FDEs and assign them offsets within their corresponding
|
||||
// CIE group.
|
||||
tbb::parallel_for_each(ctx.objs, [&](ObjectFile<E> *file) {
|
||||
|
16
test/elf/relocatable-no-ehframe.sh
Executable file
16
test/elf/relocatable-no-ehframe.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
. $(dirname $0)/common.inc
|
||||
|
||||
# OneTBB isn't tsan-clean
|
||||
nm mold | grep -q '__tsan_init' && skip
|
||||
|
||||
cat <<EOF | $CC -c -o $t/a.o -xc -fno-unwind-tables -fno-asynchronous-unwind-tables -
|
||||
int foo() { return 1; }
|
||||
EOF
|
||||
|
||||
readelf -WS $t/a.o > $t/log1
|
||||
! grep -Fq .eh_frame $t/log1 || false
|
||||
|
||||
./mold --relocatable -o $t/b.o $t/a.o
|
||||
readelf -WS $t/b.o > $t/log2
|
||||
! grep -Fq .eh_frame $t/log2 || false
|
Loading…
Reference in New Issue
Block a user