9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Linking error with 8l, guys, could you tell me where to look?
@ 2012-11-26  9:49 keystroke
  2012-11-26 13:25 ` erik quanstrom
  0 siblings, 1 reply; 8+ messages in thread
From: keystroke @ 2012-11-26  9:49 UTC (permalink / raw)
  To: 9fans

The message is:

(2050) DATA  opnames<1>+116(SB)/4,$string<1>+739(SB)
memccpy: multiple initialization
(2170) DATA  etnames<1)+72(SB)/4,$string<1>+912(SB)
memccpy: multiple initialization

I know 2050 is somehow related to the line number where opnames appear in the code, and so is 2170 with etnames.
I know it's suggesting I had an opnames initialized some where, but I just don't know where to look. I read the 8l man, but it seems there is no other docs where I can check for detail information.
Can anybody tell me what the rest number of the message means, where should I look for the duplicate code?

Many thanks guys.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell me where to look?
  2012-11-26  9:49 [9fans] Linking error with 8l, guys, could you tell me where to look? keystroke
@ 2012-11-26 13:25 ` erik quanstrom
  2012-11-28 10:20   ` [9fans] Linking error with 8l, guys, could you tell keystroke
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2012-11-26 13:25 UTC (permalink / raw)
  To: 9fans

On Mon Nov 26 04:56:23 EST 2012, zhangrui0000@gmail.com wrote:
> The message is:
>
> (2050) DATA  opnames<1>+116(SB)/4,$string<1>+739(SB)
> memccpy: multiple initialization
> (2170) DATA  etnames<1)+72(SB)/4,$string<1>+912(SB)
> memccpy: multiple initialization
>
> I know 2050 is somehow related to the line number where opnames appear in the code, and so is 2170 with etnames.
> I know it's suggesting I had an opnames initialized some where, but I just don't know where to look. I read the 8l man, but it seems there is no other docs where I can check for detail information.
> Can anybody tell me what the rest number of the message means, where should I look for the duplicate code?

this is the format from 8l/list.c:/^Pconv

			snprint(str, sizeof(str), "(%ld)	%A	%D,%D",
				p->line, p->as, &p->from, &p->to);

it looks like memccpy is defined twice in the same .8.
i'd look for the symbol rather than the line number.

the format of the line number doesn't fit the plumbable
convention, which would be file:line, and also appears to
not be the line number you are expecting.  it's
the line number after include files are processed.  which
while not wrong, is not helpful either.

- erik

---
example:

; cat mdef.c
#include <u.h>
#include <libc.h>

void
x(void)
{
}

void
x(void)
{
}

void
main(void)
{
}
; tmk mdef.c
6c -FVTw mdef.c
6l -o 6.mdef mdef.6
x: mdef.6: redefinition: x
(818)	TEXT	x+0(SB),$0
; # modified 8c to output line numbers in comments
; /sys/src/cmd/8c/6.out -S mdef.c
	TEXT	x+0(SB),0,$0	/* 806 */
	RET	,	/* 808 */
	TEXT	x+0(SB),0,$0	/* 811 */
	RET	,	/* 813 */
	TEXT	main+0(SB),0,$0	/* 816 */
	RET	,	/* 818 */
	END	,	/* 818 */



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-26 13:25 ` erik quanstrom
@ 2012-11-28 10:20   ` keystroke
  2012-11-28 11:43     ` Bence Fábián
  0 siblings, 1 reply; 8+ messages in thread
From: keystroke @ 2012-11-28 10:20 UTC (permalink / raw)
  To: 9fans

Thank you for your reply, erik.

But I don't quite follow you. Are you suggesting that the error has nothing to do with "opnames" and "etnames", but is about the following word "memccpy"?

I had grep opnames and etnames before, and finds only one initial place.
And I grep memccpy, no result was found.
There is a strange situation, when I "8l subr.c" then it's "memccpy", when I
"8l *.8", it shows "create":

