Overview
Comment: | Add of_init() for Amiga .library |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | amiga-library |
Files: | files | file ages | folders |
SHA3-256: |
964b5ed33ce5b1768bda64371ff7aa17 |
User & Date: | js on 2020-06-05 00:17:28 |
Other Links: | branch diff | manifest | tags |
Context
2020-06-05
| ||
00:24 | configure: Move substitution of LINKLIB to later check-in: 08f61f1f18 user: js tags: amiga-library | |
00:17 | Add of_init() for Amiga .library check-in: 964b5ed33c user: js tags: amiga-library | |
2020-06-04
| ||
23:01 | Add initial amiga-{library,glue,end}.m check-in: f6ab72da6e user: js tags: amiga-library | |
Changes
Modified src/Makefile from [828f08c474] to [e3eb469528].
︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 | - + + | -DOBJFW_LIB_MINOR=${OBJFW_LIB_MINOR} AMIGA_LIB_CFLAGS += -DOF_COMPILING_AMIGA_LIBRARY LD = ${OBJC} FRAMEWORK_LIBS := -Fruntime \ ${RUNTIME_FRAMEWORK_LIBS} \ ${REEXPORT_RUNTIME_FRAMEWORK} \ ${LIBS} |
Modified src/amiga-glue.m from [96aff37bed] to [41b93239bf].
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + - + - - - - + + + + + + + + + + | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "amiga-library.h" #import "platform.h" #ifdef OF_AMIGAOS_M68K # define PPC_PARAMS(...) (void) |
Added src/amiga-library.h version [687493e4ca].
|
Modified src/amiga-library.m from [a7df8eae66] to [f8b63aa6c0].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - - + + + | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" |
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + + + + | #ifdef OF_AMIGAOS_M68K extern uintptr_t __CTOR_LIST__[]; extern const void *_EH_FRAME_BEGINS__; extern void *_EH_FRAME_OBJECTS__; #endif extern bool glue_of_init(void); #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; struct of_libc libc; FILE *stderr; #if defined(OF_AMIGAOS_M68K) __asm__ ( ".text\n" ".globl ___restore_a4\n" ".align 1\n" "___restore_a4:\n" |
︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } static void * lib_null(void) { return NULL; } bool of_init(unsigned int version, struct of_libc *libc_, FILE *stderr_) { #ifdef OF_AMIGAOS_M68K OF_M68K_ARG(struct ObjFWBase *, base, a6) #else register struct ObjFWBase *r12 __asm__("r12"); struct ObjFWBase *base = r12; #endif uintptr_t *iter, *iter0; if (version > 1) return false; if (base->initialized) return true; memcpy(&libc, libc_, sizeof(libc)); stderr = stderr_; #ifdef OF_AMIGAOS_M68K if ((size_t)_EH_FRAME_BEGINS__ != (size_t)_EH_FRAME_OBJECTS__) return false; for (size_t i = 1; i <= (size_t)_EH_FRAME_BEGINS__; i++) libc.__register_frame_info((&_EH_FRAME_BEGINS__)[i], (&_EH_FRAME_OBJECTS__)[i]); iter0 = &__CTOR_LIST__[1]; #elif defined(OF_MORPHOS) __asm__ ( "lis %0, ctors+4@ha\n\t" "la %0, ctors+4@l(%0)\n\t" : "=r"(iter0) ); #endif for (iter = iter0; *iter != 0; iter++); while (iter > iter0) { void (*ctor)(void) = (void (*)(void))*--iter; ctor(); } base->initialized = true; return true; } void * malloc(size_t size) { return libc.malloc(size); } void * calloc(size_t count, size_t size) { return libc.calloc(count, size); } void * realloc(void *ptr, size_t size) { return libc.realloc(ptr, size); } void free(void *ptr) { libc.free(ptr); } int fprintf(FILE *restrict stream, const char *restrict fmt, ...) { int ret; va_list args; va_start(args, fmt); ret = libc.vfprintf(stream, fmt, args); va_end(args); return ret; } int vsnprintf(char *restrict str, size_t size, const char *restrict fmt, va_list args) { return libc.vsnprintf(str, size, fmt, args); } void exit(int status) { libc.exit(status); OF_UNREACHABLE } void abort(void) { libc.abort(); OF_UNREACHABLE } char * setlocale(int category, const char *locale) { return libc.setlocale(category, locale); } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" static CONST_APTR functionTable[] = { #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_BEGIN, (CONST_APTR)FUNCARRAY_32BIT_NATIVE, #endif (CONST_APTR)lib_open, (CONST_APTR)lib_close, (CONST_APTR)lib_expunge, (CONST_APTR)lib_null, #ifdef OF_MORPHOS (CONST_APTR)-1, (CONST_APTR)FUNCARRAY_32BIT_SYSTEMV, #endif (CONST_APTR)glue_of_init, #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_END #endif }; #pragma GCC diagnostic pop static struct { |
︙ |
Modified src/macros.h from [f9a566d40b] to [af30b6d7a6].
︙ | |||
314 315 316 317 318 319 320 321 322 323 324 325 326 327 | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | + + | # include <ppcinline/macros.h> # define OF_M68K_ARG(type, name, reg) type name = (type)REG_##reg; # else # define OF_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; # endif # undef stderr extern FILE *stderr; #endif #ifdef __GNUC__ # ifdef OF_X86_64 # define OF_X86_64_ASM # endif # ifdef OF_X86 |
︙ |
Modified src/runtime/amiga-library.m from [e1cb0d467e] to [6c73132350].
︙ | |||
149 150 151 152 153 154 155 | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - + - | extern void glue_objc_hashtable_free(void); #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; struct objc_libc libc; |
︙ | |||
403 404 405 406 407 408 409 410 411 412 413 414 415 416 | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | + + + | register struct ObjFWRTBase *r12 __asm__("r12"); struct ObjFWRTBase *base = r12; #endif uintptr_t *iter, *iter0; if (version > 1) return false; if (base->initialized) return true; memcpy(&libc, libc_, sizeof(libc)); stdout = stdout_; stderr = stderr_; #ifdef OF_AMIGAOS_M68K if ((size_t)_EH_FRAME_BEGINS__ != (size_t)_EH_FRAME_OBJECTS__) |
︙ |
Modified src/runtime/private.h from [82de8c2339] to [af37708bbd].
︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | - + + | #if defined(OBJC_COMPILING_AMIGA_LIBRARY) || \ defined(OBJC_COMPILING_AMIGA_LINKLIB) struct objc_libc { void *_Nullable (*_Nonnull malloc)(size_t); void *_Nullable (*_Nonnull calloc)(size_t, size_t); void *_Nullable (*_Nonnull realloc)(void *_Nullable, size_t); void (*_Nonnull free)(void *_Nullable); |
︙ |