<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rt-thread.git/components/libc/posix/libdl/dlmodule.h, branch copilot/create-dfs2-documentation</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/rt-thread.git/atom/components/libc/posix/libdl/dlmodule.h?h=copilot%2Fcreate-dfs2-documentation</id>
<link rel='self' href='http://cgit.235523.xyz/rt-thread.git/atom/components/libc/posix/libdl/dlmodule.h?h=copilot%2Fcreate-dfs2-documentation'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/'/>
<updated>2025-02-22T19:16:00Z</updated>
<entry>
<title>components: libc: fix pointer-to-integer cast warnings and address truncation</title>
<updated>2025-02-22T19:16:00Z</updated>
<author>
<name>kenneth.liu</name>
<email>kenneth.liu@sophgo.com</email>
</author>
<published>2025-02-22T05:20:11Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=4940bb10515316791f1940a59bfeaeebee35ec87'/>
<id>urn:sha1:4940bb10515316791f1940a59bfeaeebee35ec87</id>
<content type='text'>
[Problem Description]
1. When enabling RT_USING_MODULE=y, compilation warnings occur:
   dlelf.c:386:27: warning: cast from pointer to integer of different size
   dlelf.c:398:25: warning: cast from pointer to integer of different size
   dlelf.c:408:24: warning: cast from pointer to integer of different size

2. On RV64 architectures (e.g. Sophgo SG2042 with RISC-V Sv39 and 40-bit physical addressing),
   dlsym may fail when accessing addresses beyond 32-bit range.

[Root Cause]
In dlmodule_load_relocated_object() and dlmodule_symbol_find(),
pointer is cast to rt_uint32_t which truncates:
| rt_ubase_t rodata_addr = (rt_uint32_t)ptr;
This causes:
- Warnings on 64-bit systems (pointer width &gt; 32-bit)
- Actual address truncation on RV64 when physical address exceeds 32-bit

[Solution]
Replace rt_uint32_t with architecture-adaptive rt_ubase_t:
| rt_ubase_t rodata_addr = (rt_ubase_t)ptr;
The rt_ubase_t is defined in include/rttypes.h as:
| #ifdef ARCH_CPU_64BIT
|   typedef rt_uint64_t rt_ubase_t;
| #else
|   typedef rt_uint32_t rt_ubase_t;
| #endif
This ensures correct width casting for both 32/64-bit architectures.

Signed-off-by: Liu Gui &lt;kenneth.liu@sophgo.com&gt;
</content>
</entry>
<entry>
<title>[libc] add comments for libdl APIs.</title>
<updated>2024-11-12T23:58:34Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-12T07:38:28Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=f0934630c46a3111cf06ab2777e368fc04050292'/>
<id>urn:sha1:f0934630c46a3111cf06ab2777e368fc04050292</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[libdl] move libdl to posix folder (#5523)</title>
<updated>2022-01-20T12:55:31Z</updated>
<author>
<name>Man, Jianting (Meco)</name>
<email>920369182@qq.com</email>
</author>
<published>2022-01-20T12:55:31Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=c89735a357dda9f3249a90346e033b64e5a1a499'/>
<id>urn:sha1:c89735a357dda9f3249a90346e033b64e5a1a499</id>
<content type='text'>
</content>
</entry>
</feed>
