Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: use accumulate address on sections with SHT_NOBITS #1187

Merged
merged 1 commit into from
Feb 3, 2024

Conversation

aokblast
Copy link
Contributor

@aokblast aokblast commented Feb 3, 2024

I fix the bug in #456.

The reason is caused by the offset of sections with SHT_NOBITS.

As the following picture shows:

The left side is the output of mold and the right side is the output of lld. We can see that file offset of the sections with SHT_NOTIBS is all zero in mold. This cause the sections enter this function in FreeBSD strip returned unloaded=0 thus discard in the segment as the second picture shows.

20240203_22h23m53s_grim

This pictures .bss is discarded in left side.

20240203_22h28m32s_grim

@aokblast aokblast changed the title Feat: use accumulate address on sections with SHT_ALLOC Feat: use accumulate address on sections with SHT_NOBITS Feb 3, 2024
@aokblast
Copy link
Contributor Author

aokblast commented Feb 3, 2024

After all, I can strip and run the binary after strip

@rui314
Copy link
Owner

rui314 commented Feb 3, 2024

Isn't it more like a bug in bsd's strip than that in mold?

@aokblast
Copy link
Contributor Author

aokblast commented Feb 3, 2024

I don't know but I have tested on gold, lld, and bfd. They all have same behaviors. I think we should not call it a bug. It is an ambiguity on the design of ELF format.

@rui314 rui314 merged commit c9651d9 into rui314:main Feb 3, 2024
7 checks passed
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.

None yet

2 participants