Menu

#100 using .align in the .text segment cause incorrect behaviour.

v1.0_(example)
closed
nobody
None
1
2021-10-12
2021-10-09
Anonymous
No

using .align in the .text segment cause incorrect behaviour.

.text
.align 2
 code: .space 1024

will cause code to be created in the .data segment, not the .text segment.

.text
code: .space 1024

correctly creates code in the .text segment.

additionaly, if .align is not the first thing in the text segment spim will segfault.

Discussion

  • Anonymous

    Anonymous - 2021-10-09

    I will provide sample code to reproduce once I am not on a phone.

     
  • Anonymous

    Anonymous - 2021-10-09

    In this code:

    main:
        la $a0, main
        li $v0, 1
        syscall
        li $a0, '\n'
        la $v0, 11
        syscall
    
        la $a0, text_data
        li $v0, 1
        syscall
        li $a0, '\n'
        la $v0, 11
        syscall
    
        la $a0, align_text_data
        li $v0, 1
        syscall
        li $a0, '\n'
        la $v0, 11
        syscall
    
    exit:
        li $v0, 0
        jr $ra
    
    text_data:
      .space 4096
    
    align_text_data:
      .align 2
      .space 4096
    

    text_data: is placed in the .text segment while.
    align_text_data: is placed in the .data segment.

     
  • James Larus

    James Larus - 2021-10-12
    • status: open --> closed
     
  • James Larus

    James Larus - 2021-10-12

    Yes, this is a real bug. I've fixed it.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB