https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108259

            Bug ID: 108259
           Summary: Modula-2 module constructors symbols in (shared)
                    libraries are hidden
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

This problem is somewhat obscured by the way in which the driver constructs
command lines and the way that the libraries are installed.

we have something like (repeated for each m2 lib):

 /install/path/
   lib/
    libm2pim.<slibextension> (shared)
    libm2pim.a (convenience)
    .... etc.
   lib/gcc/<target noncanonical>/<version>/m2/m2pim
     <... modules>
     libm2pim.{a,la}

The driver then adds "-L install/path/lib/gcc/<target
noncanonical>/<version>/m2/m2pim" *before* install/path/lib

So that the non-shared version is found first .. which links OK.

I was wondering why there were no shared library references in the test cases I
was trying to debug .. and saw this .. so... 

------

.. Now, if I remove the "-L /install/path/lib/gcc/<target
noncanonical>/<version>/m2/m2pim" (or put it after the "-L /install/path/lib")
then the shared libm2pim is picked up.

Link now fails with a lot of:
  "__M2_ASCII_ctor", referenced from:
      __M2_link in hm-hello.o
  "__M2_ChanConsts_ctor", referenced from:
      __M2_link in hm-hello.o

This is because those symbols are not exported from the shared library - which
is because they are marked as hidden.

At present, I cannot figure out what part of the code decides that these CTOR
symbols should be hidden (this is for code generated from .mod files by the
compiler; the CTOR symbols in the c++ code for the libraries **are** correctly
exported).

SO I think this is a front end problem not a library problem - the symbols are
being created with the wrong visibility for the current design.

----

(This just happens to work when linking the convenience libraries, because
there is no need for the symbols to be exported - they are visible to the
linker there).

------

IFF We get this fixed that would make one fewer set of library paths that need
to be added by the driver (which will help with PR108182).  There is no need
for the second set of "-L" the libraries are installed in the "usual place".

Reply via email to