diff options
-rw-r--r-- | ldso/include/dl-defs.h | 5 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 7 | ||||
-rw-r--r-- | ldso/ldso/mips/dl-sysdep.h | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index a8f6d6aae..eb59ca28b 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -164,4 +164,9 @@ typedef struct { ((*SIGNATURE DL_ADDR_TO_FUNC_PTR ((ADDR), (LOADADDR)))(__VA_ARGS__)) #endif +/* An alignment value for a memory block returned by _dl_malloc. */ +#ifndef DL_MALLOC_ALIGN +# define DL_MALLOC_ALIGN (__WORDSIZE / 8) +#endif + #endif /* _LD_DEFS_H */ diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index cf8ba5f9d..8c6a5f27f 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -950,10 +950,11 @@ void *_dl_malloc(int size) _dl_malloc_addr += size; /* - * Align memory to 4 byte boundary. Some platforms require this, - * others simply get better performance. + * Align memory to DL_MALLOC_ALIGN byte boundary. Some + * platforms require this, others simply get better + * performance. */ - _dl_malloc_addr = (unsigned char *) (((unsigned long) _dl_malloc_addr + 3) & ~(3)); + _dl_malloc_addr = (unsigned char *) (((unsigned long) _dl_malloc_addr + DL_MALLOC_ALIGN - 1) & ~(DL_MALLOC_ALIGN - 1)); return retval; } diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h index 19f6812a1..d6fc141bb 100644 --- a/ldso/ldso/mips/dl-sysdep.h +++ b/ldso/ldso/mips/dl-sysdep.h @@ -214,3 +214,7 @@ elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr, { /* No RELATIVE relocs in MIPS? */ } + +#ifdef __mips64 +#define DL_MALLOC_ALIGN 8 /* N64/N32 needs 8 byte alignment */ +#endif |