Adjust relocations after relaxation on LoongArch#1585
Open
CSharperMantle wants to merge 3 commits into
Open
Conversation
Author
|
Will look into CI failures today. |
Author
|
I think we're hitting a case of llvm/llvm-project#107749 here, where an $ loongarch64-linux-gnu-readelf -l build/out/test/loongarch64/arch-loongarch64-emit-relocs-relax/exe
Elf file type is EXEC (Executable file)
Entry point 0x2102d8
There are 10 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000200040 0x0000000000200040
0x0000000000000230 0x0000000000000230 R 0x8
INTERP 0x0000000000000270 0x0000000000200270 0x0000000000200270
0x0000000000000025 0x0000000000000025 R 0x1
[Requesting program interpreter: /lib64/ld-linux-loongarch-lp64d.so.1]
NOTE 0x0000000000000298 0x0000000000200298 0x0000000000200298
0x0000000000000024 0x0000000000000024 R 0x4
LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000
0x00000000000002d8 0x00000000000002d8 R 0x10000
LOAD 0x00000000000002d8 0x00000000002102d8 0x00000000002102d8
0x0000000000000040 0x0000000000000040 R E 0x10000
LOAD 0x0000000000000318 0x0000000000220318 0x0000000000220318
0x0000000000000010 0x000000000000fce8 RW 0x10000
LOAD 0x0000000000000328 0x0000000000230328 0x0000000000230328
0x0000000000000020 0x0000000000000020 RW 0x10000
GNU_EH_FRAME 0x00000000000002c4 0x00000000002002c4 0x00000000002002c4
0x000000000000000c 0x000000000000000c R 0x4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 0x1
GNU_RELRO 0x0000000000000318 0x0000000000220318 0x0000000000220318
0x0000000000000010 0x000000000000fce8 R 0x1
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .note.gnu.build-id
03 .interp .note.gnu.build-id .eh_frame .eh_frame_hdr .rodata
04 .text
05 .got .relro_padding
06 .data .got.plt
07 .eh_frame_hdr
08
09 .got .relro_paddingwith the following backtrace: I'll add |
7acc603 to
44859df
Compare
44859df to
beaf535
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds relocation adjustment to discard stale ones after relaxation. For simplicity, this PR does not delete old relocation entries. Instead, we set them to
R_LARCH_NONEto make them a no-op.Fixes #1584. With this applied, relaxed instructions in https://github.com/CSharperMantle/mold-issue-1584 are attached with correct relocations.
v2 (44859df):