Comment: | runtime: Make Amiga library work with -fbaserel
This currently uses __saveds on all exported functions for simplicity. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
482698c5beb3d3403cdf5f312bde33ac |
User & Date: | js on 2018-05-06 21:39:06 |
Other Links: | manifest | tags |
2018-05-11
| ||
17:59 | runtime: Support to open Amiga lib multiple times check-in: 2376865a0f user: js tags: trunk | |
2018-05-06
| ||
21:39 | runtime: Make Amiga library work with -fbaserel check-in: 482698c5be user: js tags: trunk | |
18:42 | runtime: Add ARC methods to headers and Amiga lib check-in: 3ed710dc03 user: js tags: trunk | |
Modified src/runtime/Makefile from [32b60048e1] to [846f7565d8].
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 | - - + + | -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR} AMIGA_LIB_CFLAGS += -DOBJC_COMPILING_AMIGA_LIBRARY LD = ${OBJC} FRAMEWORK_LIBS = ${LIBS} # For 68000, GCC emits calls to helper functions that expect a4 to be set. # Remove this once the library is using -fbaserel. |
Modified src/runtime/ObjFW_RT.h from [e761c23ace] to [18895befa5].
︙ | |||
341 342 343 344 345 346 347 | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | - + + | extern id _Nullable objc_retainAutoreleaseReturnValue(id _Nullable object); extern id _Nullable objc_retainAutoreleasedReturnValue(id _Nullable object); extern id _Nullable objc_storeStrong(id _Nullable *_Nonnull object, id _Nullable value); extern id _Nullable objc_storeWeak(id _Nullable *_Nonnull object, id _Nullable value); extern id _Nullable objc_loadWeakRetained(id _Nullable *_Nonnull object); |
Modified src/runtime/ObjFW_RT.sfd from [ea9196920a] to [eb7972f642].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + | ==base _ObjFWRTBase ==basetype struct Library * ==libname objfw_rt.library ==bias 30 ==public * Functions for the linklib |
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + | id _Nullable glue_objc_autorelease(id _Nullable object)(a0) id _Nullable glue_objc_autoreleaseReturnValue(id _Nullable object)(a0) id _Nullable glue_objc_retainAutoreleaseReturnValue(id _Nullable object)(a0) id _Nullable glue_objc_retainAutoreleasedReturnValue(id _Nullable object)(a0) id _Nullable glue_objc_storeStrong(id _Nullable *_Nonnull object, id _Nullable value)(a0/a1) id _Nullable glue_objc_storeWeak(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) id _Nullable glue_objc_loadWeakRetained(id _Nullable *_Nonnull object)(a0) |
︙ |
Modified src/runtime/amiga-glue.m from [25dbff61eb] to [3114ab4ae0].
︙ | |||
17 18 19 20 21 22 23 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + - - - + + - - - + + - - + - - - + + + - - + + - - + - - + - - + + - - + + - + - - + - + - - + | #include "config.h" #import "ObjFW_RT.h" #import "private.h" #import "macros.h" |
Modified src/runtime/amiga-library.m from [3eba26b1b7] to [7a454ada46].
︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | + + + - + + + + + + + + + + + + + + + + + + + + - + + - + + + | return -1; } struct ObjFWRTBase { struct Library library; void *seg_list; bool initialized; void *data_seg; struct objc_libc libc; }; extern uintptr_t __CTOR_LIST__[], __DTOR_LIST__[]; extern const void *_EH_FRAME_BEGINS__; extern void *_EH_FRAME_OBJECTS__; extern void *__a4_init; struct ExecBase *SysBase; #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif |
︙ | |||
97 98 99 100 101 102 103 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 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 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 | - + - + + - + - + - + + - + - - + + + - + + + - + + + - + + + - + + + - + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + | Remove(&base->library.lib_Node); FreeMem((char *)base - base->library.lib_NegSize, base->library.lib_NegSize + base->library.lib_PosSize); return seg_list; } |
︙ |
Modified src/runtime/arc.m from [82272ab977] to [de0851a9ba].
︙ | |||
266 267 268 269 270 271 272 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + | #ifdef OF_HAVE_THREADS if (!of_spinlock_unlock(&spinlock)) OBJC_ERROR("Failed to unlock spinlock!") #endif } |
︙ |
Modified src/runtime/class.m from [6fa07e9231] to [973ed6f5e5].
︙ | |||
412 413 414 415 416 417 418 | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | - + | } else cls->info |= OBJC_CLASS_INFO_LOADED; } process_load_queue(); } |
︙ | |||
448 449 450 451 452 453 454 | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | - + | metaclass->info = OBJC_CLASS_INFO_CLASS; metaclass->instance_size = (superclass != Nil ? superclass->isa->instance_size : 0) + (long)extra_bytes; return cls; } |
︙ | |||
525 526 527 528 529 530 531 | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | - + | Class objc_get_class(const char *name) { return objc_getRequiredClass(name); } |
︙ | |||
566 567 568 569 570 571 572 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + | } objc_global_mutex_unlock(); return j; } |
︙ | |||
590 591 592 593 594 595 596 | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | - + - + - + - + - + | *len = count; objc_global_mutex_unlock(); return ret; } |
︙ | |||
651 652 653 654 655 656 657 | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | - + | if (cls == Nil) return NULL; dummy.isa = cls; return objc_msg_lookup((id)&dummy, sel); } |
︙ | |||
719 720 721 722 723 724 725 | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | - + | ml->methods[0].imp = imp; cls->methodlist = ml; objc_update_dtable(cls); } |
︙ | |||
744 745 746 747 748 749 750 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | - + - + | if (cls->superclass != Nil) return class_getMethodTypeEncoding(cls->superclass, sel); return NULL; } |
︙ | |||
786 787 788 789 790 791 792 | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | - + - + - + | } objc_global_mutex_unlock(); return oldimp; } |
︙ |
Modified src/runtime/exception.m from [537d308f3a] to [2ef4db4bbd].
︙ | |||
756 757 758 759 760 761 762 | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | - + | if (_Unwind_RaiseException(&e->exception) == _URC_END_OF_STACK && uncaught_exception_handler != NULL) uncaught_exception_handler(object); OBJC_ERROR("_Unwind_RaiseException() returned!") } |
︙ |
Modified src/runtime/linklib/linklib.m from [478a2413e5] to [6215304d3d].
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - - + | ._Unwind_GetIP = _Unwind_GetIP, ._Unwind_GetGR = _Unwind_GetGR, ._Unwind_SetIP = _Unwind_SetIP, ._Unwind_SetGR = _Unwind_SetGR, ._Unwind_Resume = _Unwind_Resume, .__register_frame_info = __register_frame_info, .__deregister_frame_info = __deregister_frame_info, |
︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | + + | * When using the generated inline stubs, the compiler does not emit * any frame information, making the unwind fail. As unwind always * starts from objc_exception_throw(), this means exceptions would * never work. If, however, we're using a function pointer instead of * the inline stub, the compiler does generate a frame and everything * works fine. */ register void *a6 OBJC_M68K_REG("a6") = ObjFWRTBase; uintptr_t throw = (((uintptr_t)ObjFWRTBase) - 0x60); ((void (*)(id OBJC_M68K_REG("a0")))throw)(object); (void)a6; OF_UNREACHABLE } int objc_sync_enter(id object) { |
︙ | |||
224 225 226 227 228 229 230 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + - - + + + + + | * When using the generated inline stubs, the compiler does not emit * any frame information, making the unwind fail. As a result * objc_enumerationMutation() might throw an exception that could never * be caught. If, however, we're using a function pointer instead of * the inline stub, the compiler does generate a frame and everything * works fine. */ register void *a6 OBJC_M68K_REG("a6") = ObjFWRTBase; |
Modified src/runtime/lookup.m from [61e54bb565] to [2d11be3866].
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - + - + | IMP objc_method_not_found_stret(id obj, SEL sel) { return common_method_not_found(obj, sel, objc_msg_lookup_stret, forward_handler_stret); } |
︙ |
Modified src/runtime/misc.m from [938c4e7c92] to [ad6038421d].
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + | #include <stdlib.h> #include "ObjFW_RT.h" #include "private.h" static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL; |
︙ |
Modified src/runtime/private.h from [b79f584910] to [5f7c093a7a].
︙ | |||
154 155 156 157 158 159 160 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - - | uintptr_t (*_Unwind_GetIP)(void *_Nonnull); uintptr_t (*_Unwind_GetGR)(void *_Nonnull, int); void (*_Unwind_SetIP)(void *_Nonnull, uintptr_t); void (*_Unwind_SetGR)(void *_Nonnull, int, uintptr_t); void (*_Unwind_Resume)(void *); void (*__register_frame_info)(const void *, void *); void (*__deregister_frame_info)(const void *); |
︙ | |||
231 232 233 234 235 236 237 | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | + - + + + + + + | id _Nullable *_Nonnull object OBJC_M68K_REG("a0"), id _Nullable value OBJC_M68K_REG("a1")); extern id _Nullable glue_objc_storeWeak( id _Nullable *_Nonnull object OBJC_M68K_REG("a0"), id _Nullable value OBJC_M68K_REG("a1")); extern id _Nullable glue_objc_loadWeakRetained( id _Nullable *_Nonnull object OBJC_M68K_REG("a0")); extern id _Nullable glue_objc_initWeak( |
︙ |
Modified src/runtime/protocol.m from [17dd02bdde] to [35e4a9c6cb].
︙ | |||
21 22 23 24 25 26 27 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + - + - + - + | #import "ObjFW_RT.h" #import "private.h" @implementation Protocol @end |
︙ |
Modified src/runtime/selector.m from [7ee8175e8f] to [7ad9a1d734].
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + | static struct objc_hashtable *selectors = NULL; static uint32_t selectors_cnt = 0; static struct objc_sparsearray *selector_names = NULL; static void **free_list = NULL; static size_t free_list_cnt = 0; |
︙ | |||
111 112 113 114 115 116 117 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + - + | if (symtab->sel_refs == NULL) return; for (sel = symtab->sel_refs; sel->name != NULL; sel++) objc_register_selector(sel); } |
︙ |