Skip to content

No bss size for dot bss#522

Open
mkst wants to merge 6 commits intomainfrom
no-bss-size-for-dot-bss
Open

No bss size for dot bss#522
mkst wants to merge 6 commits intomainfrom
no-bss-size-for-dot-bss

Conversation

@mkst
Copy link
Collaborator

@mkst mkst commented Mar 10, 2026

No description provided.

CHANGELOG.md Outdated

### 0.38.1

* Fix `bss_size` being required for parent segments that contain `.bss` sections.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should somehow mention this is for .bss and not bss

@mkst
Copy link
Collaborator Author

mkst commented Mar 11, 2026

Hmm with this change user is now hitting the next error:

The section 'sc/scmanager' (vram 0x800A44D0) is outside its parent's address range 'scmanager' (0x800A1980 ~ 0x800A44D0).
    This may happen when the specified bss_size value is too small.

splat config is

- name: scmanager
    type: code
    start: 0x0406D0
    vram: 0x800A1980
    subsegments:
      - [0x0406D0, c, sc/scmanager]
      - [0x041DC0, .data, sc/scmanager]
      - [0x042F30, .rodata, sc/scmanager]
      - { start: auto, type: .bss, name: sc/scmanager }

should the ret.vram_start >= parent.vram_end be ret.vram_start > parent.vram_end here:

                if (
                    isinstance(ret.vram_start, int)
                    and isinstance(parent.vram_end, int)
                    and ret.vram_start >= parent.vram_end  # greater than?
                ):
                    log.error(
                        f"The section '{ret.name}' (vram 0x{ret.vram_start:08X}) is outside its parent's address range '{parent.name}' (0x{parent.vram_start:08X} ~ 0x{parent.vram_end:08X}).\n    This may happen when the specified `bss_size` value is too small."
                    )

@AngheloAlf
Copy link
Collaborator

The current check is correct. Vram addresses are considered "inclusive start, exclusive end".
In this example, the address 0x800A44D0 is not considered part of the scmanager segment, but it is considered at the start of the next segment.
I think it would be better to undo that last commit and instead move the not ret.type.startswith(".") check to be part of the if options.opts.ld_bss_is_noload and isinstance(ret, CommonSegBss):

As in:

        if options.opts.ld_bss_is_noload and isinstance(ret, CommonSegBss) and not ret.type.startswith("."):
            # We need to know the bss space for the segment.
            if isinstance(parent, CommonSegCode):
                if parent.bss_size <= 0:
                    log.error(

idk if this would hit another issue afterwards tho

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants