[Bug 245179] lld: wrong/misleading "SHF_MERGE section size must be a multiple of sh_entsize"
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Mar 30 02:40:15 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245179
Bug ID: 245179
Summary: lld: wrong/misleading "SHF_MERGE section size must be
a multiple of sh_entsize"
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: andrew at tao11.riddles.org.uk
CC: dim at FreeBSD.org, emaste at freebsd.org,
kevans at freebsd.org
Flags: mfc-stable12?, mfc-stable11?
In function ObjFile<ELFT>::shouldMerge in lld/ELF/InputFiles.cpp:
if (sec.sh_size % entSize)
fatal(toString(this) +
": SHF_MERGE section size must be a multiple of sh_entsize");
uint64_t flags = sec.sh_flags;
if (!(flags & SHF_MERGE))
return false;
Notice that the size is checked _before_ looking at whether SHF_MERGE is set.
This means that the error is produced for sections that do not have SHF_MERGE
set at all, which is either misleading or wrong.
Judging by the report in #219717 where this was found, the BFD linker did not
care about sh_entsize of non-mergeable sections. If this check is only needed
for mergeable sections, then surely it should be made _after_ SHF_MERGE is
checked for.
Since this check is skipped when -Wl,-O0 is in effect, I do not believe it is
actually necessary to check that size is a multiple of sh_entsize when not
merging sections. If I'm wrong about that, though, then the check would need to
be both moved to somewhere else and changed to not mention SHF_MERGE in the
error message.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list