Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa - a.out header is not a part of text segment i...



details:   https://anonhg.NetBSD.org/src/rev/297f9310e98e
branches:  trunk
changeset: 477048:297f9310e98e
user:      itohy <itohy%NetBSD.org@localhost>
date:      Fri Oct 08 03:55:06 1999 +0000

description:
- a.out header is not a part of text segment in NMAGIC.
- Fix section alignment code.
Patch supplied by Izumi Tsutsui, PR #8575.

diffstat:

 sys/lib/libsa/loadfile.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 1eaecf3c5517 -r 297f9310e98e sys/lib/libsa/loadfile.c
--- a/sys/lib/libsa/loadfile.c  Fri Oct 08 02:08:15 1999 +0000
+++ b/sys/lib/libsa/loadfile.c  Fri Oct 08 03:55:06 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile.c,v 1.2 1999/04/28 09:12:24 christos Exp $ */
+/* $NetBSD: loadfile.c,v 1.3 1999/10/08 03:55:06 itohy Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -450,8 +450,8 @@
        u_long magic = N_GETMAGIC(*x);
        int sub;
 
-       /* In OMAGIC, exec header isn't part of text segment */
-       if (magic == OMAGIC)
+       /* In OMAGIC and NMAGIC, exec header isn't part of text segment */
+       if (magic == OMAGIC || magic == NMAGIC)
                sub = 0;
        else
                sub = sizeof(*x);
@@ -468,7 +468,7 @@
         * The kernel may use this to verify that the
         * symbols were loaded by this boot program.
         */
-       if (magic == OMAGIC) {
+       if (magic == OMAGIC || magic == NMAGIC) {
                if (flags & LOAD_HDR)
                        BCOPY(x, maxp - sizeof(*x), sizeof(*x));
        }
@@ -502,7 +502,7 @@
         * Provide alignment if required
         */
        if (magic == ZMAGIC || magic == NMAGIC) {
-               int size = (int)maxp & __LDPGSZ;
+               int size = -(unsigned int)maxp & (__LDPGSZ - 1);
 
                if (flags & LOAD_TEXTA) {
                        PROGRESS(("/%d", size));



Home | Main Index | Thread Index | Old Index