[all-commits] [llvm/llvm-project] 69d10d: [ELF] Update st_size when merging a common symbol ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Dec 13 09:23:43 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 69d10d282e5896821e16d4bc5dd190adc0131520
      https://github.com/llvm/llvm-project/commit/69d10d282e5896821e16d4bc5dd190adc0131520
  Author: Fangrui Song <maskray at google.com>
  Date:   2019-12-13 (Fri, 13 Dec 2019)

  Changed paths:
    M lld/ELF/Symbols.cpp
    A lld/test/ELF/common-shared.s

  Log Message:
  -----------
  [ELF] Update st_size when merging a common symbol with a shared symbol

When a common symbol is merged with a shared symbol, increase st_size if
the shared symbol has a larger st_size. At runtime, the executable's
symbol overrides the shared symbol.  The shared symbol may be created
from common symbols in a previous link.  This rule makes sure we pick
the largest size among all common symbols.

This behavior matches GNU ld. See
https://sourceware.org/bugzilla/show_bug.cgi?id=25236 for discussions.

A shared symbol does not hold alignment constraints. Ignore the
alignment update.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D71161




More information about the All-commits mailing list