(2050) DATA ...(same as before)
create: multiple initialization.
...(same as before)
create: multiple initialization.

I suspect it is opnames and etnames that cause the problem, and I find something
strange in the subr.c and it's included file go.h, is it relevant?

=============================================================
> subr.c
=============================================================
static char*
opnames[] =
{
	[OADDR]		= "ADDR",
	[OADD]		= "ADD",
	[OANDAND]	= "ANDAND",
	[OAND]		= "AND",
	[OARRAY]	= "ARRAY",
	[OASOP]		= "ASOP",
	[OAS]		= "AS",
	[OBAD]		= "BAD",
	[OBREAK]	= "BREAK",
	[OCALL]		= "CALL",
	[OCALLPTR]	= "CALLPTR",
	[OCALLMETH]	= "CALLMETH",
	[OCALLINTER]	= "CALLINTER",
	[OCAT]		= "CAT",
	[OCASE]		= "CASE",
	[OXCASE]	= "XCASE",
	[OFALL]		= "FALL",
	[OCONV]		= "CONV",
	[OCOLAS]	= "COLAS",
	[OCOM]		= "COM",
	[OCONST]	= "CONST",
	[OCONTINUE]	= "CONTINUE",
	[ODCLARG]	= "DCLARG",
	[ODCLCONST]	= "DCLCONST",
	[ODCLFIELD]	= "DCLFIELD",
	[ODCLFUNC]	= "DCLFUNC",
	[ODCLTYPE]	= "DCLTYPE",
	[ODCLVAR]	= "DCLVAR",
	[ODIV]		= "DIV",
	[ODOT]		= "DOT",
	[ODOTPTR]	= "DOTPTR",
	[ODOTMETH]	= "DOTMETH",
	[ODOTINTER]	= "DOTINTER",
	[OEMPTY]	= "EMPTY",
	[OEND]		= "END",
	[OEQ]		= "EQ",
	[OFOR]		= "FOR",
	[OFUNC]		= "FUNC",
	[OGE]		= "GE",
	[OPROC]		= "PROC",
	[OGOTO]		= "GOTO",
	[OGT]		= "GT",
	[OIF]		= "IF",
	[OINDEX]	= "INDEX",
	[OINDEXPTR]	= "INDEXPTR",
	[OINDEXSTR]	= "INDEXSTR",
	[OINDEXMAP]	= "INDEXMAP",
	[OINDEXPTRMAP]	= "INDEXPTRMAP",
	[OIND]		= "IND",
	[OLABEL]	= "LABEL",
	[OLE]		= "LE",
	[OLEN]		= "LEN",
	[OLIST]		= "LIST",
	[OLITERAL]	= "LITERAL",
	[OLSH]		= "LSH",
	[OLT]		= "LT",
	[OMINUS]	= "MINUS",
	[OMOD]		= "MOD",
	[OMUL]		= "MUL",
	[ONAME]		= "NAME",
	[ONE]		= "NE",
	[ONOT]		= "NOT",
	[OOROR]		= "OROR",
	[OOR]		= "OR",
	[OPLUS]		= "PLUS",
	[ODEC]		= "DEC",
	[OINC]		= "INC",
	[OSEND]		= "SEND",
	[ORECV]		= "RECV",
	[OPTR]		= "PTR",
	[ORETURN]	= "RETURN",
	[ORSH]		= "RSH",
	[OSLICE]	= "SLICE",
	[OSUB]		= "SUB",
	[OSWITCH]	= "SWITCH",
	[OTYPE]		= "TYPE",
	[OVAR]		= "VAR",
	[OEXPORT]	= "EXPORT",
	[OIMPORT]	= "IMPORT",
	[OXOR]		= "XOR",
	[ONEW]		= "NEW",
	[OFALL]		= "FALL",
	[OXFALL]	= "XFALL",
	[OPANIC]	= "PANIC",
	[OPRINT]	= "PRINT",
	[OXXX]		= "XXX",
};

=============================================================
> go.h
=============================================================
enum
{
	OXXX,

