st_bugs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Workarounds for stabs generation bugs in the compiler
*/
#include <stdio.h>
#include <strings.h>
#include "ctf_headers.h"
#include "ctftools.h"
#include "hash.h"
#include "memory.h"
/*
* Due to 4432619, the 6.1 compiler will sometimes incorrectly generate pointer
* stabs. Given a struct foo, and a corresponding typedef struct foo foo_t.
* In some cases, when faced with a pointer to a foo_t, the compiler will
* sometimes generate a stab that describes a pointer to a struct foo.
* Regardless of correctness, this breaks merges, as it occurs inconsistently
* by file. The following two routines know how to recognize and repair foo_t *
* and foo_t ** bugs in a specific set of cases. There is no general way to
* solve this problem without a fix to the compiler. In general, cases should
* only be added to these routines to fix merging problems in genunix.
*/
static void
{
int i;
continue;
break;
}
if (!ml)
continue;
continue;
continue;
continue;
/* We have an instance of the bug */
}
}
static void
{
int i;
return;
continue;
continue;
continue;
if (!ptr) {
}
}
}
}
/*
* The cpu structure grows, with the addition of a machcpu member, if
* _MACHDEP is defined. This means that, for example, the cpu structure
* in unix is different from the cpu structure in genunix. As one might
* expect, this causes merges to fail. Since everyone indirectly contains
* a pointer to a CPU structure, the failed merges can cause massive amounts
* of duplication. In the case of unix uniquifying against genunix, upwards
* of 50% of the structures were unmerged due to this problem. We fix this
* by adding a cpu_m member. If machcpu hasn't been defined in our module,
* we make a forward node for it.
*/
static void
{
int foundcpucyc = 0;
/*
* We're going to take the circuitous route finding the cpu structure,
* because we want to make sure that we find the right one. It would
* be nice if we could verify the header name too.
*/
return;
return;
foundcpucyc = 1;
}
return;
/*
* We need to find out how big the last element is so we can compute the
* offset of the new one. If the last element has a size, we use it.
* If it doesn't, it should be a pointer, which won't have a size. In
* that case, we look up the size of a long and use that as the size of
* the pointer.
*/
else {
}
return;
}
/*
* Fix stabs generation bugs. These routines must be run before the
* post-conversion merge
*/
void
{
}