Size of program vs library ?

classic Classic list List threaded Threaded
41 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Maciej Izak

2017-05-16 10:15 GMT+02:00 fredvs <[hidden email]>:
It works for all situations, so I propose that fpc add --gc-sections as
parameter for the linker if the user has used -XX parameter to compile a
library.

for features requests please useĀ https://bugs.freepascal.org .

--
Best regards,
Maciej Izak

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
Maciej Izak wrote
2017-05-16 10:15 GMT+02:00 fredvs <[hidden email]>:

> It works for all situations, so I propose that fpc add --gc-sections as
> parameter for the linker if the user has used -XX parameter to compile a
> library.
>

for features requests please use https://bugs.freepascal.org .

--
Best regards,
Maciej Izak

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Thanks but before to ask for that (essential) feature: ---> advices, ideas, warnings are welcome.

Also, as you can see, it is important to be sure that the request is perfectly understood (and, sorry, but I have lot of doubt about this).

Fre;D

Fre;D

Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt


On Tue, 16 May 2017, fredvs wrote:

> Maciej Izak wrote
>> 2017-05-16 10:15 GMT+02:00 fredvs &lt;
>
>> fiens@
>
>> &gt;:
>>
>>> It works for all situations, so I propose that fpc add --gc-sections as
>>> parameter for the linker if the user has used -XX parameter to compile a
>>> library.
>>>
>>
>> for features requests please use https://bugs.freepascal.org .
>>
>> --
>> Best regards,
>> Maciej Izak
>>
>> _______________________________________________
>> fpc-pascal maillist  -
>
>> fpc-pascal@.freepascal
>
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
> Thanks but before to ask for that (essential) feature: ---> advices, ideas,
> warnings are welcome.
>
> Also, as you can see, it is important to be sure that the request is
> perfectly understood (and, sorry, but I have lot of doubt about this).

And why is that ?

What can be misunderstood about adding --gc-sections to the linker
options if -XX is used on the command-line ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Henry Vermaak
In reply to this post by fredvs
On Tue, May 16, 2017 at 01:15:34AM -0700, fredvs wrote:
> It works for all situations, so I propose that fpc add --gc-sections
> as parameter for the linker if the user has used -XX parameter to
> compile a library.

Does it work for all situations?  I remember a bug for the rust compiler
that broke libraries when --gc-sections was used, because it removed the
metadata that rust needed to load the library.  One of the fpc devs can
probably say whether fpc may have a similar problem.

I know with gcc you will need -ffunction-sections and -fdata-sections if
you want --gc-sections to do anything, and there are warnings attached
to those (see the gcc man page).

Henry
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt


On Tue, 16 May 2017, Henry Vermaak wrote:

> On Tue, May 16, 2017 at 01:15:34AM -0700, fredvs wrote:
>> It works for all situations, so I propose that fpc add --gc-sections
>> as parameter for the linker if the user has used -XX parameter to
>> compile a library.
>
> Does it work for all situations?  I remember a bug for the rust compiler
> that broke libraries when --gc-sections was used, because it removed the
> metadata that rust needed to load the library.  One of the fpc devs can
> probably say whether fpc may have a similar problem.

You risk losing e.g. resources.
This is typically what needs to be investigated.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Marco van de Voort
In reply to this post by fredvs
In our previous episode, fredvs said:
> Nobody uses fpc library here ?

Yes, but I don't care about size unless it is outrageous.
 
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
In reply to this post by Michael Van Canneyt
Michael Van Canneyt wrote
What can be misunderstood about adding --gc-sections to the linker
options if -XX is used on the command-line ?
Ha, the way you present it seems to show that you did understand it ;-)

OK, maybe is it time to add a feature request...

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Marco van de Voort
In reply to this post by Michael Van Canneyt
In our previous episode, Michael Van Canneyt said:
> > Does it work for all situations?  I remember a bug for the rust compiler
> > that broke libraries when --gc-sections was used, because it removed the
> > metadata that rust needed to load the library.  One of the fpc devs can
> > probably say whether fpc may have a similar problem.
>
> You risk losing e.g. resources.
> This is typically what needs to be investigated.

That also goes for the main application. Such sections should be marked with
KEEP() in the linker script.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt
In reply to this post by fredvs


On Tue, 16 May 2017, fredvs wrote:

