summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/map_object.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-03-14 15:39:59 +0000
committerkib <kib@FreeBSD.org>2012-03-14 15:39:59 +0000
commit6232e80d5b9d3267fc60990bf37056e5e44468d5 (patch)
tree6cb1f7004b97ad903055090950327ef825b31f96 /libexec/rtld-elf/map_object.c
parent2d6797921217c9d1d60d7950f1c8f104eb18b7ae (diff)
downloadFreeBSD-src-6232e80d5b9d3267fc60990bf37056e5e44468d5.zip
FreeBSD-src-6232e80d5b9d3267fc60990bf37056e5e44468d5.tar.gz
Rtld on diet 3.
Stop using strerror(3) in rtld, which brings in msgcat and stdio. Directly access sys_errlist array of errno messages with private rtld_strerror() function. Now, $ size /libexec/ld-elf.so.1 text data bss dec hex filename 96983 2480 8744 108207 1a6af /libexec/ld-elf.so.1 Reviewed by: dim, kan MFC after: 2 weeks
Diffstat (limited to 'libexec/rtld-elf/map_object.c')
-rw-r--r--libexec/rtld-elf/map_object.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index f142819..9f4a499 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -184,7 +184,7 @@ map_object(int fd, const char *path, const struct stat *sb)
MAP_NOCORE, -1, 0);
if (mapbase == (caddr_t) -1) {
_rtld_error("%s: mmap of entire address space failed: %s",
- path, strerror(errno));
+ path, rtld_strerror(errno));
return NULL;
}
if (base_addr != NULL && mapbase != base_addr) {
@@ -204,7 +204,8 @@ map_object(int fd, const char *path, const struct stat *sb)
data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED;
if (mmap(data_addr, data_vlimit - data_vaddr, data_prot,
data_flags, fd, data_offset) == (caddr_t) -1) {
- _rtld_error("%s: mmap of data failed: %s", path, strerror(errno));
+ _rtld_error("%s: mmap of data failed: %s", path,
+ rtld_strerror(errno));
return NULL;
}
@@ -221,7 +222,7 @@ map_object(int fd, const char *path, const struct stat *sb)
if ((data_prot & PROT_WRITE) == 0 && -1 ==
mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) {
_rtld_error("%s: mprotect failed: %s", path,
- strerror(errno));
+ rtld_strerror(errno));
return NULL;
}
@@ -240,7 +241,7 @@ map_object(int fd, const char *path, const struct stat *sb)
if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot,
data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) {
_rtld_error("%s: mmap of bss failed: %s", path,
- strerror(errno));
+ rtld_strerror(errno));
return NULL;
}
}
@@ -307,7 +308,7 @@ get_elf_header (int fd, const char *path)
ssize_t nbytes;
if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) {
- _rtld_error("%s: read error: %s", path, strerror(errno));
+ _rtld_error("%s: read error: %s", path, rtld_strerror(errno));
return NULL;
}
OpenPOWER on IntegriCloud