public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/41681]  New: Feature request half way option between dynamic and static linking.
@ 2009-10-12 11:16 oiaohm at gmail dot com
  2009-10-12 12:49 ` [Bug lto/41681] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: oiaohm at gmail dot com @ 2009-10-12 11:16 UTC (permalink / raw)
  To: gcc-bugs

What brought this into my mind is this new feature in 2.5.0

"The new -static-libstdc++ option directs g++ to link the C++ library
statically, even if the default would normally be to link it dynamically."

What is need here is a half way.  If code is solvable static link that part but
if function is being include whole dynamic link.  So getting the memory saving
of dynamic and the speed advantages that static can offer.  Of course usable
with more libs than libstdc++.


-- 
           Summary: Feature request half way option between dynamic and
                    static linking.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oiaohm at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41681


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

* [Bug lto/41681] Feature request half way option between dynamic and static linking.
  2009-10-12 11:16 [Bug lto/41681] New: Feature request half way option between dynamic and static linking oiaohm at gmail dot com
@ 2009-10-12 12:49 ` rguenth at gcc dot gnu dot org
  2009-10-12 20:06 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-12 12:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-10-12 12:49 -------
I cannot parse what you are trying to say.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41681


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

* [Bug lto/41681] Feature request half way option between dynamic and static linking.
  2009-10-12 11:16 [Bug lto/41681] New: Feature request half way option between dynamic and static linking oiaohm at gmail dot com
  2009-10-12 12:49 ` [Bug lto/41681] " rguenth at gcc dot gnu dot org
@ 2009-10-12 20:06 ` pinskia at gcc dot gnu dot org
  2009-10-13  8:03 ` oiaohm at gmail dot com
  2009-10-13  9:46 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-12 20:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-10-12 20:06 -------
I don't understand what you are asking for either.  Static libraries and
dynamic libraries are usually two separate files (except under AIX) so it would
be hard to decide to do one or another.

Even if we figure that part out, what is the gain?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41681


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

* [Bug lto/41681] Feature request half way option between dynamic and static linking.
  2009-10-12 11:16 [Bug lto/41681] New: Feature request half way option between dynamic and static linking oiaohm at gmail dot com
  2009-10-12 12:49 ` [Bug lto/41681] " rguenth at gcc dot gnu dot org
  2009-10-12 20:06 ` pinskia at gcc dot gnu dot org
@ 2009-10-13  8:03 ` oiaohm at gmail dot com
  2009-10-13  9:46 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: oiaohm at gmail dot com @ 2009-10-13  8:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from oiaohm at gmail dot com  2009-10-13 08:03 -------
Currently for libstdc++ it must be either dynamic or static.  This separation
causes some problems.

There need to be two halfway points.  The static libs the dynamic both be
there.

Type one halfway is for secuirty reasons.  Having access to the bytecode lto of
like libstdc++ and others dynamic libs would allow deep scanning for code
defects like finding allocations of memory that don't get freed and buffer
overflows and others.   

To get this advantage lto needs know that the byte code assigned to dynamic
libs is not to integrated since the dynamic libs already contain those
functions.

The second would build on type one.  Optimizes would be allowed to look at the
lto code of the dynamic lib if functions can be optimized out it can be done. 
If not those functions done by dynamic linking.  

This is halfway between static and dynamic linking.  Pure dynamic compiler does
not know what is inside the .so or .dll files other than the function
interfaces.

Doing this does raise the question if dynamic and static linking files should
be two different things or should they be basically the same.  Static be lto
bytecode.  Dynamic be precomplied + the same static lto bytecode.

Allowing full static analyzation inside compiler would be a major gain to
secuirty.

lto closes down cross object flaws from being seen from the compiler.  But it
still leaves cross library flaws in dynamic that don't exist when static
linking with lto.  Reason static linking with lto all bytecode data can be seen
even inside the libraries.

Lets provide an option to close the flaw.   Being able to staticly solve out
with at .so lto bytecode in a lot of cases would give the same results as using
the static .a lto bytecode file.

Halfway could be used to remove duplication of lto bytecode to do either static
or highly audited dynamic linking.  1 copy to do both.


-- 

oiaohm at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41681


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

* [Bug lto/41681] Feature request half way option between dynamic and static linking.
  2009-10-12 11:16 [Bug lto/41681] New: Feature request half way option between dynamic and static linking oiaohm at gmail dot com
                   ` (2 preceding siblings ...)
  2009-10-13  8:03 ` oiaohm at gmail dot com
@ 2009-10-13  9:46 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-13  9:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-10-13 09:46 -------
So your half-way would be only useful for static analysis, but not for any
optimization decision.  Consider a function currently being

void doIt() {}

in the shared library.  Now, if GCC sees the body it can deduce that calls
to it are useless and it will DCE them.  Next, the shared library
implementation
changes to

void doIt() { printf("Hello"); }

which is perfectly valid.  Thus, GCC has miscompiled the program.

So - it's not going to work in any way that will give extra information
to GCC.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41681


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

end of thread, other threads:[~2009-10-13  9:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 11:16 [Bug lto/41681] New: Feature request half way option between dynamic and static linking oiaohm at gmail dot com
2009-10-12 12:49 ` [Bug lto/41681] " rguenth at gcc dot gnu dot org
2009-10-12 20:06 ` pinskia at gcc dot gnu dot org
2009-10-13  8:03 ` oiaohm at gmail dot com
2009-10-13  9:46 ` rguenth at gcc dot gnu dot 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).