Bug 223688 - lang/luajit: Ensure the .strtab section written by bcsave.lua is the correct size
Summary: lang/luajit: Ensure the .strtab section written by bcsave.lua is the correct ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 214864
  Show dependency treegraph
 
Reported: 2017-11-15 19:48 UTC by Dimitry Andric
Modified: 2017-12-31 00:52 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (osa)


Attachments
Fix lang/luajit object file .strtab size (1022 bytes, patch)
2017-11-15 19:48 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer 2017-11-15 19:48:44 UTC
Created attachment 188029 [details]
Fix lang/luajit object file .strtab size

When luajit writes a ELF object file (using the -b option), it sets the size of the .strtab section one byte too short.  In function bcsave_elfobj(), the offset of the .rodata section after .strtab is already calculated correctly, but the size of .strtab itself is one byte too small.  Even though there is a zero byte after the last string in the table, the short size causes lld (the LLVM linker) to show an error message similar to:

ld: error: obj/bytecode.o: string table non-null terminated

See also https://github.com/LuaJIT/LuaJIT/pull/366, and bug 214864 (specifically the benchmarks/wrk failure).
Comment 1 Ed Maste freebsd_committer 2017-12-29 14:11:39 UTC
Dimitry's change has been accepted upstream. Can this port patch be committed so that it works in our tree while waiting for a new version?
Comment 2 Dimitry Andric freebsd_committer 2017-12-30 18:26:00 UTC
Over to portmgr for approval.
Comment 3 Antoine Brodin freebsd_committer 2017-12-30 20:11:34 UTC
Approved (maintainer timeout, 45days + portmgr approval)

Don't forget to bump PORTREVISION.
Comment 4 commit-hook freebsd_committer 2017-12-31 00:51:35 UTC
A commit references this bug:

Author: dim
Date: Sun Dec 31 00:50:32 UTC 2017
New revision: 457655
URL: https://svnweb.freebsd.org/changeset/ports/457655

Log:
  Fix lang/luajit object file .strtab section size

  When luajit writes a ELF object file (using the -b option), it sets the
  size of the .strtab section one byte too short.  In function
  bcsave_elfobj(), the offset of the .rodata section after .strtab is
  already calculated correctly, but the size of .strtab itself is one byte
  too small.  Even though there is a zero byte after the last string in
  the table, the short size causes lld (the LLVM linker) to show an error
  message similar to:

  ld: error: obj/bytecode.o: string table non-null terminated

  Fix it by increasing the size of the .strtab section by one byte.  This
  change has also been accepted upstream, but there is no new stable
  release yet.

  Approved by:	portmgr (antoine)
  PR:		223688

Changes:
  head/lang/luajit/Makefile
  head/lang/luajit/files/patch-src_jit_bcsave.lua