Author: arichardson Date: Mon Oct 29 21:08:19 2018 New Revision: 339878 URL: https://svnweb.freebsd.org/changeset/base/339878
Log: rtld-elf: compile with WANRS=4 warnings other than -Wcast-align Reviewed By: kib Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D17153 Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/aarch64/reloc.c head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/i386/rtld_machdep.h head/libexec/rtld-elf/libmap.c head/libexec/rtld-elf/malloc.c head/libexec/rtld-elf/map_object.c head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/mips/rtld_machdep.h head/libexec/rtld-elf/paths.h head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc/rtld_machdep.h head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/powerpc64/rtld_machdep.h head/libexec/rtld-elf/riscv/reloc.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/Makefile Mon Oct 29 21:08:19 2018 (r339878) @@ -31,7 +31,9 @@ LDFLAGS+= -nostdlib -e _rtld_start .else LDFLAGS+= -nostdlib -e .rtld_start .endif -WARNS?= 2 + +NO_WCAST_ALIGN= yes +WARNS?= 4 INSTALLFLAGS= -C -b PRECIOUSPROG= BINDIR= /libexec @@ -95,3 +97,8 @@ SUBDIR.${MK_TESTS}+= tests .include <bsd.prog.mk> ${PROG_FULL}: ${VERSION_MAP} .include <bsd.symver.mk> + +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300 +# Silence -Wshadow false positives in ancient GCC +CFLAGS+= -Wno-shadow +.endif Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/aarch64/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -84,7 +84,7 @@ do_copy_relocations(Obj_Entry *dstobj) */ assert(dstobj->mainprog); - relalim = (const Elf_Rela *)((char *)dstobj->rela + + relalim = (const Elf_Rela *)((const char *)dstobj->rela + dstobj->relasize); for (rela = dstobj->rela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) != R_AARCH64_COPY) @@ -128,6 +128,8 @@ struct tls_data { const Elf_Rela *rela; }; +int64_t rtld_tlsdesc_handle(struct tls_data *tlsdesc, int flags); + static struct tls_data * reloc_tlsdesc_alloc(Obj_Entry *obj, const Elf_Rela *rela) { @@ -205,7 +207,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rela *relalim; const Elf_Rela *rela; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; @@ -243,7 +245,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat const Elf_Sym *def; struct tls_data *tlsdesc; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target; @@ -289,7 +291,7 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS if (!obj->irelative) return (0); - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) == R_AARCH64_IRELATIVE) { ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); @@ -316,7 +318,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, if (!obj->gnu_ifunc) return (0); - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) == R_AARCH64_JUMP_SLOT) { where = (Elf_Addr *)(obj->relocbase + rela->r_offset); @@ -338,8 +340,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, } Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, + const Obj_Entry *defobj __unused, const Obj_Entry *obj __unused, + const Elf_Rel *rel) { assert(ELF_R_TYPE(rel->r_info) == R_AARCH64_JUMP_SLOT || @@ -386,7 +389,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int cache = calloc(obj->dynsymcount, sizeof(SymCache)); /* No need to check for NULL here */ - relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { /* * First, resolve symbol for relocations which @@ -471,7 +474,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error( "%s: No space available for static " "Thread Local Storage", obj->path); Modified: head/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- head/libexec/rtld-elf/amd64/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/amd64/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -67,7 +67,7 @@ do_copy_relocations(Obj_Entry *dstobj) assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ - relalim = (const Elf_Rela *) ((caddr_t) dstobj->rela + dstobj->relasize); + relalim = (const Elf_Rela *)((const char *) dstobj->rela + dstobj->relasize); for (rela = dstobj->rela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) == R_X86_64_COPY) { void *dstaddr; @@ -80,7 +80,7 @@ do_copy_relocations(Obj_Entry *dstobj) SymLook req; int res; - dstaddr = (void *) (dstobj->relocbase + rela->r_offset); + dstaddr = (void *)(dstobj->relocbase + rela->r_offset); dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info); name = dstobj->strtab + dstsym->st_name; size = dstsym->st_size; @@ -104,7 +104,7 @@ do_copy_relocations(Obj_Entry *dstobj) return -1; } - srcaddr = (const void *) (defobj->relocbase + srcsym->st_value); + srcaddr = (const void *)(defobj->relocbase + srcsym->st_value); memcpy(dstaddr, srcaddr, size); } } @@ -147,7 +147,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int } else cache = NULL; - relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); + relalim = (const Elf_Rela *)((const char*)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { /* * First, resolve symbol for relocations which @@ -254,7 +254,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * of space, we generate an error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " "for static Thread Local Storage", obj->path); @@ -274,7 +275,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * of space, we generate an error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " "for static Thread Local Storage", obj->path); @@ -322,7 +324,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rela *relalim; const Elf_Rela *rela; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; @@ -355,7 +357,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat if (obj->jmpslots_done) return 0; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target; const Elf_Sym *def; @@ -392,8 +394,9 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat /* Fixup the jump slot at "where" to transfer control to "target". */ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, - const struct Struct_Obj_Entry *obj, const struct Struct_Obj_Entry *refobj, - const Elf_Rel *rel) + const struct Struct_Obj_Entry *obj __unused, + const struct Struct_Obj_Entry *refobj __unused, + const Elf_Rel *rel __unused) { #ifdef dbg dbg("reloc_jmpslot: *%p = %p", where, (void *)target); @@ -411,7 +414,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstat if (!obj->irelative) return (0); - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target, *ptr; @@ -441,7 +444,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockSta if (!obj->gnu_ifunc) return (0); - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target; const Elf_Sym *def; Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/arm/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -75,7 +75,7 @@ do_copy_relocations(Obj_Entry *dstobj) assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ - rellim = (const Elf_Rel *) ((caddr_t) dstobj->rel + dstobj->relsize); + rellim = (const Elf_Rel *)((const char *) dstobj->rel + dstobj->relsize); for (rel = dstobj->rel; rel < rellim; rel++) { if (ELF_R_TYPE(rel->r_info) == R_ARM_COPY) { void *dstaddr; @@ -88,7 +88,7 @@ do_copy_relocations(Obj_Entry *dstobj) SymLook req; int res; - dstaddr = (void *) (dstobj->relocbase + rel->r_offset); + dstaddr = (void *)(dstobj->relocbase + rel->r_offset); dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info); name = dstobj->strtab + dstsym->st_name; size = dstsym->st_size; @@ -125,8 +125,6 @@ do_copy_relocations(Obj_Entry *dstobj) void _rtld_bind_start(void); void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr); -int open(); -int _open(); void _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr relocbase) { @@ -145,7 +143,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr rel break; } } - rellim = (const Elf_Rel *)((caddr_t)rel + relsz); + rellim = (const Elf_Rel *)((const char *)rel + relsz); size = (rellim - 1)->r_offset - rel->r_offset; for (; rel < rellim; rel++) { where = (Elf_Addr *)(relocbase + rel->r_offset); @@ -375,7 +373,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int cache = calloc(obj->dynsymcount, sizeof(SymCache)); /* No need to check for NULL here */ - rellim = (const Elf_Rel *)((caddr_t)obj->rel + obj->relsize); + rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); for (rel = obj->rel; rel < rellim; rel++) { if (reloc_nonplt_object(obj, rel, cache, flags, lockstate) < 0) goto done; @@ -396,7 +394,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rel *rellim; const Elf_Rel *rel; - rellim = (const Elf_Rel *)((char *)obj->pltrel + + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where; @@ -423,7 +421,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat Elf_Addr *where; Elf_Addr target; - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { assert(ELF_R_TYPE(rel->r_info) == R_ARM_JUMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rel->r_offset); @@ -445,7 +443,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat } int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +reloc_iresolve(Obj_Entry *obj __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -453,8 +452,8 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS } int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) +reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -462,8 +461,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, } Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, + const Obj_Entry *defobj __unused, const Obj_Entry *obj __unused, + const Elf_Rel *rel) { assert(ELF_R_TYPE(rel->r_info) == R_ARM_JUMP_SLOT); Modified: head/libexec/rtld-elf/i386/reloc.c ============================================================================== --- head/libexec/rtld-elf/i386/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/i386/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -67,7 +67,7 @@ do_copy_relocations(Obj_Entry *dstobj) assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ - rellim = (const Elf_Rel *) ((caddr_t) dstobj->rel + dstobj->relsize); + rellim = (const Elf_Rel *)((const char *)dstobj->rel + dstobj->relsize); for (rel = dstobj->rel; rel < rellim; rel++) { if (ELF_R_TYPE(rel->r_info) == R_386_COPY) { void *dstaddr; @@ -80,7 +80,7 @@ do_copy_relocations(Obj_Entry *dstobj) SymLook req; int res; - dstaddr = (void *) (dstobj->relocbase + rel->r_offset); + dstaddr = (void *)(dstobj->relocbase + rel->r_offset); dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info); name = dstobj->strtab + dstsym->st_name; size = dstsym->st_size; @@ -104,7 +104,7 @@ do_copy_relocations(Obj_Entry *dstobj) return -1; } - srcaddr = (const void *) (defobj->relocbase + srcsym->st_value); + srcaddr = (const void *)(defobj->relocbase + srcsym->st_value); memcpy(dstaddr, srcaddr, size); } } @@ -146,7 +146,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int } else cache = NULL; - rellim = (const Elf_Rel *)((caddr_t) obj->rel + obj->relsize); + rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); for (rel = obj->rel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { case R_386_32: @@ -239,7 +239,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * of space, we generate an error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " "for static Thread Local Storage", obj->path); @@ -278,7 +279,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rel *rellim; const Elf_Rel *rel; - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where/*, val*/; @@ -311,7 +312,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat if (obj->jmpslots_done) return 0; - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where, target; const Elf_Sym *def; @@ -349,8 +350,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat /* Fixup the jump slot at "where" to transfer control to "target". */ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, - const struct Struct_Obj_Entry *obj, const struct Struct_Obj_Entry *refobj, - const Elf_Rel *rel) + const Obj_Entry *obj __unused, const Obj_Entry *refobj __unused, + const Elf_Rel *rel __unused) { #ifdef dbg dbg("reloc_jmpslot: *%p = %p", where, (void *)target); @@ -369,7 +370,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstat if (!obj->irelative) return (0); - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { case R_386_IRELATIVE: @@ -393,7 +394,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockSta if (!obj->gnu_ifunc) return (0); - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where, target; const Elf_Sym *def; Modified: head/libexec/rtld-elf/i386/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/i386/rtld_machdep.h Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/i386/rtld_machdep.h Mon Oct 29 21:08:19 2018 (r339878) @@ -58,7 +58,7 @@ extern uint32_t cpu_feature2; extern uint32_t cpu_stdext_feature; extern uint32_t cpu_stdext_feature2; #define call_ifunc_resolver(ptr) \ - (((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t))ptr)( \ + (((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t))(ptr))( \ cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2)) #define round(size, align) \ Modified: head/libexec/rtld-elf/libmap.c ============================================================================== --- head/libexec/rtld-elf/libmap.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/libmap.c Mon Oct 29 21:08:19 2018 (r339878) @@ -44,8 +44,8 @@ struct lmc { static int lm_count; static void lmc_parse(char *, size_t); -static void lmc_parse_file(char *); -static void lmc_parse_dir(char *); +static void lmc_parse_file(const char *); +static void lmc_parse_dir(const char *); static void lm_add(const char *, const char *, const char *); static void lm_free(struct lm_list *); static char *lml_find(struct lm_list *, const char *); @@ -96,7 +96,7 @@ lm_init(char *libmap_override) } static void -lmc_parse_file(char *path) +lmc_parse_file(const char *path) { struct lmc *p; char *lm_map; @@ -149,7 +149,7 @@ lmc_parse_file(char *path) } static void -lmc_parse_dir(char *idir) +lmc_parse_dir(const char *idir) { DIR *d; struct dirent *dp; Modified: head/libexec/rtld-elf/malloc.c ============================================================================== --- head/libexec/rtld-elf/malloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/malloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -154,13 +154,12 @@ botch(s) extern size_t *pagesizes; void * -malloc(nbytes) - size_t nbytes; +malloc(size_t nbytes) { union overhead *op; int bucket; - size_t n; - unsigned amt; + ssize_t n; + size_t amt; /* * First time malloc is called, setup page size and Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/map_object.c Mon Oct 29 21:08:19 2018 (r339878) @@ -104,7 +104,7 @@ map_object(int fd, const char *path, const struct stat * * We expect that the loadable segments are ordered by load address. */ - phdr = (Elf_Phdr *) ((char *)hdr + hdr->e_phoff); + phdr = (Elf_Phdr *)((char *)hdr + hdr->e_phoff); phsize = hdr->e_phnum * sizeof (phdr[0]); phlimit = phdr + hdr->e_phnum; nsegs = -1; @@ -289,11 +289,11 @@ map_object(int fd, const char *path, const struct stat obj->textsize = text_end - base_vaddr; obj->vaddrbase = base_vaddr; obj->relocbase = mapbase - base_vaddr; - obj->dynamic = (const Elf_Dyn *) (obj->relocbase + phdyn->p_vaddr); + obj->dynamic = (const Elf_Dyn *)(obj->relocbase + phdyn->p_vaddr); if (hdr->e_entry != 0) - obj->entry = (caddr_t) (obj->relocbase + hdr->e_entry); + obj->entry = (caddr_t)(obj->relocbase + hdr->e_entry); if (phdr_vaddr != 0) { - obj->phdr = (const Elf_Phdr *) (obj->relocbase + phdr_vaddr); + obj->phdr = (const Elf_Phdr *)(obj->relocbase + phdr_vaddr); } else { obj->phdr = malloc(phsize); if (obj->phdr == NULL) { @@ -301,12 +301,12 @@ map_object(int fd, const char *path, const struct stat _rtld_error("%s: cannot allocate program header", path); goto error1; } - memcpy((char *)obj->phdr, (char *)hdr + hdr->e_phoff, phsize); + memcpy(__DECONST(char *, obj->phdr), (char *)hdr + hdr->e_phoff, phsize); obj->phdr_alloc = true; } obj->phsize = phsize; if (phinterp != NULL) - obj->interp = (const char *) (obj->relocbase + phinterp->p_vaddr); + obj->interp = (const char *)(obj->relocbase + phinterp->p_vaddr); if (phtls != NULL) { tls_dtv_generation++; obj->tlsindex = ++tls_max_index; @@ -430,13 +430,13 @@ obj_free(Obj_Entry *obj) if (obj->origin_path) free(obj->origin_path); if (obj->z_origin) - free(obj->rpath); + free(__DECONST(void*, obj->rpath)); if (obj->priv) free(obj->priv); if (obj->path) free(obj->path); if (obj->phdr_alloc) - free((void *)obj->phdr); + free(__DECONST(void *, obj->phdr)); free(obj); } Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/mips/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -126,7 +126,7 @@ do_copy_relocations(Obj_Entry *dstobj) */ assert(dstobj->mainprog); - rellim = (const Elf_Rel *)((caddr_t)dstobj->rel + dstobj->relsize); + rellim = (const Elf_Rel *)((const char *)dstobj->rel + dstobj->relsize); for (rel = dstobj->rel; rel < rellim; rel++) { if (ELF_R_TYPE(rel->r_info) != R_MIPS_COPY) continue; @@ -265,7 +265,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr rel ++got; } - rellim = (const Elf_Rel *)((caddr_t)rel + relsz); + rellim = (const Elf_Rel *)((const char *)rel + relsz); for (; rel < rellim; rel++) { Elf_Word r_symndx, r_type; @@ -469,7 +469,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int } got = obj->pltgot; - rellim = (const Elf_Rel *)((caddr_t)obj->rel + obj->relsize); + rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); for (rel = obj->rel; rel < rellim; rel++) { Elf_Word r_symndx, r_type; void *where; @@ -657,7 +657,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rel *rellim; const Elf_Rel *rel; - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where; @@ -687,7 +687,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat const Elf_Rel *rel; const Elf_Sym *def; - rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where; @@ -714,7 +714,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat } int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +reloc_iresolve(Obj_Entry *obj __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -722,8 +723,8 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS } int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) +reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -731,8 +732,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, } Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, + const Obj_Entry *defobj __unused, const Obj_Entry *obj __unused, + const Elf_Rel *rel) { assert(ELF_R_TYPE(rel->r_info) == R_MIPS_JUMP_SLOT); Modified: head/libexec/rtld-elf/mips/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/mips/rtld_machdep.h Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/mips/rtld_machdep.h Mon Oct 29 21:08:19 2018 (r339878) @@ -43,6 +43,9 @@ struct Struct_Obj_Entry; Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj, const Elf_Rel *rel); +Elf_Addr _mips_rtld_bind(struct Struct_Obj_Entry *obj, Elf_Size reloff); +void *_mips_get_tls(void); + #define make_function_pointer(def, defobj) \ ((defobj)->relocbase + (def)->st_value) Modified: head/libexec/rtld-elf/paths.h ============================================================================== --- head/libexec/rtld-elf/paths.h Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/paths.h Mon Oct 29 21:08:19 2018 (r339878) @@ -69,10 +69,10 @@ #define SOFT_STANDARD_LIBRARY_PATH "/usr/libsoft" #define LD_SOFT_ "LD_SOFT_" -extern char *ld_elf_hints_default; -extern char *ld_path_libmap_conf; -extern char *ld_path_rtld; -extern char *ld_standard_library_path; -extern char *ld_env_prefix; +extern const char *ld_elf_hints_default; +extern const char *ld_path_libmap_conf; +extern const char *ld_path_rtld; +extern const char *ld_standard_library_path; +extern const char *ld_env_prefix; #endif /* PATHS_H */ Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/powerpc/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -71,7 +71,7 @@ do_copy_relocations(Obj_Entry *dstobj) */ assert(dstobj->mainprog); - relalim = (const Elf_Rela *) ((caddr_t) dstobj->rela + + relalim = (const Elf_Rela *)((const char *) dstobj->rela + dstobj->relasize); for (rela = dstobj->rela; rela < relalim; rela++) { void *dstaddr; @@ -88,7 +88,7 @@ do_copy_relocations(Obj_Entry *dstobj) continue; } - dstaddr = (void *) (dstobj->relocbase + rela->r_offset); + dstaddr = (void *)(dstobj->relocbase + rela->r_offset); dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info); name = dstobj->strtab + dstsym->st_name; size = dstsym->st_size; @@ -113,7 +113,7 @@ do_copy_relocations(Obj_Entry *dstobj) return (-1); } - srcaddr = (const void *) (defobj->relocbase+srcsym->st_value); + srcaddr = (const void *)(defobj->relocbase+srcsym->st_value); memcpy(dstaddr, srcaddr, size); dbg("copy_reloc: src=%p,dst=%p,size=%d\n",srcaddr,dstaddr,size); } @@ -149,7 +149,7 @@ reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase) /* * Relocate these values */ - relalim = (const Elf_Rela *)((caddr_t)rela + relasz); + relalim = (const Elf_Rela *)((const char *)rela + relasz); for (; rela < relalim; rela++) { where = (Elf_Addr *)(relocbase + rela->r_offset); *where = (Elf_Addr)(relocbase + rela->r_addend); @@ -161,8 +161,8 @@ reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase) * Relocate a non-PLT object with addend. */ static int -reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *obj, const Elf_Rela *rela, - SymCache *cache, int flags, RtldLockState *lockstate) +reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, + const Elf_Rela *rela, SymCache *cache, int flags, RtldLockState *lockstate) { Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset); const Elf_Sym *def; @@ -249,7 +249,8 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *ob * error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available for static " "Thread Local Storage", obj->path); return (-1); @@ -315,7 +316,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * "The PowerPC family uses only the Elf32_Rela relocation * entries with explicit addends." */ - relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { if (reloc_nonplt_object(obj_rtld, obj, rela, cache, flags, lockstate) < 0) @@ -398,7 +399,7 @@ reloc_plt(Obj_Entry *obj) if (obj->pltrelasize != 0) { - relalim = (const Elf_Rela *)((char *)obj->pltrela + + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); @@ -433,7 +434,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat Elf_Addr *where; Elf_Addr target; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); @@ -469,8 +471,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat * trampoline call and jump table. */ Elf_Addr -reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) +reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, + const Obj_Entry *defobj __unused, const Obj_Entry *obj, const Elf_Rel *rel) { Elf_Addr offset; const Elf_Rela *rela = (const Elf_Rela *) rel; @@ -529,7 +531,8 @@ out: } int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +reloc_iresolve(Obj_Entry *obj __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -537,8 +540,8 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS } int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) +reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -650,7 +653,7 @@ allocate_initial_tls(Obj_Entry *list) tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; - tp = (Elf_Addr **) ((char *) allocate_tls(list, NULL, TLS_TCB_SIZE, 8) + tp = (Elf_Addr **)((char *) allocate_tls(list, NULL, TLS_TCB_SIZE, 8) + TLS_TP_OFFSET + TLS_TCB_SIZE); /* Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Mon Oct 29 21:08:19 2018 (r339878) @@ -42,6 +42,7 @@ struct Struct_Obj_Entry; Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj, const Elf_Rel *rel); +void reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase); #define make_function_pointer(def, defobj) \ ((defobj)->relocbase + (def)->st_value) Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/powerpc64/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -67,7 +67,7 @@ do_copy_relocations(Obj_Entry *dstobj) */ assert(dstobj->mainprog); - relalim = (const Elf_Rela *) ((caddr_t) dstobj->rela + + relalim = (const Elf_Rela *)((const char *) dstobj->rela + dstobj->relasize); for (rela = dstobj->rela; rela < relalim; rela++) { void *dstaddr; @@ -84,7 +84,7 @@ do_copy_relocations(Obj_Entry *dstobj) continue; } - dstaddr = (void *) (dstobj->relocbase + rela->r_offset); + dstaddr = (void *)(dstobj->relocbase + rela->r_offset); dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info); name = dstobj->strtab + dstsym->st_name; size = dstsym->st_size; @@ -109,7 +109,7 @@ do_copy_relocations(Obj_Entry *dstobj) return (-1); } - srcaddr = (const void *) (defobj->relocbase+srcsym->st_value); + srcaddr = (const void *)(defobj->relocbase+srcsym->st_value); memcpy(dstaddr, srcaddr, size); dbg("copy_reloc: src=%p,dst=%p,size=%zd\n",srcaddr,dstaddr,size); } @@ -145,7 +145,7 @@ reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase) /* * Relocate these values */ - relalim = (const Elf_Rela *)((caddr_t)rela + relasz); + relalim = (const Elf_Rela *)((const char *)rela + relasz); for (; rela < relalim; rela++) { where = (Elf_Addr *)(relocbase + rela->r_offset); *where = (Elf_Addr)(relocbase + rela->r_addend); @@ -157,8 +157,8 @@ reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase) * Relocate a non-PLT object with addend. */ static int -reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *obj, const Elf_Rela *rela, - SymCache *cache, int flags, RtldLockState *lockstate) +reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, + const Elf_Rela *rela, SymCache *cache, int flags, RtldLockState *lockstate) { Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset); const Elf_Sym *def; @@ -246,7 +246,8 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *ob * error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available for static " "Thread Local Storage", obj->path); return (-1); @@ -315,7 +316,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * "The PowerPC family uses only the Elf32_Rela relocation * entries with explicit addends." */ - relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { if (reloc_nonplt_object(obj_rtld, obj, rela, cache, flags, lockstate) < 0) @@ -370,7 +371,7 @@ reloc_plt(Obj_Entry *obj) const Elf_Rela *rela; if (obj->pltrelasize != 0) { - relalim = (const Elf_Rela *)((char *)obj->pltrela + + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); @@ -398,7 +399,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat Elf_Addr *where; Elf_Addr target; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); @@ -435,7 +437,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat */ Elf_Addr reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) + const Obj_Entry *obj __unused, const Elf_Rel *rel __unused) { /* @@ -494,7 +496,8 @@ out: } int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +reloc_iresolve(Obj_Entry *obj __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -502,8 +505,8 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS } int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) +reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -555,7 +558,7 @@ allocate_initial_tls(Obj_Entry *list) tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; - tp = (Elf_Addr **) ((char *)allocate_tls(list, NULL, TLS_TCB_SIZE, 16) + tp = (Elf_Addr **)((char *)allocate_tls(list, NULL, TLS_TCB_SIZE, 16) + TLS_TP_OFFSET + TLS_TCB_SIZE); __asm __volatile("mr 13,%0" :: "r"(tp)); Modified: head/libexec/rtld-elf/powerpc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_machdep.h Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/powerpc64/rtld_machdep.h Mon Oct 29 21:08:19 2018 (r339878) @@ -42,6 +42,7 @@ struct Struct_Obj_Entry; Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj, const Elf_Rel *rel); +void reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocbase); #define make_function_pointer(def, defobj) \ ((defobj)->relocbase + (def)->st_value) Modified: head/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- head/libexec/rtld-elf/riscv/reloc.c Mon Oct 29 21:08:11 2018 (r339877) +++ head/libexec/rtld-elf/riscv/reloc.c Mon Oct 29 21:08:19 2018 (r339878) @@ -105,7 +105,7 @@ do_copy_relocations(Obj_Entry *dstobj) */ assert(dstobj->mainprog); - relalim = (const Elf_Rela *)((char *)dstobj->rela + + relalim = (const Elf_Rela *)((const char *)dstobj->rela + dstobj->relasize); for (rela = dstobj->rela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) != R_RISCV_COPY) @@ -152,7 +152,8 @@ reloc_plt(Obj_Entry *obj) const Elf_Rela *relalim; const Elf_Rela *rela; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; @@ -176,7 +177,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat const Elf_Rela *rela; const Elf_Sym *def; - relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; @@ -203,7 +205,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat } int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +reloc_iresolve(Obj_Entry *obj __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -211,8 +214,8 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS } int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) +reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, + struct Struct_RtldLockState *lockstate __unused) { /* XXX not implemented */ @@ -220,8 +223,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, } Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, - const Obj_Entry *obj, const Elf_Rel *rel) +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, + const Obj_Entry *defobj __unused, const Obj_Entry *obj __unused, + const Elf_Rel *rel) { assert(ELF_R_TYPE(rel->r_info) == R_RISCV_JUMP_SLOT); @@ -260,7 +264,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int cache = calloc(obj->dynsymcount, sizeof(SymCache)); /* No need to check for NULL here */ - relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { where = (Elf_Addr *)(obj->relocbase + rela->r_offset); symnum = ELF_R_SYM(rela->r_info); @@ -315,7 +319,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { _rtld_error( "%s: No space available for static " "Thread Local Storage", obj->path); @@ -341,7 +346,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int * error. */ if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { + if (!allocate_tls_offset( + __DECONST(Obj_Entry *, defobj))) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"