	OTYPE, OCONST, OVAR, OEXPORT, OIMPORT,

	ONAME,
	ODOT, ODOTPTR, ODOTMETH, ODOTINTER,
	ODCLFUNC, ODCLCONST, ODCLVAR,
	ODCLTYPE, ODCLFIELD, ODCLARG,
	OLIST,
	OPTR, OARRAY,
	ORETURN, OFOR, OIF, OSWITCH,
	OAS, OASOP, OCOLAS, OCASE, OXCASE, OFALL, OXFALL,
	OGOTO, OPROC, ONEW, OPANIC, OPRINT, OEMPTY,

	OOROR,
	OANDAND,
	OEQ, ONE, OLT, OLE, OGE, OGT,
	OADD, OSUB, OOR, OXOR, OCAT,
	OMUL, ODIV, OMOD, OLSH, ORSH, OAND,
	ODEC, OINC,
	OLEN,
	OFUNC,
	OLABEL,
	OBREAK,
	OCONTINUE,
	OADDR,
	OIND,
	OCALL, OCALLPTR, OCALLMETH, OCALLINTER,
	OINDEX, OINDEXPTR, OINDEXSTR, OINDEXMAP, OINDEXPTRMAP,
	OSLICE,
	ONOT, OCOM, OPLUS, OMINUS, OSEND, ORECV,
	OLITERAL,
	OCONV,
	OBAD,

	OEND,
};



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-28 10:20   ` [9fans] Linking error with 8l, guys, could you tell keystroke
@ 2012-11-28 11:43     ` Bence Fábián
  2012-11-28 11:51       ` lucio
  2012-11-28 12:48       ` erik quanstrom
  0 siblings, 2 replies; 8+ messages in thread
From: Bence Fábián @ 2012-11-28 11:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 5651 bytes --]

This is a multiple initialization problem. Here is an example code:

#include <u.h>
#include <libc.h>

int num = 20;
int num = 30;

void
main(void)
{
print("%d\n", num);
exits(nil);
}

relevant parts:

/sys/src/cmd/8l/asm.c:424:
/sys/src/cmd/8l/pass.c:16:



2012/11/28 keystroke <zhangrui0000@gmail.com>

