Menu

#485 Assertion failed: (sh_off % _libelf_falign(elftype, ec) == 0)

2.0
new
nobody
None
2015-05-04
2015-03-27
Ed Maste
No

Found during FreeBSD exp run while building libjpeg-turbo
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198611

Failure initially reported as:

% elfcopy/strip -o /dev/null --strip-debug libturbojpeg.a
strip: elf_update() failed: Layout constraint violation

Trying the individual .o files shows:

% elfcopy/strip --strip-debug -o /dev/null jccolss2-64.o
Assertion failed: (sh_off % _libelf_falign(elftype, ec) == 0), function _libelf_write_scn, file elf_update.c, line 746.
zsh: abort (core dumped)  ../../elfcopy/strip --strip-debug -o /dev/null jccolss2-64.o
% elfcopy/strip --strip-debug -o /dev/null jcqnts2f-64.o
strip: elf_update() failed: Layout constraint violation
1 Attachments

Discussion

  • Ed Maste

    Ed Maste - 2015-03-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -2,12 +2,14 @@
     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198611
    
     Failure initially reported as:
    +
     ~~~~
     % elfcopy/strip -o /dev/null --strip-debug libturbojpeg.a
     strip: elf_update() failed: Layout constraint violation
     ~~~~
    
     Trying the individual .o files shows:
    +
     ~~~~
     % elfcopy/strip --strip-debug -o /dev/null jccolss2-64.o
     Assertion failed: (sh_off % _libelf_falign(elftype, ec) == 0), function _libelf_write_scn, file elf_update.c, line 746.
    @@ -15,3 +17,4 @@
     % elfcopy/strip --strip-debug -o /dev/null jcqnts2f-64.o
     strip: elf_update() failed: Layout constraint violation
     ~~~~
    +
    
     
  • Ed Maste

    Ed Maste - 2015-04-14

    See https://reviews.freebsd.org/D2292 for a potential fix

     
  • Ed Maste

    Ed Maste - 2015-04-15

    Root cause is a bug in NASM, with patch here: http://bugzilla.nasm.us/show_bug.cgi?id=3392307

    I still think it makes sense to have elfcopy/strip increase the alignment as required, as in the review in the previous comment.

     
  • Joseph Koshy

    Joseph Koshy - 2015-05-04

    libelf has been patched in [r3190].

    We could have elfcopy/strip fix up the file, perhaps issuing a warning
    in the process.

     

    Related

    Commit: [r3190]


Log in to post a comment.