public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108259] New: Modula-2 module constructors symbols in (shared) libraries are hidden
@ 2023-01-01 14:44 iains at gcc dot gnu.org
  2023-01-01 15:46 ` [Bug modula2/108259] " iains at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-01 14:44 UTC (permalink / raw)
  To: gcc-bugs

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".

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

end of thread, other threads:[~2023-01-04 16:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-01 14:44 [Bug modula2/108259] New: Modula-2 module constructors symbols in (shared) libraries are hidden iains at gcc dot gnu.org
2023-01-01 15:46 ` [Bug modula2/108259] " iains at gcc dot gnu.org
2023-01-01 16:41 ` iains at gcc dot gnu.org
2023-01-02 10:16 ` iains at gcc dot gnu.org
2023-01-02 11:41 ` iains at gcc dot gnu.org
2023-01-04 14:54 ` cvs-commit at gcc dot gnu.org
2023-01-04 16:23 ` iains at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).