modula-2: Module registration constructors need to be visible [PR108259].
Commit Message
Tested on x86_64-linux-gnu, x86_64,aarch64-darwin21.
There remain issues with shared libraries, but the link fails are fixed
by this.
OK for master?
Thanks
Iain
--- 8< ---
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.
---
gcc/m2/gm2-gcc/m2decl.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Iain Sandoe <iains.gcc@gmail.com> writes:
> Tested on x86_64-linux-gnu, x86_64,aarch64-darwin21.
> There remain issues with shared libraries, but the link fails are fixed
> by this.
>
> OK for master?
> Thanks
> Iain
>
> --- 8< ---
>
> 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.
> ---
> gcc/m2/gm2-gcc/m2decl.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/m2/gm2-gcc/m2decl.cc b/gcc/m2/gm2-gcc/m2decl.cc
> index 62bfefd2530..d849f8aefc4 100644
> --- a/gcc/m2/gm2-gcc/m2decl.cc
> +++ b/gcc/m2/gm2-gcc/m2decl.cc
> @@ -276,7 +276,7 @@ m2decl_DeclareModuleCtor (tree decl)
> /* Declare module_ctor (). */
> TREE_PUBLIC (decl) = 1;
> DECL_ARTIFICIAL (decl) = 1;
> - DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
> + DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
> DECL_VISIBILITY_SPECIFIED (decl) = 1;
> DECL_STATIC_CONSTRUCTOR (decl) = 1;
> return decl;
LGTM thanks,
Gaius
@@ -276,7 +276,7 @@ m2decl_DeclareModuleCtor (tree decl)
/* Declare module_ctor (). */
TREE_PUBLIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
- DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+ DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
DECL_VISIBILITY_SPECIFIED (decl) = 1;
DECL_STATIC_CONSTRUCTOR (decl) = 1;
return decl;