EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: gcc 4.x symbol visibility
From: "Jeff Hill" <[email protected]>
To: "'Andrew Johnson'" <[email protected]>
Cc: "'EPICS core-talk'" <[email protected]>
Date: Thu, 29 Sep 2011 16:27:06 -0600
Hi Andrew,

Looks like a good idea. What's missing is some C++ typeinfo symbols (used when there is use of the typeid operator and also by c++ exceptions), which are usually behind-the-curtain, and so I am not quite certain at the moment how one explicitly exports the typeinfo symbols. Perhaps what is needed is to remove typeid references that don’t go through an abstract base. Otherwise, switching on the proper version of gcc in shareLib.h, should be easy to address? I am working nios2 issues at the moment so if I forget to take care of this after the meeting don’t hesitate to nag.

Jeff
______________________________________________________
Jeffrey O. Hill           Email        [email protected]
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

Message content: TSPA

With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead. -- RFC 1925


> -----Original Message-----
> From: Andrew Johnson [mailto:[email protected]]
> Sent: Thursday, September 29, 2011 3:47 PM
> To: Jeff Hill
> Cc: EPICS core-talk
> Subject: gcc 4.x symbol visibility
> 
> Hi Jeff,
> 
> I came across this webpage some time ago
> http://gcc.gnu.org/wiki/Visibility
> and added the relevant attributes to a private version of shareLib.h:
> 
> === modified file 'src/libCom/misc/shareLib.h'
> --- src/libCom/misc/shareLib.h  2008-08-06 16:52:52 +0000
> +++ src/libCom/misc/shareLib.h  2011-09-28 22:38:37 +0000
> @@ -139,6 +139,24 @@
>  #   define epicsShareDef
>  #   define epicsShareAPI __stdcall /* function removes arguments */
>  #   define READONLY const
> +
> +#elif __GNUC__ >= 4
> +/*
> + * See http://gcc.gnu.org/wiki/Visibility
> + */
> +
> +#   define epicsShareExtern __attribute__ ((visibility("default")))
> extern
> +#   define epicsShareClass __attribute__ ((visibility("default")))
> +#   define epicsShareFunc __attribute__ ((visibility("default")))
> +
> +#   define epicsShareDef
> +#   define epicsShareAPI
> +#   if defined(__STDC__) || defined (__cplusplus)
> +#       define READONLY const
> +#   else
> +#       define READONLY
> +#   endif
> +
>  /*
>   * if its the old VAX C Compiler (not DEC C)
>   */
> 
> 
> When I enable it by adding the -fvisibility=hidden flag to gcc for a
> linux-
> x86_64 build I get quite a reduction in teh number of exported symbols
> (counted using 'nm -C -D | wc -l'):
> 
> Library               Original  Visibility
> -------               --------  ----------
> libca.so.3.15            1427         370
> libcas.so.3.15           1167         336
> libCom.so.3.15           1340         905
> libdbCore.so.3.15         974         692
> libdbRecStd.so.3.15       253         178
> libdbStaticHost.so.3.15   232         208
> libgdd.so.3.15            323         249
> 
> This looks like it would be a very worthwhile addition, except I'm getting
> a
> couple of build errors for the 3.15 branch, can you work out what needs
> decorating?
> 
> make[5]: Entering directory
> `/home/phoebus3/ANJ/epics/base/mirror-
> 3.15/src/ca/legacy/pcas/example/directoryService/O.linux-
> x86_64'
> /home/phoebus/ANJ/Linux64/bin/g++ -o caDirServ  -
> L/home/phoebus3/ANJ/epics/base/mirror-3.15/lib/linux-x86_64 -Wl,-
> rpath,/home/phoebus3/ANJ/epics/base/mirror-3.15/lib/linux-x86_64       -
> m64
> main.o directoryServer.o   -lcas -lca -lgdd -lCom
> directoryServer.o:(.rodata._ZTI15directoryServer[typeinfo for
> directoryServer]+0x10): undefined reference to `typeinfo for caServer'
> /home/phoebus3/ANJ/epics/base/mirror-3.15/lib/linux-x86_64/libcas.so:
> undefined reference to `typeinfo for fdReg'
> 
> I'm also not sure where to set the -fvisibility flag, because it's not
> supported before gcc 4.0 — I'll check with Janet, but ideas welcome...
> 
> - Andrew
> --
> Optimization is the process of taking something that works and
> replacing it with something that almost works, but costs less.
> -- Roger Needham



References:
gcc 4.x symbol visibility Andrew Johnson

Navigate by Date:
Prev: gcc 4.x symbol visibility Andrew Johnson
Next: Release Timetable for R3.14.12.2 Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: gcc 4.x symbol visibility Andrew Johnson
Next: Release Timetable for R3.14.12.2 Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·