English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 01 October 2019, 18:56   #21
Hedeon
Semi-Retired
 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 1,993
Nice! Thanks for the help!
Hedeon is offline  
Old 03 October 2023, 00:28   #22
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
Quote:
Originally Posted by phx View Post
Hmmm... yes. The reason is in the linker libraries, not in your code. Even if you compile with -sc and -sd and link with -lvcs, the vcs.lib itself was only compiled with -sd, but not with -sc. So all calls from the vcs.lib are absolute.

I wonder if I should change that for the upcoming release. When you link with a small-data library, does it make sense to always have small-code as well? Probably.
Would it also be possible to have it automatically link with a small-code link library when compiling only with -sc?

A somewhat unorthodox idea maybe, but would it be feasible to compile the link library on the fly with the same options as the code?
patrik is offline  
Old 03 October 2023, 01:30   #23
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by patrik View Post
Would it also be possible to have it automatically link with a small-code link library when compiling only with -sc?
Theoretically, yes.
The problem I have is that I do not like to compile libraries for all combinations of -sc and -sd.

Quote:
A somewhat unorthodox idea maybe, but would it be feasible to compile the link library on the fly with the same options as the code?
You mean, that the linker patches all absolute jumps with relative ones (or branches)? Not impossible. But you would probably like relative jumps to be two bytes smaller, and moving code is something the linker cannot easily do.

What I could imagine is to compile all small-data libraries with -sc, and whenever the distance becomes too large the linker might generate ALVs (automatic link vectors - adding absolute JMP instructions at the object unit's section borders).

I wanted to add ALVs to vlink long ago, but never really needed them. So this would be a reason...
phx is offline  
Old 04 October 2023, 01:10   #24
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
Quote:
Originally Posted by phx View Post
Theoretically, yes.
The problem I have is that I do not like to compile libraries for all combinations of -sc and -sd.
I see the point, but I do wish .

Quote:
Originally Posted by phx View Post
You mean, that the linker patches all absolute jumps with relative ones (or branches)? Not impossible. But you would probably like relative jumps to be two bytes smaller, and moving code is something the linker cannot easily do
My idea was way more crude and as said unorthodox: vbcc would also ask vasm (?) to compile the linker library from source with the options used and pass that result along to the linker to link with

Quote:
Originally Posted by phx View Post
What I could imagine is to compile all small-data libraries with -sc, and whenever the distance becomes too large the linker might generate ALVs (automatic link vectors - adding absolute JMP instructions at the object unit's section borders).

I wanted to add ALVs to vlink long ago, but never really needed them. So this would be a reason...
patrik is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc code generation and dbf Asman Coders. C/C++ 15 12 March 2016 01:51
How to pass data to interrupt handler with VBCC? strim Coders. System 3 18 January 2016 14:38
Debugging vbcc code tolkien Coders. C/C++ 5 14 February 2015 06:45
VBCC code generation Asman Coders. C/C++ 9 17 August 2014 09:33
Mixed 68k / PPC code on VBCC. Cowcat Coders. General 10 01 August 2013 16:01

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:09.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07015 seconds with 15 queries