Closed Bug 661800 Opened 13 years ago Closed 13 years ago

elfhack/elf.cpp:285: Elf::Elf(std::ifstream&): Assertion `segment->getFileSize() == phdr.p_filesz' failed.

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla7

People

(Reporter: octoploid, Assigned: glandium)

References

(Depends on 1 open bug)

Details

Attachments

(5 files)

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20100101 Firefox/7.0a1
Build Identifier: 

I've hit the following assertion in elfhack:

===
=== If you get failures below, please file a bug describing the error
=== and your environment (compiler and linker versions), and use
=== --disable-elf-hack until this is fixed.
===
cd ../../dist/bin; find . -name "*.so" | xargs ../../build/unix/elfhack/elfhack
./libnspr4.so: Already elfhacked. Skipping
./libplds4.so: No gain. Skipping
./libplc4.so: No gain. Skipping
./libmozsqlite3.so: Reduced by 8032 bytes
./libnssdbm3.so: No gain. Skipping
./libsmime3.so: No gain. Skipping
./libxpcom.so: No gain. Skipping
./libmozalloc.so: No gain. Skipping
./components/libmozgnome.so: No gain. Skipping
./components/libdbusservice.so: No gain. Skipping
./components/libnkgnomevfs.so: No gain. Skipping
./components/libbrowsercomps.so: Reduced by 12128 bytes
./libnssckbi.so: Already elfhacked. Skipping
./libsoftokn3.so: Already elfhacked. Skipping
./libnss3.so: Already elfhacked. Skipping
./libnssutil3.so: Already elfhacked. Skipping
./libssl3.so: Already elfhacked. Skipping
./libfreebl3.so: Already elfhacked. Skipping
elfhack: /var/tmp/mozilla-central/build/unix/elfhack/elf.cpp:285: Elf::Elf(std::ifstream&): Assertion `segment->getFileSize() == phdr.p_filesz' failed.
xargs: ../../build/unix/elfhack/elfhack: terminated by signal 6
make[3]: *** [elfhack] Error 125

This only happens with the latest gcc-4.7.0 during a profiledbuild.
A normal build works without problems.

Reproducible: Always
could you attach the file on which elfhack fails? (I guess it is libxul.so)
Attached file libnspr4.so
Both libnspr4.so and libxul.so trigger the same assertion.
I've attached libnspr4.so, because it's smaller.
Assignee: nobody → mh+mozilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
In case someone is wondering about the "Already elfhacked" messages
above. They appear because I forgot to delete the build directory (
that contained a conventional build) before starting the profiledbuild.
The problem is that elfhack believes the .dynamic section is in the TLS segment. What's weird is that I'd expect that to be caught by the test case. Could you attach $objdir/build/unix/elfhack/test.so as well?
Attached file test.so
Attached file test.so.bak
This fixes the problem for me. Many thanks Mike.
Comment on attachment 537290 [details] [diff] [review]
Avoid elfhack considering non SHF_TLS sections as part of PT_TLS segment

rubberstamp
Attachment #537290 - Flags: review?(tglek) → review+
http://hg.mozilla.org/mozilla-central/rev/d95b370f0f85
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Backed out because of bug 664362
http://hg.mozilla.org/mozilla-central/rev/f6f801cfdf4c
Status: RESOLVED → REOPENED
Depends on: 664362
Resolution: FIXED → ---
Alternatively, landing with a clobber forcing thingy would work as well.
Depends on: 660015
Target Milestone: mozilla7 → ---
No longer depends on: 660015, 664362
In the end, it's much simpler to do it locally.
Attachment #539454 - Flags: review?(ted.mielczarek)
Comment on attachment 539454 [details] [diff] [review]
part 0 - Add a dependency of host_elf*.o upon elfxx.h, to circumvent bug 664362.

Review of attachment 539454 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #539454 - Flags: review?(ted.mielczarek) → review+
Merged in m-c
http://hg.mozilla.org/mozilla-central/rev/0640c9ecfba2
http://hg.mozilla.org/mozilla-central/rev/6e3813929a57
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Whiteboard: [inbound]
After this got merged to m-c, tip doesn't build for me:

=== If you get failures below, please file a bug describing the error
=== and your environment (compiler and linker versions), and use
=== --disable-elf-hack until this is fixed.
===
/home/tim/workspace/mozilla-central/objdir-ff-release/build/unix/elfhack/elfhack -b test.so
test.so: terminate called after throwing an instance of 'std::runtime_error'
  what():  PT_GNU_RELRO segment doesn't start on a section start

I guess this is related?
(In reply to comment #17)
> After this got merged to m-c, tip doesn't build for me:
> 

The tip does not (clobber) build for me either (5a46d17c72ca - 64bit linux)

===
=== If you get failures below, please file a bug describing the error
=== and your environment (compiler and linker versions), and use
=== --disable-elf-hack until this is fixed.
===
/home/mcmanus/src/mozilla2/wd/obj-debug-661036/build/unix/elfhack/elfhack -b test.so
test.so: terminate called after throwing an instance of 'std::runtime_error'
  what():  PT_GNU_RELRO segment doesn't start on a section start
this is bug 664366, and the most likely relationship between this and that bug is that the test case change triggers the ld bug.
Depends on: 664366
No longer depends on: 664366
Depends on: 676198
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: