rr-debugger / rr-debugger/rr

Linker error with rr_page.ld during build

Open
#2,985 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

When building rr on Debian 10 with clang 11 and gold GNU gold (GNU Binutils for Debian 2.31.1) 1.16 I get the following error

/usr/bin/cmake -E cmake_link_script CMakeFiles/rrpage.dir/link.txt --verbose=1
/usr/bin/cc -fPIC  -D__USE_LARGEFILE64 -pthread -msse2 -D__MMX__ -D__SSE__ -D__SSE2__ -Wstrict-prototypes -std=gnu11 -Wno-unused-command-line-argument   -g -Wl,-T -Wl,/path/to/rr/src/src/preload/rr_page.ld -Wl,--hash-style=both -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-soname,linux-vdso.so.1  -shared  -o lib/rr/librrpage.so CMakeFiles/rrpage.dir/src/preload/rr_page.S.o
/usr/bin/ld: error: allocated section not in any PT_LOAD segment
/usr/bin/ld: error: allocated section not in any PT_LOAD segment
/usr/bin/ld: internal error in offset, at ../../gold/output.h:227
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I believe the reason is that the .text and .data sections are not handled in the linker script. At least adding

  /DISCARD/ : { *(.text) }
  /DISCARD/ : { *(.data) }

to the SECTIONS command in rr_page.ld makes the error go away. Afterwards, rr builds successfully and the tests pass . Since my understandling of rr is very limited though, I am not sure whether this change breaks something else.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Debian 10 clang 11 and gold build failure using the linker command shown in the issue. Inspect src/preload/rr_page.ld, especially its SECTIONS command and handling of .text and .data. Verify the chosen linker-script change by rebuilding rr and running the test suite, while checking that the generated rrpage library remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, linux
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.