Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 1998 17:53:10 +0300 (MSK)
From:      Dmitrij Tejblum <tejblum@arc.hq.cti.ru>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   gnu/6055: as(1) sometimes incorrectly handle EGCS output
Message-ID:  <199803181453.RAA11391@yandex.hq.cti.ru>

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

>Number:         6055
>Category:       gnu
>Synopsis:       as(1) sometimes incorrectly handle EGCS output
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 18 07:00:06 PST 1998
>Last-Modified:
>Originator:     Dmitrij Tejblum
>Organization:
CompTek
>Release:        FreeBSD 2.2.5-STABLE i386
>Environment:

FreeBSD 2.2.5-stable
EGCS 1.0.2 configured with --with-gnu-as --with-gnu-ld

>Description:

When a C++ program contains a static variable with a constructor, GCC emit 
something like 
.stabs "___CTOR_LIST__",22,0,0,__GLOBAL_$I$whatever
GCC 2.7.2.1 always emit it after __GLOBAL_$I$whatever was defined. 
EGCS sometimes (apparently, with -O3, as I see now) emit it before 
__GLOBAL_$I$whatever was defined. In this case, assembler silently convert 
that stab to "usual" text symbol. As a result, ld complains about multiply 
defined ___CTOR_LIST__.

>How-To-Repeat:

put something like 

.stabs "___CTOR_LIST__",22,0,0,_qq
_qq:
	movl %eax, %eax

to an .s file, assemble it, look at result with nm.


>Fix:

Not sure about correct fix. Here is my workaround, just FYI. (And so I have a
chance to hear that all my object are hopelessly broken :).

--- config/obj-aout.c	Tue Mar 17 11:25:17 1998
+++ config/obj-aout.c	Tue Mar 17 11:55:42 1998
@@ -469,7 +469,8 @@
 	/* JF deal with forward references first... */
 	for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
 		if (symbolP->sy_forward && symbolP->sy_forward != symbolP) {
-			S_SET_SEGMENT(symbolP,
+			if ((symbolP->sy_symbol.n_type & 0xf0) == 0) 
+				S_SET_SEGMENT(symbolP,
 				      S_GET_SEGMENT(symbolP->sy_forward));
 			S_SET_VALUE(symbolP, S_GET_VALUE(symbolP)
 				    + S_GET_VALUE(symbolP->sy_forward)
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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