> Thank you for your reply, erik.
>
> But I don't quite follow you. Are you suggesting that the error has
> nothing to do with "opnames" and "etnames", but is about the following word
> "memccpy"?
>
> I had grep opnames and etnames before, and finds only one initial place.
> And I grep memccpy, no result was found.
> There is a strange situation, when I "8l subr.c" then it's "memccpy", when
> I
> "8l *.8", it shows "create":
>
> (2050) DATA ...(same as before)
> create: multiple initialization.
> ...(same as before)
> create: multiple initialization.
>
> I suspect it is opnames and etnames that cause the problem, and I find
> something
> strange in the subr.c and it's included file go.h, is it relevant?
>
> =============================================================
> > subr.c
> =============================================================
> static char*
> opnames[] =
> {
>         [OADDR]         = "ADDR",
>         [OADD]          = "ADD",
>         [OANDAND]       = "ANDAND",
>         [OAND]          = "AND",
>         [OARRAY]        = "ARRAY",
>         [OASOP]         = "ASOP",
>         [OAS]           = "AS",
>         [OBAD]          = "BAD",
>         [OBREAK]        = "BREAK",
>         [OCALL]         = "CALL",
>         [OCALLPTR]      = "CALLPTR",
>         [OCALLMETH]     = "CALLMETH",
>         [OCALLINTER]    = "CALLINTER",
>         [OCAT]          = "CAT",
>         [OCASE]         = "CASE",
>         [OXCASE]        = "XCASE",
>         [OFALL]         = "FALL",
>         [OCONV]         = "CONV",
>         [OCOLAS]        = "COLAS",
>         [OCOM]          = "COM",
>         [OCONST]        = "CONST",
>         [OCONTINUE]     = "CONTINUE",
>         [ODCLARG]       = "DCLARG",
>         [ODCLCONST]     = "DCLCONST",
>         [ODCLFIELD]     = "DCLFIELD",
>         [ODCLFUNC]      = "DCLFUNC",
>         [ODCLTYPE]      = "DCLTYPE",
>         [ODCLVAR]       = "DCLVAR",
>         [ODIV]          = "DIV",
>         [ODOT]          = "DOT",
>         [ODOTPTR]       = "DOTPTR",
>         [ODOTMETH]      = "DOTMETH",
>         [ODOTINTER]     = "DOTINTER",
>         [OEMPTY]        = "EMPTY",
>         [OEND]          = "END",
>         [OEQ]           = "EQ",
>         [OFOR]          = "FOR",
>         [OFUNC]         = "FUNC",
>         [OGE]           = "GE",
>         [OPROC]         = "PROC",
>         [OGOTO]         = "GOTO",
>         [OGT]           = "GT",
>         [OIF]           = "IF",
>         [OINDEX]        = "INDEX",
>         [OINDEXPTR]     = "INDEXPTR",
>         [OINDEXSTR]     = "INDEXSTR",
>         [OINDEXMAP]     = "INDEXMAP",
>         [OINDEXPTRMAP]  = "INDEXPTRMAP",
>         [OIND]          = "IND",
>         [OLABEL]        = "LABEL",
>         [OLE]           = "LE",
>         [OLEN]          = "LEN",
>         [OLIST]         = "LIST",
>         [OLITERAL]      = "LITERAL",
>         [OLSH]          = "LSH",
>         [OLT]           = "LT",
>         [OMINUS]        = "MINUS",
>         [OMOD]          = "MOD",
>         [OMUL]          = "MUL",
>         [ONAME]         = "NAME",
>         [ONE]           = "NE",
>         [ONOT]          = "NOT",
>         [OOROR]         = "OROR",
>         [OOR]           = "OR",
>         [OPLUS]         = "PLUS",
>         [ODEC]          = "DEC",
>         [OINC]          = "INC",
>         [OSEND]         = "SEND",
>         [ORECV]         = "RECV",
>         [OPTR]          = "PTR",
>         [ORETURN]       = "RETURN",
>         [ORSH]          = "RSH",
>         [OSLICE]        = "SLICE",
>         [OSUB]          = "SUB",
>         [OSWITCH]       = "SWITCH",
>         [OTYPE]         = "TYPE",
>         [OVAR]          = "VAR",
>         [OEXPORT]       = "EXPORT",
>         [OIMPORT]       = "IMPORT",
>         [OXOR]          = "XOR",
>         [ONEW]          = "NEW",
>         [OFALL]         = "FALL",
>         [OXFALL]        = "XFALL",
>         [OPANIC]        = "PANIC",
>         [OPRINT]        = "PRINT",
>         [OXXX]          = "XXX",
> };
>
> =============================================================
> > go.h
> =============================================================
> enum
> {
>         OXXX,
>
>         OTYPE, OCONST, OVAR, OEXPORT, OIMPORT,
>
>         ONAME,
>         ODOT, ODOTPTR, ODOTMETH, ODOTINTER,
>         ODCLFUNC, ODCLCONST, ODCLVAR,
>         ODCLTYPE, ODCLFIELD, ODCLARG,
>         OLIST,
>         OPTR, OARRAY,
>         ORETURN, OFOR, OIF, OSWITCH,
>         OAS, OASOP, OCOLAS, OCASE, OXCASE, OFALL, OXFALL,
>         OGOTO, OPROC, ONEW, OPANIC, OPRINT, OEMPTY,
>
>         OOROR,
>         OANDAND,
>         OEQ, ONE, OLT, OLE, OGE, OGT,
>         OADD, OSUB, OOR, OXOR, OCAT,
>         OMUL, ODIV, OMOD, OLSH, ORSH, OAND,
>         ODEC, OINC,
>         OLEN,
>         OFUNC,
>         OLABEL,
>         OBREAK,
>         OCONTINUE,
>         OADDR,
>         OIND,
>         OCALL, OCALLPTR, OCALLMETH, OCALLINTER,
>         OINDEX, OINDEXPTR, OINDEXSTR, OINDEXMAP, OINDEXPTRMAP,
>         OSLICE,
>         ONOT, OCOM, OPLUS, OMINUS, OSEND, ORECV,
>         OLITERAL,
>         OCONV,
>         OBAD,
>
>         OEND,
> };
>
>

