[all-commits] [llvm/llvm-project] 920cbe: [llvm][ADT] Fix Any linker error with multiple com...

Sebastian Neubauer via All-commits all-commits at lists.llvm.org
Mon Apr 24 01:40:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 920cbe84054f7386a6bd31afa7111a2a3634b454
      https://github.com/llvm/llvm-project/commit/920cbe84054f7386a6bd31afa7111a2a3634b454
  Author: Sebastian Neubauer <Sebastian.Neubauer at amd.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M llvm/include/llvm/ADT/Any.h

  Log Message:
  -----------
  [llvm][ADT] Fix Any linker error with multiple compilers

Citing the comment in the source:

Define the type id and initialize with a non-zero value.
Initializing with a zero value means the variab can end up in either the
.data or the .bss section. This can lead to multiple definition linker
errors when some object files are compiled with a compiler that puts the
variable into .data but they are linked to object files from a different
compiler that put the variable into .bss. To prevent this issue from
happening, initialize the variable with a non-zero value, which forces
it to land in .data (because .bss is zero-initialized).

Fixes https://github.com/llvm/llvm-project/issues/62270
A regression of D139974.

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




More information about the All-commits mailing list