79367086

Date: 2025-01-18 12:01:11
Score: 1
Natty:
Report link

As @Shawn and @fuz mentioned, adding a prefixing _ is required for all C code built for the macOS ABI.

Therefore, the corrected code would become:

    .global main                                                        // 1 
main:                                                                   // 2 
    stp     x21, x30, [sp, -16]!    // push onto stack                  // 3 
    mov     x21, x1                 // argc -> x0, argv -> x1           // 4 
                                                                        // 5 
top:                                                                    // 6 
    ldr     x0, [x21], 8            // argv++, old value in x0          // 7 
    cbz     x0, bottom              // if *argv == NULL goto bottom     // 8 
    bl      _puts                   // note that there is a `_`         // 9   
    b       top                     // goto top                         // 10 
                                                                        // 11 
bottom:                                                                 // 12 
    ldp     x21, x30, [sp], 16      // pop from stack                   // 13 
    mov     x0, xzr                 // return 0                         // 14 
    ret                                                                 // 15 
                                                                        // 16 
    .end         

Fixed part:

bl    _puts  // with the addition of the leading `_` 
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Shawn
  • User mentioned (0): @fuz
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Silicon