Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 1996 14:22:44 -0700 (MST)
From:      tody@noao.edu
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   gnu/1407: Problem with ld and common sizes
Message-ID:  <199607192122.OAA06363@lepus.tuc.noao.edu>
Resent-Message-ID: <199607192130.OAA20599@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1407
>Category:       gnu
>Synopsis:       ld computes wrong size of common (global data)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 19 14:30:01 PDT 1996
>Last-Modified:
>Originator:     Doug Tody
>Organization:
Doug Tody       National Optical Astronomy Observatories    IRAF project
tody@noao.edu   P.O. Box 26732, Tucson, Arizona, 85726   http://iraf.noao.edu
>Release:        FreeBSD 2.2-960612-SNAP i386
>Environment:

    FreeBSD lepus 2.2-960612-SNAP
    FreeBSD 2.2-960612-SNAP #0: Tue Jul 16 14:45:25 MST 1996 
    tody@lepus:/usr/src/sys/compile/LEPUS  i386

>Description:

    When linking an executable and the same common (global structure)
    exists in both the program and a library with different sizes, the
    smaller of the two sizes is erroneously used.  The larger size should
    be used.

>How-To-Repeat:

    Requires some test code to repeat.

>Fix:

    I just looked at the LD code but the following appears to be the problem.
    See line 531 of gnu/usr.bin/ld/lib.c:

	if (iscommon && p->n_value < sp->common_size)
	    sp->common_size = p->n_value;

    In words, "if the value we are looking at is less than the currently
    recorded size of the common use the new (smaller) value".  Should read

	if (iscommon && sp->common_size < p->n_value)
	    sp->common_size = p->n_value;

    as is done everywhere else in the code.  (I didn't look into it further
    or test the changes but whoever is responsible for LD ought to be able
    to verify this visually).

Doug Tody       National Optical Astronomy Observatories    IRAF project
tody@noao.edu   P.O. Box 26732, Tucson, Arizona, 85726   http://iraf.noao.edu
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607192122.OAA06363>