This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Assembler error under Solaris 2.6 x86


Hi,

Here are the source files.  I'm can't seem to compile the object file
for UtEnvironment.C.  My compile line is:
g++ -I. -Wall -g -c UtEnvironment.C

Please note that this compiles under Linux with egcs 1.0.3a
but not under Solaris x86 2.6 with either egcs 1.1.1 or gcc 2.8.1.
I get the Assembler error mentioned below.  I have not tried 
egcs 1.0.3a or any snapshot releases under Solaris x86 2.6.

Thanks,
Tuan

--
Tuan Hoang
The MITRE Corporation

On Tue, 9 Feb 1999, Manfred Hollstein wrote:

> On Mon, 8 February 1999, 15:06:38, tuan@optimus.mitre.org wrote:
> 
>  > Hi,
>  > 
>  > I'm running egcs on a Dual Pentium II 400 with 512 MB SDRAM with
>  > Solaris 2.6 x86.  I've installed and did the check for version:
>  >   Reading specs from
>  >   /usr/local/lib/gcc-lib/i386-pc-solaris2.6/egcs-2.91.60/specs
>  >   gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
>  > 
>  > I'm compiling a C++ class that I use for my environment
>  > that periodically loads a flags file for runtime debugging statements.
>  > I get the following error under Solaris but not under Slackware Linux
>  > with compiler 1.0.3a.  It doesn't give any warnings about syntax so I'm
>  > at a loss on what to look for.
>  > 
>  > g++ -I. -Wall -g -c UtEnvironment.C
>  > Assembler: UtEnvironment.C
>  >         aline 29917     : symbol already has a type
>  >         aline 29918     : multiply defined label
>  >         aline 29955     : symbol already has a size
>  >         aline 31444     : symbol already has a type
>  >         aline 31445     : multiply defined label
>  >         aline 31550     : symbol already has a size
>  > make: *** [UtEnvironment.o] Error 1
>  > 
>  > If you need the class and header file I can gzip them
>  > and send them as a separate email.
> 
> Yes, please post them; otherwise we'll not be able to work on your
> report (see also <http://egcs.cygnus.com/faq.html#bugreport>).
> 
> Later,
> manfred
> 
> -- 
>  Manfred Hollstein       If you have any questions about GNU software:
>  Hindenburgstr. 13/1                   <mailto:manfred@s-direktnet.de>
>  75446 Wiernsheim, FRG  <http://www.s-direktnet.de/HomePages/manfred/>
>  PGP key:    <http://www.s-direktnet.de/HomePages/manfred/manfred.asc>
> 
/* (c) 1994, The Mitre Corporation, 
 *
 * Author: Mike Butler, mgb@mitre.org
 *
 * $Id: UtAlarm.h,v 1.3 1999/02/08 21:14:12 tuan Exp $
 */

/* CRM Alarm routine...
 * Usage is 
 *     // AlarmTxt: W-Time to '%d' and '%s'
 *    Alarm("symbol", 12, "foo");
 *
 * The comment must appear on the line immediately preceeding
 * the Alarm call!!  A script examines these files and assembles
 * the Alarm list.
 * 
 * In   : eh::AlarmType - symbolic name for the Alarm to be reported
 * Out  : (none) 
 * FX   :               - one string (or resource) is read, and formatted
 *      :               - the global error routine is called
 *      :               - If the error is fatal, this routine aborts
 *      :               - otherwise it returns to caller 
 *
 * NOTE!  Unlike sprintf, you must be VERY CAREFUL about using
 * the "long" flags (e.g., %d in an int, %ld is a long.)
 */
#ifndef Alarm_h
#define Alarm_h

#include <stdarg.h>
#include <string> /* Our string class */
#include <iostream.h>
#include <unistd.h>

// class Alarm
class Alarm {
public:
  enum Severity { fatal, warn, info, debug, log, terse, };
private:
  typedef void (*AlarmCallback)(void *, 
				const string &text,
				const string &lvl, 
				const string &sym, 
				const string &proc, 
				const string &line, 
				const string &file);  

  struct Entry {
    Severity    cSeverity;
    const char *cLevel;
    const char *cFile;
    const char *cLine;
    const char *cSymbol;
    const char *cFunction;
    const char *cFormat;
  };

  static char *cBuffer;
  static unsigned int cBufferSize;
  static const unsigned int cMinBufferSz;
  static const int AlarmTblSize;
  static const Entry AlarmTbl[];
  static ostream *cLogFile;
  static AlarmCallback cCallback;
  static void *cCallObject;
  static string cFormat[];
  static pid_t cPid;

  static string Format(const string &fmt, const string &text, const string &lvl, const string &sym, const string &proc, const string &line, const string &file);
public:
  static void Report(const char *, ...);
  static void SetLogFile(ostream &os) { cLogFile = &os; }
  static void Callback(void *obj, AlarmCallback cb) { cCallback = cb; cCallObject = obj; }
  static void SetFormat(const Severity &s, const string &f) { cFormat[s] = f; }
  static void Require(unsigned int size);

  Alarm();
  ~Alarm();
};

#endif// Alarm_h
/* (c) 1996, The Mitre Corporation, 
 *
 * Author: Mike Butler, mgb@mitre.org
 *
 * $Id: UtEnvironment.h,v 1.2 1999/02/08 19:48:15 tuan Exp $
 */
#ifndef UtEnvironment_h
#define UtEnvironment_h

#include <stl.h>
#include <string>

/*$ Environment class
 * Read environment from a file... 
 * Provides error checked form of getenv()
 */
class Environment {
  //friend ostream &operator<<(ostream &os, const Environment &e) { return(e.Dump(os)); }
  friend istream &operator>>(istream &is, Environment &e) { return (e.Load(is)); }
private:
  typedef map<string, string, less<string> > AttribMap_t;
  static AttribMap_t cEnv;
  string cName;
  bool cAlarm;

public:
  Environment(const string &attr = "", bool alarm = true);
  Environment(const string &attr, const string &defval, bool alarm= true);
  const string &operator=(const string &value);
  operator bool() const;
  operator string() const;
  static bool Load(const string &s);
  static bool Set(const string &s, const string &s);
  bool Unset(const string &attr);
  static istream &Load(istream &);
  static void Dump();
};
#endif // UtEnvironment_h
/* (c) 1996, The Mitre Corporation, 
 *
 * Author: Mike Butler, mgb@mitre.org
 *
 * $Id: UtEnvironment.C,v 1.1 1999/02/08 19:48:15 tuan Exp $
 */
#include <UtEnvironment.h>
#include <fstream.h>
#include <strstream.h>
#include <stdio.h>		// for sscanf()
#include <UtAlarm.h>

Environment::AttribMap_t Environment::cEnv;

/* Constructor, usually transient... */
Environment::Environment(const string &s, bool alarm)
{
  cName = s;
  cAlarm = alarm;
}

/* Constructor with default value... 
 */
Environment::Environment(const string &a, const string &v, bool alarm)
{
  cAlarm = alarm;
  cName  = a;
  if(cEnv.find(a) == cEnv.end()) {
    if(cAlarm) {
      // AlarmTxt: W-Attribute '%s' not defined, using default '%s'
      Alarm::Report("UtEnvironment_30", a.c_str(), v.c_str());
    }
    cEnv[a] = v;
  }
}

/* Assign named attribute a value... */
const string &Environment::operator=(const string &value)
{
  cEnv[cName] = value;
  return(value);
}
/* Check if attribute is defined */
Environment::operator bool() const
{
  return(cEnv.find(cName) != cEnv.end());
}
Environment::operator string() const
{
  if(cEnv.find(cName) != cEnv.end())
    return(cEnv[cName]);
  /* Not there... */
  if(cAlarm) {
    // AlarmTxt: W-Attribute '%s' is not defined
    Alarm::Report("UtEnvironment_54", cName.c_str());
  }
  return("");
}
bool Environment::Load(const string &s)
{
  ifstream is(s.c_str());
  if(!is) return(false);
  Load(is);
  return(true);
}     

/* Load environment from stream */
istream &Environment::Load(istream &is)
{
  while(is && !is.eof()) 
    {
      string line;
      int ofVal;
      char dummy;
      getline(is, line);
      char attr[line.length() + 2];
      if(is.eof()) 
	break;
      if(2 == sscanf(line.c_str(), " %[a-zA-Z0-9_] %1[=] %n", attr, &dummy, &ofVal)) 
	{
	  cEnv[attr] = line.substr(ofVal);
	}
    }
  return(is);
}

/* Set a particular attribute to a value... */
bool
Environment::Set(const string &attr, const string &val)
{
  cEnv[attr] = val;
  return(true);
}
/* Unset a particular attribute... */
bool
Environment::Unset(const string &attr)
{
  if(cEnv.find(attr) == cEnv.end()) return(false);
  cEnv.erase(attr);
  return(true);
}

void
Environment::Dump()
{
  ostrstream os;
  AttribMap_t::const_iterator it;

  for(it = cEnv.begin(); it != cEnv.end(); it++) {
    os << (*it).first << "=" << (*it).second << endl;
  }

  os << ends;

  char *tmp = os.str();

  Alarm::Require(strlen(tmp));

  // AlarmTxt: D-Current Environment:\n%s
  Alarm::Report("UtEnvironment_115", tmp);

  delete [] tmp;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]