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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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 ` iains at gcc dot gnu.org
  2023-01-01 16:41 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-01 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 54173
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54173&action=edit
Make module registration constructors visible.

The issue here was that the code translating these into "GCC" form was marking
them as hidden.

Fixing this solves the link problem and then triggers a different issue (to be
reported at a later time)

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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-01 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-01-01
             Status|UNCONFIRMED                 |NEW
             Target|*-darwin*                   |*-darwin*, x86_64-linux-gnu
     Ever confirmed|0                           |1
               Host|*-darwin*                   |*-darwin*, x86_64-linux-gnu

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
repeated the problem on x86_6 linux gnu.

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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-02 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
this patch shows the problem - because it removes the shadowing "-L" options. 
Obviously, we cannot apply it without creating 'regressions'...

[PATCH] modula-2, driver: Do not add extra '-L' options that shadow
 $libdir.

The driver is adding one '-L' option for each path to libm2xxx.a which is
shadowing $libpath where the shared libraries are installed.  This prevents
the shared libraries from being found (there are also convenience libs
in $libdir, so the additional -L options are not needed).

gcc/m2/ChangeLog:

        * gm2spec.cc (add_default_combination): Do not add extra library
        paths for the libm2xxx.a libraries.
---
 gcc/m2/gm2spec.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc
index 3c91479df16..4996fa49789 100644
--- a/gcc/m2/gm2spec.cc
+++ b/gcc/m2/gm2spec.cc
@@ -289,7 +289,6 @@ add_default_combination (const char *libpath, const char
*library)
 {
   if (library != NULL)
     {
-      append_option (OPT_L, build_archive_path (libpath, library), 1);
       append_option (OPT_l, safe_strdup (library), 1);
       return true;
     }
--

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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-02 11:41 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-January
                   |                            |/609298.html

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
posted patch, it seems an incremental improvement - although subsidiary issues
remain.

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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-04 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:751c2d9a46f786381a90d5c8c49947fa0d9b7ee5

commit r13-4995-g751c2d9a46f786381a90d5c8c49947fa0d9b7ee5
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jan 1 15:42:03 2023 +0000

    modula-2: Module registration constructors need to be visible [PR108259].

    In the current design the main executable links explicitly to the module
    registration construtors that it uses.  This means that they must be
    visible in shared libraries.

            PR modula2/108259

    gcc/m2/ChangeLog:

            * gm2-gcc/m2decl.cc (m2decl_DeclareModuleCtor): Make module
            registration constructors visible.

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

* [Bug modula2/108259] Modula-2 module constructors symbols in (shared) libraries are hidden
  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
                   ` (4 preceding siblings ...)
  2023-01-04 14:54 ` cvs-commit at gcc dot gnu.org
@ 2023-01-04 16:23 ` iains at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-04 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
I think this is now fixed.

^ 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).