Project

General

Profile

Actions

Bug #14157

open

ld(1) string table merging should follow gABI more closely

Added by Rich Lowe 14 days ago. Updated 11 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When we merge string tables, at present we only include strings referenced by symbols or relocations. Dropping any others.
This is perhaps a reasonable (but questionable, per the ABI) mode of compressing loadable sections. However for others, such as .comment this causes us to replace their mergable content with the null string.

gABI states:

SHF_MERGE
The data in the section may be merged to eliminate duplication. Unless the SHF_STRINGS flag is also set, the data elements in the section are of a uniform size. The size of each element is specified in the section header's sh_entsize field. If the SHF_STRINGS flag is also set, the data elements consist of null-terminated character strings. The size of each character is specified in the section header's sh_entsize field.

Each element in the section is compared against other elements in sections with the same name, type and flags. Elements that would have identical values at program run-time may be merged. Relocations referencing elements of such sections must be resolved to the merged locations of the referenced values. Note that any relocatable values, including values that would result in run-time relocations, must be analyzed to determine whether the run-time values would actually be identical. An ABI-conforming object file may not depend on specific elements being merged, and an ABI-conforming link editor may choose not to merge specific elements.

Making it clear that each element in the section must be merged, not merely referenced ones. Unless we take a particularly sharp view of "identical values at program run time" to mean that things with no meaningful value at runtime can be thrown away.

Actions #1

Updated by Electric Monk 11 days ago

  • Gerrit CR set to 1760
Actions

Also available in: Atom PDF