[-- Attachment #2: Type: text/html, Size: 8162 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-28 11:43     ` Bence Fábián
@ 2012-11-28 11:51       ` lucio
  2012-11-28 12:12         ` Bence Fábián
  2012-11-28 12:48       ` erik quanstrom
  1 sibling, 1 reply; 8+ messages in thread
From: lucio @ 2012-11-28 11:51 UTC (permalink / raw)
  To: 9fans

> int num = 20;
> int num = 30;

Looks easy to fix, but I understand where you're coming from.  What
stops you from using a workaround?

++L




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-28 11:51       ` lucio
@ 2012-11-28 12:12         ` Bence Fábián
  2012-11-28 12:22           ` Bence Fábián
  0 siblings, 1 reply; 8+ messages in thread
From: Bence Fábián @ 2012-11-28 12:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

DATA  opnames<1>+116(SB)/4,$string<1>+739(SB)
and
DATA  etnames<1)+72(SB)/4,$string<1>+912(SB)

are the second initializations of both opnames and etnames.
you can grep for them in the output of
8c -S source.c

that's all i can help, cause i can't tell what $string<1>+739(SB)
and $string<1>+912(SB) refer to
since they are adresses.



2012/11/28 <lucio@proxima.alt.za>

> > int num = 20;
> > int num = 30;
>
> Looks easy to fix, but I understand where you're coming from.  What
> stops you from using a workaround?
>
> ++L
>
>
>

[-- Attachment #2: Type: text/html, Size: 1042 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-28 12:12         ` Bence Fábián
@ 2012-11-28 12:22           ` Bence Fábián
  0 siblings, 0 replies; 8+ messages in thread
From: Bence Fábián @ 2012-11-28 12:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

but what is _most_ likely is that you really have them initialized two
times.
just do
g '(op|et)names ?='
you should find 4 initializations. just delete the redundant ones.

2012/11/28 Bence Fábián <begnoc@gmail.com>

> DATA  opnames<1>+116(SB)/4,$string<1>+739(SB)
> and
> DATA  etnames<1)+72(SB)/4,$string<1>+912(SB)
>
> are the second initializations of both opnames and etnames.
> you can grep for them in the output of
> 8c -S source.c
>
> that's all i can help, cause i can't tell what $string<1>+739(SB)
> and $string<1>+912(SB) refer to
> since they are adresses.
>
>

[-- Attachment #2: Type: text/html, Size: 1103 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Linking error with 8l, guys, could you tell
  2012-11-28 11:43     ` Bence Fábián
  2012-11-28 11:51       ` lucio
@ 2012-11-28 12:48       ` erik quanstrom
  1 sibling, 0 replies; 8+ messages in thread
From: erik quanstrom @ 2012-11-28 12:48 UTC (permalink / raw)
  To: begnoc, 9fans

you're right.  a quick trip through sort|uniq -d says that FALL is listed
twice.

- erik



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-11-28 12:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26  9:49 [9fans] Linking error with 8l, guys, could you tell me where to look? keystroke
2012-11-26 13:25 ` erik quanstrom
2012-11-28 10:20   ` [9fans] Linking error with 8l, guys, could you tell keystroke
2012-11-28 11:43     ` Bence Fábián
2012-11-28 11:51       ` lucio
2012-11-28 12:12         ` Bence Fábián
2012-11-28 12:22           ` Bence Fábián
2012-11-28 12:48       ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).