Comments (6)
Could you share more details about your problem? What are the relocations you are trying to handle?
from mold.
Could you share more details about your problem? What are the relocations you are trying to handle?
Sure.
I'd like to replace the original call to InputSection::apply_reloc_[no]alloc with InputSection::apply_relax. Where apply_relax is a new member function added to the InputSection class that handles relaxation including pcalau12i/addi -> pcaddi.
The copy_chunks (where the relaxation occurs) is followed by apply_relocate(new routine), which invokes OutputSection::apply_relocate to relocate all InputSections.
In the current hypothesis, the calling relationship is as follows
copy_chunks->chunk.copy_buf->OutputSection::write_to->InputSection::write_to->InputSection::apply_relax
apply_relocate->OutputSection::apply_relocate->InputSection::apply_reloc_[no[alloc
All of these changes are made so that all InputSections have been relocated before relaxation.
from mold.
Have you read https://github.com/rui314/mold/blob/main/elf/arch-riscv.cc? I believe LoongArch's relaxation is modeled after the RISC-V psABI's, so maybe you can do the same as RISC-V?
from mold.
Have you read https://github.com/rui314/mold/blob/main/elf/arch-riscv.cc? I believe LoongArch's relaxation is modeled after the RISC-V psABI's, so maybe you can do the same as RISC-V?
Thanks.
I've searched for this file before based on "arg.relax", but there is only one case processed in riscv and that case doesn't delete the instruction bytes, so that case doesn't cause the symval to change. But for the case of relaxation that deletes instructions(i.e., pcalau12i/addi -> pcaddi in loongarch), it may cause some of the symbol values to be changed. If relocation is done where the symbols are used before these relaxations are applied, then after the relaxation is applied, the value of the symbols are changed and the relocation is invalidated. That's why maybe we need to do the relaxation before the relocation.
from mold.
We do support the RISC-V relaxations that remove bytes. Please take a look at riscv_resize_sections
in that file.
from mold.
We do support the RISC-V relaxations that remove bytes. Please take a look at
riscv_resize_sections
in that file.
Sorry for my omission. Thank you, Rui.
from mold.
Related Issues (20)
- Mold crash in mold::elf::InputSection<mold::elf::X86_64>::get_fragment at mold/elf/mold.h:2363 HOT 9
- test arm-arm_abs-error fails on linux armel
- sparc64: a bunch of tests are failing HOT 25
- x32: most of the tests are failing HOT 1
- Failing tests on Alpine with 2.32.1 HOT 5
- Runtime error with Intel MKL and FEAST solver HOT 2
- VTT and discarded COMDAT error HOT 3
- x86_64-as-needed-weak (Failed) HOT 4
- Undefined reference when linking shared libraries not raised HOT 1
- mold: error: undefined symbol: OPENSSL_ia32cap_P HOT 2
- cosmic-applets, rust, out of memory when linking? HOT 6
- unknown command line option: -dynamic-list-data HOT 1
- Regarding no-execute HOT 3
- Alpinelinux 32bits build failure HOT 10
- mold 2.33.0 segfaults with --icf=all
- fatal: invalid --build-id argument: fast
- Solutions for ```__wine_spec_nt_header```? HOT 1
- gentoo-test.sh failes due to a conflict HOT 8
- Crash with `-D_GLIBCXX_ASSERTIONS` when building dtrace HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mold.