Project

General

Profile

Bug #4959

completely discarded merged string sections will corrupt output objects

Added by Rich Lowe almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
2014-07-03
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

If an input object contains a mergable string table of 0 size (not even containing the NUL string), we'll produce an output object with a corrupt string table, or trip an assert:

Assertion failed: shdr->sh_info == SYMTAB_LOC_CNT(ofl), file ../common/update.c, line 1959, function update_osym

This seems to be because this input section deserves to be discarded (and would be), but the new merged section we create for it will have size 1 (because it will always contain the NUL string) and thus will partially persist.

We certainly should not be producing merged sections if there are no input strings.
It is likely we also should not be getting nearly so muddled in the case where we do (we should likely be producing just a useless output section, not one that corrupts the string table).

In the test case I have, unfortunately, the string table corrupt causes us to have two output sections named ".comment", which makes following the debug output from the link-editor challenging.

Also available in: Atom PDF