Skip to content

Fixup GAS/binutils assembly#762

Open
ZERICO2005 wants to merge 5 commits intomasterfrom
fixup_asm
Open

Fixup GAS/binutils assembly#762
ZERICO2005 wants to merge 5 commits intomasterfrom
fixup_asm

Conversation

@ZERICO2005
Copy link
Copy Markdown
Contributor

@ZERICO2005 ZERICO2005 commented Mar 23, 2026

Bug fixes:

  • added missing @function from .global/.weak, this is necessary for preventing these warnings from binutils:
toolchain/CEdev/binutils/bin/z80-none-elf-ld: warning: strcmp.o: missing .note.GNU-stack section implies executable stack
toolchain/CEdev/binutils/bin/z80-none-elf-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
  • removed @function from .local
  • fixed extern --> .extern
  • fixed section --> .section

Formatting:

  • canonicalized the order of @function declarations (so .type _func, @function is always after its corresponding .global/.weak _func.
  • Enforce using 0x012345/$012345 instead of 0012345h
  • fixed .assumes to assumes in comments
  • switched ADL=1, adl = 1, and etc to adl=1 so everything is consistent toolchain wide.

Comment on lines 2 to -10
.section .text
.global ___sleep_common
.type ___sleep_common, @function

___sleep_common:
; Timing assumes fetching from RAM (4cc) and the first timer read being valid.

; Calculate the end time.
section .text
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why section is "defined twice" here

pop hl
ret

.extern __popcnt_common_init_full, __popcnt_common_iter_adjusted
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is a valid extension or not, but we only use .extern , twice toolchain wide so probably should make this consistent. Also, this could also hide bugs possibly if it is not a valid extension? Also it seems like GAS .extern is a lot more forgiving than FASMG extern, since I won't get linker errors if I forget to put .extern sometimes

.global _memmem
.type _memmem, @function
.local _memcmp_fast
.type _memcmp_fast, @function
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_memcmp_fast is a private function, so I don't think it needs @function, and I don't see it used with other .local functions

Comment on lines 47 to 49
.local lz4_decompress_block_internal
.type lz4_decompress_block_internal, @function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calc84maniac is this .local function supposed to have @function?

Comment on lines 4 to 8
.global _ceil
.global _ceilf
.type _ceil, @function
.global _ceilf
.type _ceilf, @function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I mean by canonicalizing the order of @function. And this makes it consistent with how it has been done elsewhere.

.equ ti.MemClear, 0x0210DC
.equ ti.ClrTxtShd, 0x020818

.global __start
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add .type __start, @function? If so, should it be done to both crt0.S and crt.src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant