MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / elf_random_offset

Function elf_random_offset

components/lwp/lwp_elf.c:145–152  ·  view source on GitHub ↗

* @brief Generate a random offset for ELF loading. * * @return Random offset aligned to page size. */

Source from the content-addressed store, hash-verified

143 * @return Random offset aligned to page size.
144 */
145rt_ubase_t elf_random_offset(void)
146{
147#ifdef ELF_LOAD_RANDOMIZE
148 return (rt_tick_get() % 65535) * ARCH_PAGE_SIZE;
149#else
150 return ELF_PAGEALIGN(0);
151#endif
152}
153
154/**
155 * @brief Map a file into the process's address space.

Callers 2

load_elf_interpFunction · 0.85
elf_load_segmentFunction · 0.85

Calls 1

rt_tick_getFunction · 0.85

Tested by

no test coverage detected