Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa revert bad whitespace change.
details: https://anonhg.NetBSD.org/src/rev/49ceda9cfb66
branches: trunk
changeset: 762238:49ceda9cfb66
user: christos <christos%NetBSD.org@localhost>
date: Thu Feb 17 21:15:31 2011 +0000
description:
revert bad whitespace change.
diffstat:
sys/lib/libsa/loadfile_elf32.c | 436 ++++++++++++++++++++--------------------
1 files changed, 218 insertions(+), 218 deletions(-)
diffs (truncated from 481 to 300 lines):
diff -r 2c7cb36c9477 -r 49ceda9cfb66 sys/lib/libsa/loadfile_elf32.c
--- a/sys/lib/libsa/loadfile_elf32.c Thu Feb 17 21:06:26 2011 +0000
+++ b/sys/lib/libsa/loadfile_elf32.c Thu Feb 17 21:15:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.28 2011/02/17 19:38:48 christos Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.29 2011/02/17 21:15:31 christos Exp $ */
/*-
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -265,254 +265,254 @@
int first;
Elf_Addr shpp;
Elf_Addr minp = ~0, maxp = 0, pos = 0, elfp = 0;
- u_long offset = marks[MARK_START];
- ssize_t nr;
- struct __packed {
- Elf_Nhdr nh;
- uint8_t name[ELF_NOTE_NETBSD_NAMESZ + 1];
- uint8_t desc[ELF_NOTE_NETBSD_DESCSZ];
- } note;
- char *shstr = NULL;
- int boot_load_ctf=1;
+ u_long offset = marks[MARK_START];
+ ssize_t nr;
+ struct __packed {
+ Elf_Nhdr nh;
+ uint8_t name[ELF_NOTE_NETBSD_NAMESZ + 1];
+ uint8_t desc[ELF_NOTE_NETBSD_DESCSZ];
+ } note;
+ char *shstr = NULL;
+ int boot_load_ctf = 1;
- /* some ports dont use the offset */
- (void)&offset;
+ /* some ports dont use the offset */
+ (void)&offset;
- internalize_ehdr(elf->e_ident[EI_DATA], elf);
+ internalize_ehdr(elf->e_ident[EI_DATA], elf);
- sz = elf->e_phnum * sizeof(Elf_Phdr);
- phdr = ALLOC(sz);
+ sz = elf->e_phnum * sizeof(Elf_Phdr);
+ phdr = ALLOC(sz);
- if (lseek(fd, elf->e_phoff, SEEK_SET) == -1) {
- WARN(("lseek phdr"));
- goto freephdr;
- }
- nr = read(fd, phdr, sz);
- if (nr == -1) {
- WARN(("read program headers"));
- goto freephdr;
- }
- if (nr != sz) {
- errno = EIO;
- WARN(("read program headers"));
- goto freephdr;
- }
+ if (lseek(fd, elf->e_phoff, SEEK_SET) == -1) {
+ WARN(("lseek phdr"));
+ goto freephdr;
+ }
+ nr = read(fd, phdr, sz);
+ if (nr == -1) {
+ WARN(("read program headers"));
+ goto freephdr;
+ }
+ if (nr != sz) {
+ errno = EIO;
+ WARN(("read program headers"));
+ goto freephdr;
+ }
- for (first = 1, i = 0; i < elf->e_phnum; i++) {
- internalize_phdr(elf->e_ident[EI_DATA], &phdr[i]);
+ for (first = 1, i = 0; i < elf->e_phnum; i++) {
+ internalize_phdr(elf->e_ident[EI_DATA], &phdr[i]);
#ifndef MD_LOADSEG /* Allow processor ABI specific segment loads */
#define MD_LOADSEG(a) /*CONSTCOND*/0
#endif
- if (MD_LOADSEG(&phdr[i]))
- goto loadseg;
+ if (MD_LOADSEG(&phdr[i]))
+ goto loadseg;
- if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_X)) == 0)
- continue;
+ if (phdr[i].p_type != PT_LOAD ||
+ (phdr[i].p_flags & (PF_W|PF_X)) == 0)
+ continue;
#define IS_TEXT(p) (p.p_flags & PF_X)
#define IS_DATA(p) (p.p_flags & PF_W)
#define IS_BSS(p) (p.p_filesz < p.p_memsz)
- /*
- * XXX: Assume first address is lowest
- */
- if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
- (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
+ /*
+ * XXX: Assume first address is lowest
+ */
+ if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
+ (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
- loadseg:
- if (marks[MARK_DATA] == 0 && IS_DATA(phdr[i]))
- marks[MARK_DATA] = LOADADDR(phdr[i].p_vaddr);
+ loadseg:
+ if (marks[MARK_DATA] == 0 && IS_DATA(phdr[i]))
+ marks[MARK_DATA] = LOADADDR(phdr[i].p_vaddr);
- /* Read in segment. */
- PROGRESS(("%s%lu", first ? "" : "+",
- (u_long)phdr[i].p_filesz));
+ /* Read in segment. */
+ PROGRESS(("%s%lu", first ? "" : "+",
+ (u_long)phdr[i].p_filesz));
- if (lseek(fd, phdr[i].p_offset, SEEK_SET) == -1) {
- WARN(("lseek text"));
- goto freephdr;
- }
- nr = READ(fd, phdr[i].p_vaddr, phdr[i].p_filesz);
- if (nr == -1) {
- WARN(("read text error"));
- goto freephdr;
- }
- if (nr != (ssize_t)phdr[i].p_filesz) {
- errno = EIO;
- WARN(("read text"));
- goto freephdr;
- }
- first = 0;
+ if (lseek(fd, phdr[i].p_offset, SEEK_SET) == -1) {
+ WARN(("lseek text"));
+ goto freephdr;
+ }
+ nr = READ(fd, phdr[i].p_vaddr, phdr[i].p_filesz);
+ if (nr == -1) {
+ WARN(("read text error"));
+ goto freephdr;
+ }
+ if (nr != (ssize_t)phdr[i].p_filesz) {
+ errno = EIO;
+ WARN(("read text"));
+ goto freephdr;
+ }
+ first = 0;
- }
- if ((IS_TEXT(phdr[i]) && (flags & (LOAD_TEXT|COUNT_TEXT))) ||
- (IS_DATA(phdr[i]) && (flags & (LOAD_DATA|COUNT_TEXT)))) {
- pos = phdr[i].p_vaddr;
- if (minp > pos)
- minp = pos;
- pos += phdr[i].p_filesz;
- if (maxp < pos)
- maxp = pos;
- }
+ }
+ if ((IS_TEXT(phdr[i]) && (flags & (LOAD_TEXT|COUNT_TEXT))) ||
+ (IS_DATA(phdr[i]) && (flags & (LOAD_DATA|COUNT_TEXT)))) {
+ pos = phdr[i].p_vaddr;
+ if (minp > pos)
+ minp = pos;
+ pos += phdr[i].p_filesz;
+ if (maxp < pos)
+ maxp = pos;
+ }
- /* Zero out bss. */
- if (IS_BSS(phdr[i]) && (flags & LOAD_BSS)) {
- PROGRESS(("+%lu",
- (u_long)(phdr[i].p_memsz - phdr[i].p_filesz)));
- BZERO((phdr[i].p_vaddr + phdr[i].p_filesz),
- phdr[i].p_memsz - phdr[i].p_filesz);
- }
- if (IS_BSS(phdr[i]) && (flags & (LOAD_BSS|COUNT_BSS))) {
- pos += phdr[i].p_memsz - phdr[i].p_filesz;
- if (maxp < pos)
- maxp = pos;
- }
- }
- DEALLOC(phdr, sz);
+ /* Zero out bss. */
+ if (IS_BSS(phdr[i]) && (flags & LOAD_BSS)) {
+ PROGRESS(("+%lu",
+ (u_long)(phdr[i].p_memsz - phdr[i].p_filesz)));
+ BZERO((phdr[i].p_vaddr + phdr[i].p_filesz),
+ phdr[i].p_memsz - phdr[i].p_filesz);
+ }
+ if (IS_BSS(phdr[i]) && (flags & (LOAD_BSS|COUNT_BSS))) {
+ pos += phdr[i].p_memsz - phdr[i].p_filesz;
+ if (maxp < pos)
+ maxp = pos;
+ }
+ }
+ DEALLOC(phdr, sz);
- /*
- * Copy the ELF and section headers.
- */
- maxp = roundup(maxp, ELFROUND);
- if (flags & (LOAD_HDR|COUNT_HDR)) {
- elfp = maxp;
- maxp += sizeof(Elf_Ehdr);
- }
+ /*
+ * Copy the ELF and section headers.
+ */
+ maxp = roundup(maxp, ELFROUND);
+ if (flags & (LOAD_HDR|COUNT_HDR)) {
+ elfp = maxp;
+ maxp += sizeof(Elf_Ehdr);
+ }
- if (flags & (LOAD_SYM|COUNT_SYM)) {
- if (lseek(fd, elf->e_shoff, SEEK_SET) == -1) {
- WARN(("lseek section headers"));
- return 1;
- }
- sz = elf->e_shnum * sizeof(Elf_Shdr);
+ if (flags & (LOAD_SYM|COUNT_SYM)) {
+ if (lseek(fd, elf->e_shoff, SEEK_SET) == -1) {
+ WARN(("lseek section headers"));
+ return 1;
+ }
+ sz = elf->e_shnum * sizeof(Elf_Shdr);
- shp = ALLOC(sz);
+ shp = ALLOC(sz);
- nr = read(fd, shp, sz);
- if (nr == -1) {
- WARN(("read section headers"));
- goto freeshp;
- }
- if (nr != sz) {
- errno = EIO;
- WARN(("read section headers"));
- goto freeshp;
- }
+ nr = read(fd, shp, sz);
+ if (nr == -1) {
+ WARN(("read section headers"));
+ goto freeshp;
+ }
+ if (nr != sz) {
+ errno = EIO;
+ WARN(("read section headers"));
+ goto freeshp;
+ }
- shpp = maxp;
- maxp += roundup(sz, ELFROUND);
+ shpp = maxp;
+ maxp += roundup(sz, ELFROUND);
#ifndef _STANDALONE
- /* Internalize the section headers. */
- for (i = 0; i < elf->e_shnum; i++)
- internalize_shdr(elf->e_ident[EI_DATA], &shp[i]);
+ /* Internalize the section headers. */
+ for (i = 0; i < elf->e_shnum; i++)
+ internalize_shdr(elf->e_ident[EI_DATA], &shp[i]);
#endif /* ! _STANDALONE */
- /*
- * First load the section names section.
- */
- if (boot_load_ctf && (elf->e_shstrndx != 0)) {
- if (flags & LOAD_SYM) {
- if (lseek(fd, shp[elf->e_shstrndx].sh_offset,
- SEEK_SET) == -1) {
- WARN(("lseek symbols"));
- goto freeshp;
- }
- nr = READ(fd, maxp,
- shp[elf->e_shstrndx].sh_size);
- if (nr == -1) {
- WARN(("read symbols"));
- goto freeshp;
- }
- if (nr !=
- (ssize_t)shp[elf->e_shstrndx].sh_size) {
- errno = EIO;
- WARN(("read symbols"));
- goto freeshp;
- }
+ /*
+ * First load the section names section.
+ */
+ if (boot_load_ctf && (elf->e_shstrndx != 0)) {
+ if (flags & LOAD_SYM) {
+ if (lseek(fd, shp[elf->e_shstrndx].sh_offset,
+ SEEK_SET) == -1) {
Home |
Main Index |
Thread Index |
Old Index