Comments (4)
Another point of difference is in how char parameters are push onto the stack. sdcc will push one byte for each char whereas sccz80 will push a word.
from z88dk.
Just thinking out loud: could we add attributes to function entry points and change the linker to search a matching function name and function attributes? This would require changes in the compilers and assembler, to pass the attributes to the object file, and in the linker to search for a matching function.
from z88dk.
A simpler variation on that is to get the preprocessor to substitute different names for function entry points depending on which compiler is running:
#ifdef __SDCC
#define strcpy sdcc_strcpy
#endif
#ifdef __SCCZ80
#define strcpy sccz80_strcpy
#endif
Then have C entry points for each that collect parameters and then jump into the common asm implementation.
So the compiler and attributes get encoded in the name rather than having to modify any of the toolchain.
from z88dk.
A note regarding function renaming for zsdcc. sdcc will inline a handful of string functions:
#ifndef __SDCC_DISABLE_BUILTIN
#undef memcpy
#undef strcpy
#undef strncpy
#undef strchr
#undef memset#define memcpy(dst, src, n) __builtin_memcpy(dst, src, n)
#define strcpy(dst, src) __builtin_strcpy(dst, src)
#define strncpy(dst, src, n) __builtin_strncpy(dst, src, n)
#define strchr(s, c) __builtin_strchr(s, c)
#define memset(dst, c, n) __builtin_memset(dst, c, n)#endif
This replaces the macro magic we use for fastcall/callee linkage in favour of selecting sdcc's built-ins for these functions. In practice, sdcc's inlining of these functions are a big win in terms of speed.
Sometimes sdcc is unable to inline these functions and instead the compiler will insert a call to the c library's implementation. However, this insertion happens after the preprocessor has already run so we do not get callee/fastcall linkage selected as we would want.
Instead, this case is caught by copt in post-processing along with the other calls that sdcc makes to its support functions.
If we adopt naming as suggested in the last post, the case of built-ins must be kept in mind.
from z88dk.
Related Issues (20)
- Link .map files from other builds instead of clib/startup/crt0? HOT 2
- zcc does not process defc files via -g option
- Wav generation issue + potential solution HOT 14
- `libsrc` build system prone to bricking when interrupted HOT 2
- Any type of file IO causes errors with submit.com HOT 15
- (z80asm) wrong representation of 0.0 in -float=zx81
- fwrite hangs depending on buffer size. HOT 5
- Declaring prototype for interrupt handler breaks the handler
- (z80asm) Parse1.c compilation issue for m68k HOT 1
- Far memory support for MSX HOT 11
- [appmake][c128] Capital/Small generated file names HOT 12
- [snap][bug?] How to install the latest z88dk under Ubuntu 21.10? HOT 4
- Compiler and linker hints mess with Eclipse and probably other IDEs HOT 5
- [feature request][devcontainer] No install option HOT 3
- Docker images should be tagged HOT 10
- (z80asm) test fails in SNAPcraft HOT 1
- Merging the lib3d.lib into gfx HOT 16
- Support Tandy-Emeritus
- (z80asm) Pseudo instructions causing trouble HOT 3
- (sccz80) Const initialisation issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from z88dk.