[all-commits] [llvm/llvm-project] ac2be2: [lld][WebAssembly] Fix for weak undefined function...

Sam Clegg via All-commits all-commits at lists.llvm.org
Thu Feb 11 17:16:35 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ac2be2b6a366c05c01b8228fd804ba6ed52d320b
      https://github.com/llvm/llvm-project/commit/ac2be2b6a366c05c01b8228fd804ba6ed52d320b
  Author: Sam Clegg <sbc at chromium.org>
  Date:   2021-02-11 (Thu, 11 Feb 2021)

  Changed paths:
    M lld/test/wasm/weak-undefined-pic.s
    M lld/wasm/Driver.cpp
    M lld/wasm/Writer.cpp

  Log Message:
  -----------
  [lld][WebAssembly] Fix for weak undefined functions in -pie mode

This fixes two somewhat related issues.  Firstly we were never
generating imports for weak functions (even with the `import-functions`
policy for undefined symbols).  Adding a direct call to foo in the
`weak-undefined-pic.s` exposed a crash in the linker which this
change fixes.

Secondly we were failing to call `handleWeakUndefines` for the `-pie`
case which is PIC but doesn't set the undefined symbol policy to
`import-functions`.  With this change `-pie` binaries will by default
call `handleWeakUndefines` which generates the undefined stub handlers
for any weakly undefined symbols.

Fixes: https://github.com/emscripten-core/emscripten/issues/13337

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




More information about the All-commits mailing list