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

the sh_entsize section header of the .debug_gdb_scripts section should be set to 1 (not 0) #36612

Closed
japaric opened this issue Sep 21, 2016 · 2 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug.

Comments

@japaric
Copy link
Member

japaric commented Sep 21, 2016

Context: As part of our work towards integrating lld into rustc (#36120), we found out
and reported 3 scenarios ("bugs") where lld doesn't behave exactly the same as ld. While one of
the LLD devs was looking over one of the object files that was used one of the bug reports, they
found out something that seemed irregular:

Quoting @rui314's comment from the LLVM bug tracker:

I sent out https://reviews.llvm.org/D24789 to fix the issue.
But I'm not completely sure if the object file created by rustc is valid. At least it seems to be causing a unnecessary trouble by choosing an irregular value for sh_entsize.
hello.o's .debug_gdb_scripts is a mergeable section with sh_entsize = 0. Usually the field is 1 for a section containing mergeable strings.
Jorge, I think you want to change rustc so that it sets 1 instead of 0.

The object mentioned in the comment can be generated with:

$ rustup default nightly-2016-09-15

$ echo 'fn main() { println!("Hello, world!"); }' > hello.rs

$ rustc -g hello.rs

This issue is to discuss if we should change the value of sh_entsize for this particular section.

This is above my paygrade so I'm going to cc @michaelwoerister who knows our debuginfo very well.

P.S. This particular bug has already been fixed in lld by, AIUI, relaxing one of their checks so our
object files are accepted.

@michaelwoerister michaelwoerister added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Sep 21, 2016
@michaelwoerister
Copy link
Member

Thanks for the report. That's interesting.

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 26, 2017
@pnkfelix pnkfelix added the A-linkage Area: linking into static, shared libraries and binaries label May 16, 2022
@wesleywiser
Copy link
Member

Looks like this was fixed in Rust 1.32. I'm therefore closing.

$ rustc +1.31 -g --crate-type bin issue-36612.rs
$ readelf -S issue-36612
There are 44 section headers, starting at offset 0x3d5450:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [17] .debug_gdb_script PROGBITS         00000000000597d9  000597d9
       0000000000000022  0000000000000000 AMS       0     0     1


$ rustc +1.32 -g --crate-type bin issue-36612.rs
$ readelf -S issue-36612
There are 44 section headers, starting at offset 0x248058:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [17] .debug_gdb_script PROGBITS         00000000000281d0  000281d0
       0000000000000022  0000000000000001 AMS       0     0     1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants