4

Recently, I have dived into GCC Binutils nm documentation. I read the description of the symbols' classification and don't understand the differences between n and R (or r) symbols. As the manual says:

for n

The symbol is in the read-only data section.

R or r

The symbol is in a read only data section.

So instead of a we have the and instead of - we have space separating two words... It is also quite tricky for google - it seems to me that google is not paying much attention to the presence of -.

llwafelll
  • 53
  • 1
  • 4
  • Different people writing the manual using slightly different wording for their respective section? – Some programmer dude Sep 01 '22 at 18:48
  • A section named `read-only` vs another section that is merely read-only? – ikegami Sep 01 '22 at 18:56
  • Did you investigate some test compiled from a simple source? Probably different sections are read-only. Did you try to find out for _what_ symbols these classifications are used? – the busybee Sep 01 '22 at 19:15
  • @thebusybee I tried to compile some self-written code that defines a bunch of variables, but I was able to produce only `r` and `R` - for `static const int` and `const int`, respectively. I have not figured out what variable type would trigger `n` symbol during compilation. – llwafelll Sep 01 '22 at 19:32
  • @Someprogrammerdude But programmers are not novelists to use different words to describe the same thing. If there is no reason for the existence of two read-only sections that means that this tool is in really poor condition. Correct me if I'm wrong. – llwafelll Sep 01 '22 at 19:50
  • I have never heard about `n` and I believe is an error in the documentation. `N` is a debug symbol. – 0___________ Sep 01 '22 at 22:06
  • 1
    @llwafelll While I cant say I know all the ways this is used for sure and so am not posting this as an answer, it appears the difference is that `r`/`R` is for read-only data (as you are familiar) while `n` is for non-loadable read-only data such as the notes section present in some object files (this the "n"). Specifically, any section BFD considers a read-only data section is `r`/`R`; any section that is considered read-only, with contents but not data is `n – Unn Sep 02 '22 at 03:16

0 Answers0