Skip to content

Commit

Permalink
deploy: 25bec06
Browse files Browse the repository at this point in the history
  • Loading branch information
xdoardo committed Dec 10, 2024
1 parent 98d58f5 commit ba56157
Show file tree
Hide file tree
Showing 35 changed files with 336 additions and 114 deletions.
4 changes: 2 additions & 2 deletions crates/doc/search-index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
// JR r12 80 01 00 4c [00 00 00 00]
// JMPADDR 00 00 00 00 00 00 00 00
</span><span class="kw">const </span>LOONGARCH64_TRAMPOLINE: [u8; <span class="number">24</span>] = [
<span class="number">0x0c</span>, <span class="number">0x00</span>, <span class="number">0x00</span>, <span class="number">0x0c</span>, <span class="number">0x8c</span>, <span class="number">0x41</span>, <span class="number">0xc0</span>, <span class="number">0x28</span>, <span class="number">0x80</span>, <span class="number">0x01</span>, <span class="number">0x00</span>, <span class="number">0x4c</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>,
<span class="number">0x0c</span>, <span class="number">0x00</span>, <span class="number">0x00</span>, <span class="number">0x18</span>, <span class="number">0x8c</span>, <span class="number">0x41</span>, <span class="number">0xc0</span>, <span class="number">0x28</span>, <span class="number">0x80</span>, <span class="number">0x01</span>, <span class="number">0x00</span>, <span class="number">0x4c</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>,
<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>,
];

Expand Down
26 changes: 22 additions & 4 deletions crates/doc/src/wasmer_compiler/engine/link.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@
<a href="#268" id="268">268</a>
<a href="#269" id="269">269</a>
<a href="#270" id="270">270</a>
<a href="#271" id="271">271</a>
<a href="#272" id="272">272</a>
<a href="#273" id="273">273</a>
<a href="#274" id="274">274</a>
<a href="#275" id="275">275</a>
<a href="#276" id="276">276</a>
<a href="#277" id="277">277</a>
<a href="#278" id="278">278</a>
<a href="#279" id="279">279</a>
</pre></div><pre class="rust"><code><span class="doccomment">//! Linking for Universal-compiled code.

</span><span class="kw">use crate</span>::{
Expand Down Expand Up @@ -397,30 +406,39 @@
| read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u64);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u64, reloc_delta);
},
RelocationKind::LArchAbsHi20 =&gt; <span class="kw">unsafe </span>{
RelocationKind::LArchAbsHi20 | RelocationKind::LArchPCAlaHi20 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, reloc_abs) = r.for_address(body, target_func_address <span class="kw">as </span>u64);
<span class="kw">let </span>reloc_abs = ((((reloc_abs &gt;&gt; <span class="number">12</span>) &amp; <span class="number">0xfffff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">5</span>)
| read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_abs);
},
RelocationKind::LArchAbsLo12 =&gt; <span class="kw">unsafe </span>{
RelocationKind::LArchAbsLo12 | RelocationKind::LArchPCAlaLo12 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, reloc_abs) = r.for_address(body, target_func_address <span class="kw">as </span>u64);
<span class="kw">let </span>reloc_abs =
(((reloc_abs &amp; <span class="number">0xfff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">10</span>) | read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_abs);
},
RelocationKind::LArchAbs64Hi12 =&gt; <span class="kw">unsafe </span>{
RelocationKind::LArchAbs64Hi12 | RelocationKind::LArchPCAla64Hi12 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, reloc_abs) = r.for_address(body, target_func_address <span class="kw">as </span>u64);
<span class="kw">let </span>reloc_abs = ((((reloc_abs &gt;&gt; <span class="number">52</span>) &amp; <span class="number">0xfff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">10</span>)
| read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_abs);
},
RelocationKind::LArchAbs64Lo20 =&gt; <span class="kw">unsafe </span>{
RelocationKind::LArchAbs64Lo20 | RelocationKind::LArchPCAla64Lo20 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, reloc_abs) = r.for_address(body, target_func_address <span class="kw">as </span>u64);
<span class="kw">let </span>reloc_abs = ((((reloc_abs &gt;&gt; <span class="number">32</span>) &amp; <span class="number">0xfffff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">5</span>)
| read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_abs);
},
RelocationKind::LArchCall36 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, reloc_delta) = r.for_address(body, target_func_address <span class="kw">as </span>u64);
<span class="kw">let </span>reloc_delta1 = ((((reloc_delta &gt;&gt; <span class="number">18</span>) &amp; <span class="number">0xfffff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">5</span>)
| read_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned(reloc_address <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_delta1);
<span class="kw">let </span>reloc_delta2 = ((((reloc_delta &gt;&gt; <span class="number">2</span>) &amp; <span class="number">0xffff</span>) <span class="kw">as </span>u32) &lt;&lt; <span class="number">10</span>)
| read_unaligned((reloc_address + <span class="number">4</span>) <span class="kw">as </span><span class="kw-2">*mut </span>u32);
write_unaligned((reloc_address + <span class="number">4</span>) <span class="kw">as </span><span class="kw-2">*mut </span>u32, reloc_delta2);
},
RelocationKind::Aarch64AdrPrelPgHi21 =&gt; <span class="kw">unsafe </span>{
<span class="kw">let </span>(reloc_address, delta) = r.for_address(body, target_func_address <span class="kw">as </span>u64);

Expand Down
120 changes: 119 additions & 1 deletion crates/doc/src/wasmer_compiler/types/relocation.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,65 @@
<a href="#297" id="297">297</a>
<a href="#298" id="298">298</a>
<a href="#299" id="299">299</a>
<a href="#300" id="300">300</a>
<a href="#301" id="301">301</a>
<a href="#302" id="302">302</a>
<a href="#303" id="303">303</a>
<a href="#304" id="304">304</a>
<a href="#305" id="305">305</a>
<a href="#306" id="306">306</a>
<a href="#307" id="307">307</a>
<a href="#308" id="308">308</a>
<a href="#309" id="309">309</a>
<a href="#310" id="310">310</a>
<a href="#311" id="311">311</a>
<a href="#312" id="312">312</a>
<a href="#313" id="313">313</a>
<a href="#314" id="314">314</a>
<a href="#315" id="315">315</a>
<a href="#316" id="316">316</a>
<a href="#317" id="317">317</a>
<a href="#318" id="318">318</a>
<a href="#319" id="319">319</a>
<a href="#320" id="320">320</a>
<a href="#321" id="321">321</a>
<a href="#322" id="322">322</a>
<a href="#323" id="323">323</a>
<a href="#324" id="324">324</a>
<a href="#325" id="325">325</a>
<a href="#326" id="326">326</a>
<a href="#327" id="327">327</a>
<a href="#328" id="328">328</a>
<a href="#329" id="329">329</a>
<a href="#330" id="330">330</a>
<a href="#331" id="331">331</a>
<a href="#332" id="332">332</a>
<a href="#333" id="333">333</a>
<a href="#334" id="334">334</a>
<a href="#335" id="335">335</a>
<a href="#336" id="336">336</a>
<a href="#337" id="337">337</a>
<a href="#338" id="338">338</a>
<a href="#339" id="339">339</a>
<a href="#340" id="340">340</a>
<a href="#341" id="341">341</a>
<a href="#342" id="342">342</a>
<a href="#343" id="343">343</a>
<a href="#344" id="344">344</a>
<a href="#345" id="345">345</a>
<a href="#346" id="346">346</a>
<a href="#347" id="347">347</a>
<a href="#348" id="348">348</a>
<a href="#349" id="349">349</a>
<a href="#350" id="350">350</a>
<a href="#351" id="351">351</a>
<a href="#352" id="352">352</a>
<a href="#353" id="353">353</a>
<a href="#354" id="354">354</a>
<a href="#355" id="355">355</a>
<a href="#356" id="356">356</a>
<a href="#357" id="357">357</a>
<a href="#358" id="358">358</a>
</pre></div><pre class="rust"><code><span class="comment">/*
* ! Remove me once rkyv generates doc-comments for fields or generates an #[allow(missing_docs)]
* on their own.
Expand Down Expand Up @@ -384,6 +443,16 @@
</span>LArchAbs64Hi12,
<span class="doccomment">/// LoongArch absolute low 20bit
</span>LArchAbs64Lo20,
<span class="doccomment">/// LoongArch PC-relative call 38bit
</span>LArchCall36,
<span class="doccomment">/// LoongArch PC-relative high 20bit
</span>LArchPCAlaHi20,
<span class="doccomment">/// LoongArch PC-relative low 12bit
</span>LArchPCAlaLo12,
<span class="doccomment">/// LoongArch PC64-relative high 12bit
</span>LArchPCAla64Hi12,
<span class="doccomment">/// LoongArch PC64-relative low 20bit
</span>LArchPCAla64Lo20,
<span class="doccomment">/// Elf x86_64 32 bit signed PC relative offset to two GOT entries for GD symbol.
</span>ElfX86_64TlsGd,
<span class="comment">// /// Mach-O x86_64 32 bit signed PC relative offset to a `__thread_vars` entry.
Expand Down Expand Up @@ -414,6 +483,11 @@
<span class="self">Self</span>::LArchAbsLo12 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchAbsLo12"</span>),
<span class="self">Self</span>::LArchAbs64Hi12 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchAbs64Hi12"</span>),
<span class="self">Self</span>::LArchAbs64Lo20 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchAbs64Lo20"</span>),
<span class="self">Self</span>::LArchCall36 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchCall36"</span>),
<span class="self">Self</span>::LArchPCAlaHi20 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchPCAlaHi20"</span>),
<span class="self">Self</span>::LArchPCAlaLo12 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchPCAlaLo12"</span>),
<span class="self">Self</span>::LArchPCAla64Hi12 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchPCAla64Hi12"</span>),
<span class="self">Self</span>::LArchPCAla64Lo20 =&gt; <span class="macro">write!</span>(f, <span class="string">"LArchPCAla64Lo20"</span>),
<span class="self">Self</span>::Aarch64AdrPrelLo21 =&gt; <span class="macro">write!</span>(f, <span class="string">"Aarch64AdrPrelLo21"</span>),
<span class="self">Self</span>::Aarch64AdrPrelPgHi21 =&gt; <span class="macro">write!</span>(f, <span class="string">"Aarch64AdrPrelPgHi21"</span>),
<span class="self">Self</span>::Aarch64AddAbsLo12Nc =&gt; <span class="macro">write!</span>(f, <span class="string">"Aarch64AddAbsLo12Nc"</span>),
Expand Down Expand Up @@ -471,7 +545,12 @@
| RelocationKind::Arm64Movw3
| RelocationKind::RiscvPCRelLo12I
| RelocationKind::Aarch64Ldst128AbsLo12Nc
| RelocationKind::Aarch64Ldst64AbsLo12Nc =&gt; {
| RelocationKind::Aarch64Ldst64AbsLo12Nc
| RelocationKind::LArchAbsHi20
| RelocationKind::LArchAbsLo12
| RelocationKind::LArchAbs64Lo20
| RelocationKind::LArchAbs64Hi12
| RelocationKind::LArchPCAlaLo12 =&gt; {
<span class="kw">let </span>reloc_address = start + <span class="self">self</span>.offset() <span class="kw">as </span>usize;
<span class="kw">let </span>reloc_addend = <span class="self">self</span>.addend() <span class="kw">as </span>isize;
<span class="kw">let </span>reloc_abs = target_func_address
Expand Down Expand Up @@ -538,6 +617,45 @@
<span class="kw">let </span>pc_page = reloc_address &amp; !(<span class="number">0xFFF</span>);
(reloc_address, target_page.wrapping_sub(pc_page) <span class="kw">as </span>u64)
}
RelocationKind::LArchCall36 =&gt; {
<span class="kw">let </span>reloc_address = start + <span class="self">self</span>.offset() <span class="kw">as </span>usize;
<span class="kw">let </span>reloc_addend = <span class="self">self</span>.addend() <span class="kw">as </span>isize;
<span class="kw">let </span>reloc_delta = target_func_address
.wrapping_sub(reloc_address <span class="kw">as </span>u64)
.wrapping_add(reloc_addend <span class="kw">as </span>u64);
(
reloc_address,
reloc_delta.wrapping_add((reloc_delta &amp; <span class="number">0x20000</span>) &lt;&lt; <span class="number">1</span>),
)
}
RelocationKind::LArchPCAlaHi20 =&gt; {
<span class="kw">let </span>reloc_address = start + <span class="self">self</span>.offset() <span class="kw">as </span>usize;
<span class="kw">let </span>reloc_addend = <span class="self">self</span>.addend() <span class="kw">as </span>isize;
<span class="kw">let </span>target_page = (target_func_address
.wrapping_add(reloc_addend <span class="kw">as </span>u64)
.wrapping_add(<span class="number">0x800</span>)
&amp; !(<span class="number">0xFFF</span>)) <span class="kw">as </span>usize;
<span class="kw">let </span>pc_page = reloc_address &amp; !(<span class="number">0xFFF</span>);
(reloc_address, target_page.wrapping_sub(pc_page) <span class="kw">as </span>u64)
}
RelocationKind::LArchPCAla64Hi12 | RelocationKind::LArchPCAla64Lo20 =&gt; {
<span class="kw">let </span>reloc_address = start + <span class="self">self</span>.offset() <span class="kw">as </span>usize;
<span class="kw">let </span>reloc_addend = <span class="self">self</span>.addend() <span class="kw">as </span>isize;
<span class="kw">let </span>reloc_offset = <span class="kw">match </span><span class="self">self</span>.kind() {
RelocationKind::LArchPCAla64Lo20 =&gt; <span class="number">8</span>,
RelocationKind::LArchPCAla64Hi12 =&gt; <span class="number">12</span>,
<span class="kw">_ </span>=&gt; <span class="number">0</span>,
};
<span class="kw">let </span>target_func_address = target_func_address.wrapping_add(reloc_addend <span class="kw">as </span>u64);
<span class="kw">let </span>target_page = (target_func_address &amp; !(<span class="number">0xFFF</span>)) <span class="kw">as </span>usize;
<span class="kw">let </span>pc_page = (reloc_address - reloc_offset) &amp; !(<span class="number">0xFFF</span>);
<span class="kw">let </span><span class="kw-2">mut </span>reloc_delta = target_page.wrapping_sub(pc_page) <span class="kw">as </span>u64;
reloc_delta = reloc_delta
.wrapping_add((target_func_address &amp; <span class="number">0x800</span>) &lt;&lt; <span class="number">1</span>)
.wrapping_sub((target_func_address &amp; <span class="number">0x800</span>) &lt;&lt; <span class="number">21</span>);
reloc_delta = reloc_delta.wrapping_add((reloc_delta &amp; <span class="number">0x80000000</span>) &lt;&lt; <span class="number">1</span>);
(reloc_address, reloc_delta)
}
<span class="kw">_ </span>=&gt; <span class="macro">panic!</span>(<span class="string">"Relocation kind unsupported"</span>),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/wasmer_compiler_llvm/config.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
<span class="self">self</span>.opt_level,
<span class="self">self</span>.reloc_mode(),
<span class="kw">match </span>triple.architecture {
Architecture::Riscv64(<span class="kw">_</span>) =&gt; CodeModel::Medium,
Architecture::LoongArch64 | Architecture::Riscv64(<span class="kw">_</span>) =&gt; CodeModel::Medium,
<span class="kw">_ </span>=&gt; <span class="self">self</span>.code_model(),
},
)
Expand Down
Loading

0 comments on commit ba56157

Please sign in to comment.