> Michael Van Canneyt wrote
>> What can be misunderstood about adding --gc-sections to the linker
>> options if -XX is used on the command-line ?
>
> Ha, the way you present it seems to show that you did understand it ;-)
>
> OK, maybe is it time to add a feature request...

Before filing a request, you can already check yourself what happens with
form data if you compile a lazarus form into the library.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
Michael Van Canneyt wrote
On Tue, 16 May 2017, fredvs wrote:

> Michael Van Canneyt wrote
>> What can be misunderstood about adding --gc-sections to the linker
>> options if -XX is used on the command-line ?
>
> Ha, the way you present it seems to show that you did understand it ;-)
>
> OK, maybe is it time to add a feature request...

Before filing a request, you can already check yourself what happens with
form data if you compile a lazarus form into the library.

Michael.
Huh, with all the respect that I have for LCL, I was never able to compile a Lazarus form into library (even without --gc-sections or -XX) .
On the other side, with forms from fpGUI or MSEgui, no form data loosed while compiling forms into library with --gc-sections.

PS: Re-huh, the libraries that I compile do not store form-data (even no data at all).

Fre;D


Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
In reply to this post by Marco van de Voort
Marco van de Voort wrote
In our previous episode, Michael Van Canneyt said:
> > Does it work for all situations?  I remember a bug for the rust compiler
> > that broke libraries when --gc-sections was used, because it removed the
> > metadata that rust needed to load the library.  One of the fpc devs can
> > probably say whether fpc may have a similar problem.
>
> You risk losing e.g. resources.
> This is typically what needs to be investigated.

That also goes for the main application. Such sections should be marked with
KEEP() in the linker script.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Yes and it is valable too for programs compiled with -XX.

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt
In reply to this post by fredvs


On Tue, 16 May 2017, fredvs wrote:

> Michael Van Canneyt wrote
>> On Tue, 16 May 2017, fredvs wrote:
>>
>>> Michael Van Canneyt wrote
>>>> What can be misunderstood about adding --gc-sections to the linker
>>>> options if -XX is used on the command-line ?
>>>
>>> Ha, the way you present it seems to show that you did understand it ;-)
>>>
>>> OK, maybe is it time to add a feature request...
>>
>> Before filing a request, you can already check yourself what happens with
>> form data if you compile a lazarus form into the library.
>>
>> Michael.
>
> Huh, with all the respect that I have for LCL, I was never able to compile a
> Lazarus form into library (even without --gc-sections or -XX) .
> On the other side, with forms from fpGUI or MSEgui, no form data loosed
> while compiling forms into library with --gc-sections.

As far as I know, they don't use FPC resources for this ?

>
> PS: Re-huh, the libraries that I compile do not store form-data (even no
> data at all).

Possibly, but this is something that must be checked before implementing
such an option...

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

noreply
In reply to this post by fredvs
On 2017-05-16 03:15, fredvs wrote:

> noreply wrote
>> On 2017-05-15 04:26, fredvs wrote:
>>> After lot of fight, there is a solution: using -*-gc-sections*.
>>>
>>> And the question was :
>>>
>>> /Why FPC does not provide --gc-sections to the linker with the -XX
>>> paramer
>>> for libraries ? (Bug ?) /
>>
>>
>> Hopefully that's all there is to it, but how do you know that this
>> doesn't just work for your current code and is not reliable for all
>> situations?
>>
>> If that's all there is too it, that's cool! But maybe fpc left it out
>> for a reason: like it only works in some test cases of libraries, but
>> not all test cases?
>> _______________________________________________
>> fpc-pascal maillist  -
>
>> fpc-pascal@.freepascal
>
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
> It works for all situations, so I propose that fpc add --gc-sections as
> parameter for the linker if the user has used -XX parameter to compile
> a
> library.
>
> Fre;D

Okay hold on. All situations.
Either you are a serious Edsgar Dijkstra fan, and you have proven it to
be correct (unlikely) or you have all the test cases of the entire
universe and are a unit testing nutcase..
All the chess board peices and positions on the game board have all been
tested in all situations...
No..

But, seriously... if it works in many many many situations I guess that
is "good enough"
:-)
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

noreply
In reply to this post by fredvs
On 2017-05-16 09:20, fredvs wrote:

