Bug 694952 - binutils (ld, nm) don't work on object file with large amounts of string
Summary: binutils (ld, nm) don't work on object file with large amounts of string
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 14
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-09 04:34 UTC by Eric Springer
Modified: 2011-04-13 00:49 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-11 12:12:48 UTC
Type: ---


Attachments (Terms of Use)
Standalone file which can be used to reproduce problem (824.57 KB, application/zip)
2011-04-09 04:35 UTC, Eric Springer
no flags Details

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


Note You need to log in before you can comment on or make changes to this bug.