Bug 13482 - inaccurate documentation
Summary: inaccurate documentation
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-07 17:29 UTC by DaveP
Modified: 2012-02-01 15:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DaveP 2011-12-07 17:29:55 UTC
http://sources.redhat.com/binutils/docs-2.22/as/Version.html#Version
"This directive creates a .note section and places into it an ELF formatted note of type NT_VERSION. The note's name is set to string."

Inaccurate.

.version "Version 1.0"
in arm sourcecode
running arm-linux-elf-as
GNU assembler (GNU Binutils) 2.22.51.20111122
Copyright 2011 Free Software Foundation, Inc.





Causes 


readelf: Warning: corrupt note found at offset 18 into core notes
readelf: Warning:  type: 1, namesize: 0000000c, descsize: 00000000


It would appear that the string must not contain White space.
Change to Version1.0 and the error goes

DaveP
Comment 1 Sourceware Commits 2012-02-01 15:44:36 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2012-02-01 15:44:30

Modified files:
	binutils       : ChangeLog readelf.c 
	binutils/testsuite: ChangeLog 
	binutils/testsuite/binutils-all: readelf.exp 

Log message:
	PR binutils/13482
	* readelf.c (process_corefile_note_segment): Fix off-by-one errors
	verifying the contents of a note.
	
	* binutils-all/version.s: New test source file.
	* binutils-all/readelf.n: New file: expected readelf output.
	* binutils-all/readelf.exp: Add test of .note section contents.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1874&r2=1.1875
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/readelf.c.diff?cvsroot=src&r1=1.566&r2=1.567
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.248&r2=1.249
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/readelf.exp.diff?cvsroot=src&r1=1.31&r2=1.32
Comment 2 Nick Clifton 2012-02-01 15:47:42 UTC
Hi Dave,

  Thanks for reporting this problem.  It is not a documentation error - spaces are allowed in the strings in .note sections.  Rather it was a couple of off-by-one errors in readelf which were being triggered because "Version 1.0" is exactly 12 bytes long.  If you had tried "Version 1.09" it would have worked...

  Anyway I have checked in a patch to fix the problem, and to add a test to the binutils testsuite to make sure that this issue does not reoccur.

Cheers
  Nick