[Ltrace-devel] [PATCH 2/2] Fix build for x86_64
Petr Machata
pmachata at redhat.com
Mon Dec 13 09:02:16 UTC 2010
10.12.2010 23:52, Zachary T Welch wrote:
> Some ELF-related variables differ depending on the native host, so
> this patch uses conditional compilation tricks to ensure everything
> works out on each host.
So how about sticking this to some .h:
#if __ELF_NATIVE_CLASS == 32
# define PRI_ELF_size PRIx32
#else
# define PRI_ELF_size PRIx64
#endif
... and then using that?
> @@ -252,7 +258,13 @@ hook_libdl_cb(void *data) {
>
> int
> linkmap_init(Process *proc, struct ltelf *lte) {
> - void *dbg_addr = NULL, *dyn_addr = (void *)(unsigned)lte->dyn_addr;
> + void *dbg_addr = NULL;
> + void *dyn_addr =
> +#if __ELF_NATIVE_CLASS == 32
> + (void *)(uint32_t)lte->dyn_addr;
> +#else
> + (void *)(uint64_t)lte->dyn_addr;
> +#endif
It's interesting that this one should be necessary. Isn't unsigned on
32-bit architecture exactly uint32_t and on 64-bit architecture
uint64_t? Or are there conditions where ELF_NATIVE_CLASS is different
that the architecture of the build?
PM
More information about the Ltrace-devel
mailing list