Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003922OCamlOCaml generalpublic2005-12-13 18:392013-09-03 16:59
Reporterfrisch 
Assigned To 
PrioritylowSeveritytextReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version3.09.0 
Target Version4.02.0+devFixed in Version 
Summary0003922: Detecter inclusions multiples de .cmx
DescriptionLe linker natif détecte en général si on lui demande de mettre plusieurs fois le même module:

../ocaml/ocamlopt -o bug y.cmx y.cmx
Files y.cmx and y.cmx both define a module named Y

Par contre, si l'on -pack un module, la détection ne marche plus:

../ocaml/ocamlopt -for-pack X -c a.ml
../ocaml/ocamlopt -pack -o x.cmx a.cmx
../ocaml/ocamlopt -o bug a.cmx x.cmx
a.o: In function `camlX__A__data_begin':
: multiple definition of `camlX__A__data_begin'
x.o:: first defined here
a.o: In function `camlX__A__entry':
: multiple definition of `camlX__A__code_begin'
x.o:: first defined here
a.o: In function `camlX__A':
: multiple definition of `camlX__A'
x.o:: first defined here
a.o: In function `camlX__A__entry':
: multiple definition of `camlX__A__entry'
x.o:: first defined here
a.o: In function `camlX__A__code_end':
: multiple definition of `camlX__A__code_end'
x.o:: first defined here
a.o: In function `camlX__A__data_end':
: multiple definition of `camlX__A__data_end'
x.o:: first defined here
a.o: In function `camlX__A__frametable':
: multiple definition of `camlX__A__frametable'
x.o:: first defined here
collect2: ld returned 1 exit status
Error during linking
Tagspatch
Attached Files? file icon patch [^] (1,361 bytes) 2005-12-13 18:59 [Show Content]

- Relationships

-  Notes
(0003434)
frisch (developer)
2005-12-13 18:59

Voilà un patch qui implémente le test. Ça donne qqchose comme:

Files a.cmx and x.cmx both define a module named X__A

(pas très joli).
(0006741)
lefessan (developer)
2012-01-19 22:17

I would say that the problem is that you are trying to link a .cmx directly, while it had been generated for packing. I think the compiler should complain not about the double link, but about linking instead of packing.
(0008063)
doligez (administrator)
2012-09-11 14:10

I agree with Fabrice: the problem appears only because you are linking a -for-pack'd module.
(0008066)
frisch (developer)
2012-09-11 14:49

Is it forbidden to link directly a -for-pack'd module ? I agree this is bad style in general, but I was not aware it was forbidden (yet). It could be useful to allow it, e.g. for compiling compiler modules for -for-pack, so as to allow to include them in a third-party project without risking name collisions. But I wouldn't object to disallow it explicitly (probably in byte-code as well).

- Issue History
Date Modified Username Field Change
2005-12-13 18:39 frisch New Issue
2005-12-13 18:59 frisch File Added: patch
2005-12-13 18:59 frisch Note Added: 0003434
2005-12-15 13:16 doligez Priority normal => low
2005-12-15 13:16 doligez Severity minor => text
2005-12-15 13:16 doligez Status new => acknowledged
2012-01-19 22:17 lefessan Note Added: 0006741
2012-09-06 16:44 doligez Target Version => 4.00.1+dev
2012-09-11 14:10 doligez Note Added: 0008063
2012-09-11 14:10 doligez Target Version 4.00.1+dev => 4.00.2+dev
2012-09-11 14:49 frisch Note Added: 0008066
2013-07-02 16:10 doligez Target Version 4.00.2+dev => 4.01.0+dev
2013-07-22 13:06 frisch Target Version 4.01.0+dev => 4.02.0+dev
2013-09-03 16:59 doligez Tag Attached: patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker