Bug 694952

Summary: binutils (ld, nm) don't work on object file with large amounts of string
Product: [Fedora] Fedora Reporter: Eric Springer <erikina>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 14CC: jakub, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-11 12:12:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Standalone file which can be used to reproduce problem none

Description Eric Springer 2011-04-09 04:34:01 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0

I'm compiling a c file, with only a single function and a fair few strings. The generated object file is 61.9MiB. For comparison my entire program is only 5MiB if I #include the file (as opposed to attempt to link).

However, attempting to link against this giant object file fails. As does running nm on the object file.

I will attach a standalone file which can be used to reproduce the problem

Reproducible: Always

Steps to Reproduce:
$ gcc -c pronounce.h -o pronounce.o
$ nm pronounce.o
nm: pronounce.o: File format not recognized

Comment 1 Eric Springer 2011-04-09 04:35:56 UTC
Created attachment 490920 [details]
Standalone file which can be used to reproduce problem

Comment 2 Nick Clifton 2011-04-11 12:12:48 UTC
Hi Eric,

  This is because GCC is a little bit too smart.  It knows that pronounce.h is a header file, not a C source file.  So when you compile it, gcc turns it into a precompiled header, not an object file.  Hence nm does not recognise it.  Viz:

  % file pronounce.o
  pronounce.o: GCC precompiled header (version 013) for C

  % cp pronounce.h fred.c
  % gcc -c fred.c
  % nm fred.o
  00329d20 r C.0.2193
  0042e278 r __PRETTY_FUNCTION__.1399
           U __assert_fail
           U memcpy
  00000000 T pronounce
           U strcmp

Cheers
  Nick

Comment 3 Eric Springer 2011-04-13 00:49:06 UTC
Gah! I'm an idiot. Sorry for the noise


Thanks very much
Eric