> Michael Van Canneyt wrote
>> On Tue, 16 May 2017, fredvs wrote:
>>
>>> Michael Van Canneyt wrote
>>>> What can be misunderstood about adding --gc-sections to the linker
>>>> options if -XX is used on the command-line ?
>>>
>>> Ha, the way you present it seems to show that you did understand it
>>> ;-)
>>>
>>> OK, maybe is it time to add a feature request...
>>
>> Before filing a request, you can already check yourself what happens
>> with
>> form data if you compile a lazarus form into the library.
>>
>> Michael.
>
> Huh, with all the respect that I have for LCL, I was never able to
> compile a
> Lazarus form into library

Hrm... I think way back I was able to compile a lcl form into a library,
as a plugin for lazarusrb, but, had issues with showmessage requiring
two mouse clicks instead of one click to close it, or some strange
behaviors..

But it was such a long time ago that I forgot. Some strange message loop
issues AFAIR
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
In reply to this post by Michael Van Canneyt
Hello.

OK, I see that fpc team is afraid to change something that mom-Delphi did not do.

So, to resume, for people who wants to smartlink their libraries, you may use this command:

fpc -k--gc-sections my_smartlinked_library.pas

Fre;D

Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Maciej Izak

2017-05-17 13:32 GMT+02:00 fredvs <[hidden email]>:

OK, I see that fpc team is afraid to change something that mom-Delphi did
not do.

You don't know that. Lack of bug report / feature request on mantis, means that the feature request doesn't exist in any formal way. Sometimes is good to have reported thing like this on bugtracker for documentation purposes (even if finally will be rejected).

--
Best regards,
Maciej Izak

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt
In reply to this post by fredvs


On Wed, 17 May 2017, fredvs wrote:

> Hello.
>
> OK, I see that fpc team is afraid to change something that mom-Delphi did
> not do.

This is simply not correct and a *very* unfair statement on your part.
Mails like this will really not get you anywhere.

1. You didn't even file an official request in the bugtracker ?

2. Where did we say we would not do this ? We're just careful, since the
effect is not known.

3. You didn't even test the resources thing. It means we will need to test this.
   This takes time, and the issue is not considered very important, so this time
   is indeed not spent right away.

4. Delphi doesn't use GNU ld, so this comparison is totally without basis.

With this mail, you're simply behaving like a small girl that didn't get her
ice cream right away...

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
Michael Van Canneyt wrote
On Wed, 17 May 2017, fredvs wrote:

> Hello.
>
> OK, I see that fpc team is afraid to change something that mom-Delphi did
> not do.

This is simply not correct and a *very* unfair statement on your part.
Mails like this will really not get you anywhere.
Yes, I now. I know also that if you do not speak hot, people does not listen.
By the way, I sent advices about size of fpc libraries more than 10 years ago.
A lot of "work in progress" as answers but nothing change.

A other thing that I discover: it is extremely sensible to talk about linkers.
In FreeBSD forum, I was insulted because I reveal that their linker (GNU ld) was not compatible with FreeBSD multi-arch design.

But, IMHO, if fpc uses a external linker, it is also part of the compilation process.
And each feature of the linker should be analyzed.

Michael Van Canneyt wrote
 You didn't even file an official request in the bugtracker ?
Because I tried already and because I know the (rejected) answer.

Michael Van Canneyt wrote
You didn't even test the resources thing. It means we will need to test this.
   This takes time, and the issue is not considered very important, so this time
   is indeed not spent right away.
Of course I tested it, why do you write this ?

Michael Van Canneyt wrote
With this mail, you're simply behaving like a small girl that didn't get her
ice cream right away...
Ha, so you do not know me.
If I do not get my ice cream, I am much more unbearable.

Fre;D
 


Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

Michael Van Canneyt


On Wed, 17 May 2017, fredvs wrote:

> But, IMHO, if fpc uses a external linker, it is also part of the compilation
> process. And each feature of the linker should be analyzed.

We are agreed on that.

> Michael Van Canneyt wrote
>>  You didn't even file an official request in the bugtracker ?
>
> Because I tried already and because I know the (rejected) answer.

Where is this bugreport ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Size of program vs library ?

fredvs
Michael Van Canneyt wrote
>>  You didn't even file an official request in the bugtracker ?
>
> Because I tried already and because I know the (rejected) answer.

Where is this bugreport ?
I was talking about earlier other requests.

But now, if you think that the request has a little chance to be considered, I will sent a bugreport with great pleasure,

Fre;D
Many thanks ;-)
123