fixup_tdescs.c revision e824d57f8160a27ac5e650005c7a4f037109c2be
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 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 and general needed
* fixups.
*/
#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) {
}
}
}
}
/*
* Fix stabs generation bugs. These routines must be run before the
* post-conversion merge
*/
void
{
}
struct match {
const char *m_name;
};
static int
{
return (0);
return (0);
return (-1);
}
static tdesc_t *
{
}
/*
* 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. DWARF might not
* have the cpu_t, so we let this pass.
*/
return;
} else {
}
return;
return;
foundcpucyc = 1;
}
return;
/*
* We need to derive the right offset for the fake cpu_m member. To do
* that, we require a special unused member to be the last member
* before the 'cpu_m', that we encode knowledge of here. ABI alignment
* on all platforms is such that we only need to add a pointer-size
* number of bits to get the right offset for cpu_m. This would most
* likely break if gcc's -malign-double were ever used, but that option
* breaks the ABI anyway.
*/
terminate("last cpu_t member before cpu_m is %s; "
}
return;
}
}
void
{
}