Changeset 96368 in vbox for trunk/include/iprt
- Timestamp:
- Aug 19, 2022 10:55:36 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asmdefs.mac
r96277 r96368 502 502 503 503 ;; 504 ; Global marker which is DECLASM() compatible.504 ; Same as GLOBALNAME_EX, but without the name mangling. 505 505 ; 506 506 ; @param %1 The symbol name - subjected to NAME(). … … 514 514 ; Ignored by other formats. 515 515 ; 516 %macro GLOBALNAME_ EX3516 %macro GLOBALNAME_RAW 3 517 517 %ifdef ASM_FORMAT_ELF 518 global NAME(%1):%2 %3518 global %1:%2 %3 519 519 520 520 %elifdef ASM_FORMAT_PE 521 521 %ifidn %2,function 522 522 %ifdef __YASM__ ; nasm does not support any attributes, it errors out. So, nasm is no good with control flow guard atm. 523 global NAME(%1):function523 global %1:function 524 524 %else 525 global NAME(%1)526 %endif 527 %else 528 global NAME(%1)525 global %1 526 %endif 527 %else 528 global %1 529 529 %endif 530 530 531 531 %elifdef ASM_FORMAT_MACHO 532 532 %ifidn %3,hidden 533 global NAME(%1):private_extern534 %else 535 global NAME(%1)533 global %1:private_extern 534 %else 535 global %1 536 536 %endif 537 537 538 538 %elifndef ASM_FORMAT_BIN 539 global NAME(%1)540 541 %endif 542 543 NAME(%1):544 %endmacro 545 546 ;; 547 ; Global exportedmarker which is DECLASM() compatible.539 global %1 540 541 %endif 542 543 %1: 544 %endmacro 545 546 ;; 547 ; Global marker which is DECLASM() compatible. 548 548 ; 549 549 ; @param %1 The symbol name - subjected to NAME(). … … 551 551 ; PE ignores all but 'function' (yasm only). Other formats ignores 552 552 ; this completely. 553 ; 554 %macro EXPORTEDNAME_EX 2 553 ; @param %3 Symbol visibility: 'hidden', 'protected', 'internal', and 554 ; RT_NOTHING (for 'default' visibility). 555 ; These are ELF attributes, but 'hidden' is translated to 556 ; 'private_extern' for the Macho-O format. 557 ; Ignored by other formats. 558 ; 559 %macro GLOBALNAME_EX 3 560 GLOBALNAME_RAW NAME(%1), %2, %3 561 %endmacro 562 563 564 ;; 565 ; Global exported marker, raw version w/o automatic name mangling. 566 ; 567 ; @param %1 The internal symbol name. 568 ; @param %2 The external symbol name. 569 ; @param %3 ELF and PE attributes: 'function', 'object', 'data', 'notype'. 570 ; PE ignores all but 'function' (yasm only). Other formats ignores 571 ; this completely. 572 ; 573 %macro EXPORTEDNAME_RAW 3 555 574 %ifdef ASM_FORMAT_PE 556 export % 1=NAME(%1)575 export %2=%1 557 576 %endif 558 577 %ifdef __NASM__ 559 578 %ifdef ASM_FORMAT_OMF 560 export NAME(%1) NAME(%1) 561 %endif 562 %endif 563 GLOBALNAME_EX %1, %2, RT_NOTHING 564 %endmacro 565 566 ;; 567 ; Begins a C callable procedure. 568 %macro BEGINPROC 1 579 export %1 %2 580 %endif 581 %endif 582 GLOBALNAME_RAW %1, %3, RT_NOTHING 583 %endmacro 584 585 ;; 586 ; Global exported marker which is DECLASM() compatible. 587 ; 588 ; @param %1 The symbol name - subjected to NAME(). 589 ; @param %2 ELF and PE attributes: 'function', 'object', 'data', 'notype'. 590 ; PE ignores all but 'function' (yasm only). Other formats ignores 591 ; this completely. 592 ; 593 %macro EXPORTEDNAME_EX 2 594 EXPORTEDNAME_RAW NAME(%1), %1, %2 595 %endmacro 596 597 598 ;; 599 ; Begins a procedure, raw version w/o automatic name mangling. 600 %macro BEGINPROC_RAW 1 569 601 %ifdef RT_ASM_WITH_SEH64_ALT 570 602 SEH64_ALT_START_UNWIND_INFO %1 571 603 %endif 572 604 %ifdef RT_ASM_WITH_SEH64 573 global NAME(%1):function574 proc_frame NAME(%1)575 %else 576 GLOBALNAME_ EX%1, function, hidden605 global %1:function 606 proc_frame %1 607 %else 608 GLOBALNAME_RAW %1, function, hidden 577 609 %endif 578 610 .start_of_prologue: … … 580 612 581 613 ;; 582 ; Begins a C callable exported procedure. 583 %macro BEGINPROC_EXPORTED 1 614 ; Begins a C callable (DECLASM) procedure. 615 %macro BEGINPROC 1 616 BEGINPROC_RAW NAME(%1) 617 %endmacro 618 619 620 ;; 621 ; Begins a exported procedure, raw version w/o automatic name mangling. 622 ; @param 1 Internal name. 623 ; @param 2 Exported name. 624 %macro BEGINPROC_EXPORTED_RAW 2 584 625 %ifdef RT_ASM_WITH_SEH64_ALT 585 626 SEH64_ALT_START_UNWIND_INFO %1 … … 587 628 %ifdef RT_ASM_WITH_SEH64 588 629 %ifdef ASM_FORMAT_PE 589 export % 1=NAME(%1)590 %endif 591 global NAME(%1):function592 proc_frame NAME(%1)593 %else 594 EXPORTEDNAME_ EX %1, function630 export %2=%1 631 %endif 632 global %1:function 633 proc_frame %1 634 %else 635 EXPORTEDNAME_RAW %1, %2, function 595 636 %endif 596 637 .start_of_prologue: … … 598 639 599 640 ;; 600 ; Ends a C callable procedure. 601 %macro ENDPROC 1 641 ; Begins a C callable (DECLASM) exported procedure. 642 %macro BEGINPROC_EXPORTED 1 643 BEGINPROC_EXPORTED_RAW NAME(%1), %1 644 %endmacro 645 646 647 ;; 648 ; Ends a procedure, raw version w/o automatic name mangling. 649 %macro ENDPROC_RAW 1 602 650 %ifdef RT_ASM_WITH_SEH64 603 651 endproc_frame 604 652 %endif 605 GLOBALNAME_ EX%1 %+ _EndProc, , hidden ; no function here, this isn't a valid code flow target.653 GLOBALNAME_RAW %1 %+ _EndProc, , hidden ; no function here, this isn't a valid code flow target. 606 654 %ifdef ASM_FORMAT_ELF 607 655 %ifndef __NASM__ ; nasm does this in the global directive. 608 size NAME(%1) NAME(%1 %+ _EndProc) - NAME(%1)609 size NAME(%1 %+ _EndProc)4 ; make it non-zero to shut up warnigns from Linux's objtool.656 size %1 %1 %+ _EndProc - %1 657 size %1 %+ _EndProc 4 ; make it non-zero to shut up warnigns from Linux's objtool. 610 658 %endif 611 659 %endif … … 621 669 section .pdata 622 670 %endif 623 dd NAME(%1)wrt ..imagebase624 dd NAME(%1 %+ _EndProc)wrt ..imagebase625 dd NAME(%1 %+ .unwind_info)wrt ..imagebase671 dd %1 wrt ..imagebase 672 dd %1 %+ _EndProc wrt ..imagebase 673 dd %1 %+ .unwind_info wrt ..imagebase 626 674 627 675 ; Restore code section. … … 629 677 %endif 630 678 %endif 679 %endmacro 680 681 ;; 682 ; Ends a C callable procedure. 683 %macro ENDPROC 1 684 ENDPROC_RAW NAME(%1) 631 685 %endmacro 632 686
Note:
See TracChangeset
for help on using the changeset viewer.