Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-09

How to sent totally custom parameters to the linker ?

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

fredvs

Hello.

Is it possible to sent new-other parameters to the linker ? Without the use of *-k*<some_paramter>, fpc sent this to the linker:

[5.227] (9017) Using util /usr/bin/ld
[5.227] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-6 4.so.2 -s -L. -o ./test ./link.res"

Using the *-k* parameter, this is sent (with *-ksomething -kotherting*):

[5.224] (9017) Using util /usr/bin/ld
[5.224] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *something* *otherthing* --dynamic-linker= /lib64/ld-linux-x86-64.so.2 -s -L. -o ./test ./link.res"

You may see that the parameters "something" "otherthing" are inserted afterelf_x86_64.

But how to sent totally custom parameters, without those given by fpc ?

Thanks.

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/How-to-sent-totally-custom-parameters-to-the-linker-tp5726266.html Sent from the Free Pascal - General mailing list .

Reply by email

Andrew Haines
to fredvs
fredvs wrote 23 lines
Hello. Is it possible to sent new-other parameters to the linker ? Without the use of *-k*<some_paramter>, fpc sent this to the linker: [5.227] (9017) Using util /usr/bin/ld [5.227] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-6 4.so.2 -s -L. -o ./test ./link.res" Using the *-k* parameter, this is sent (with *-ksomething -kotherting*): [5.224] (9017) Using util /usr/bin/ld [5.224] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *something* *otherthing* --dynamic-linker= /lib64/ld-linux-x86-64.so.2 -s -L. -o ./test ./link.res" You may see that the parameters "something" "otherthing" are inserted afterelf_x86_64. But how to sent totally custom parameters, without those given by fpc ?

If you use -s the compiler will not link your program but leave a script "ppas.sh" that you can edit and run manually to assemble and link your program. Also it leaves a link.res file that if you really want to you can edit.

Regards,

Andrew

Reply by email

Mark Morgan Lloyd
to fredvs: Hello. Is it possible to sent new-other parameters to the linker ? Without the use of…
fredvs wrote 21 lines
Hello. Is it possible to sent new-other parameters to the linker ? Without the use of *-k*<some_paramter>, fpc sent this to the linker: [5.227] (9017) Using util /usr/bin/ld [5.227] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-6 4.so.2 -s -L. -o ./test ./link.res" Using the *-k* parameter, this is sent (with *-ksomething -kotherting*): [5.224] (9017) Using util /usr/bin/ld [5.224] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *something* *otherthing* --dynamic-linker= /lib64/ld-linux-x86-64.so.2 -s -L. -o ./test ./link.res" You may see that the parameters "something" "otherthing" are inserted afterelf_x86_64. But how to sent totally custom parameters, without those given by fpc ?

I've had no problem with e.g.

export OPT='-k-t -k--reduce-memory-overheads -k--no-keep-memory'

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

fredvs
to Andrew Haines: If you use -s the compiler will not link your program but leave a script "ppas.sh" that…

Andrew Haines wrote

Show quoted text 36 lines
On 09/05/2016 07:27 PM, fredvs wrote: > Hello. > > Is it possible to sent new-other parameters to the linker ? > Without the use of *-k* <some_paramter> , fpc sent this to the linker: > > [5.227] (9017) Using util /usr/bin/ld > [5.227] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m > elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-6 > 4.so.2 -s -L. -o ./test ./link.res" > > Using the *-k* parameter, this is sent (with *-ksomething -kotherting*): > > [5.224] (9017) Using util /usr/bin/ld > [5.224] Executing "/usr/bin/ld" with command line "-b elf64-x86-64 -m > elf_x86_64 *something* *otherthing* --dynamic-linker= > /lib64/ld-linux-x86-64.so.2 -s -L. -o ./test ./link.res" > > You may see that the parameters "something" "otherthing" are inserted > afterelf_x86_64. > > But how to sent totally custom parameters, without those given by fpc ? > > If you use -s the compiler will not link your program but leave a script "ppas.sh" that you can edit and run manually to assemble and link your program. Also it leaves a link.res file that if you really want to you can edit. Regards, Andrew __________________________

Excellent, it is even better that my wishes.

Many thanks Andrew.

Fre;D

-----
Many thanks ;-)

Reply by email

fredvs
to Mark Morgan Lloyd: I've had no problem with e.g. export OPT='-k-t -k--reduce-memory-overheads…
I've had no problem with e.g. export OPT='-k-t -k--reduce-memory-overheads -k--no-keep-memory'

Ha, I will try this one too.

Thanks Mark.

Fre;D

-----
Many thanks ;-)

Reply by email

Mark Morgan Lloyd
to fredvs
fredvs wrote
> I've had no problem with e.g. > export OPT='-k-t -k--reduce-memory-overheads -k--no-keep-memory' Ha, I will try this one too.

For completeness, I've re-read your OP several times and there could be a problem inserting options in a /specific/ /place/ in the ld command line (i.e. immediately before the new/output file), should this be required.

In this case I think the only realistic thing to do would be to use Andrew's suggestion of intercepting ppas.sh, anything else is venturing into Jonas territory :-)

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email