You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/03/11 07:36:16 UTC

[GitHub] [tvm] apivovarov opened a new pull request #7634: [MIPS] Fix CALL16 reloc at 0x290 not against global symbol

apivovarov opened a new pull request #7634:
URL: https://github.com/apache/tvm/pull/7634


   When I compiled test model for MIPS platform I faced the following error during export_library (linkage):
   `mips-linux-gnu/bin/ld: /tmp/tmptd3u21a0/lib.o: CALL16 reloc at 0x290 not against global symbol`
    
   Issue details:
   TVM generated model has non-global `$xxx_compute_` functions. For example: `$fused_nn_contrib_conv2d_NCHWc_add_compute_`, `$fused_nn_global_avg_pool2d_compute_`, etc.
   
   These functions are not marked as `.globl` in model assembly.
   At the same time the functions are not marked as static too (`llvm::Function::Create` uses `PrivateLinkage` but not `InternalLinkage`).
   
   It confuses MIPS codegen and in the assembly it calls `$xxx_compute_` functions using the approach which is used for global prototype functions call (`call16` approach).
   
   MIPS has different approaches to call static and global prototype functions:
   - global function prototypes called using `call16(my_fn) + .reloc R_MIPS_JALR + jalr`
   - static functions called using simple `jal my_fn`
    
   The issue is not visible on x86 / ARM because their assembly uses “call my_fn” / “bl my_fn” to call functions/subroutines regardless of their type.
   
   This PR solves the issue by using InternalLinkage when `$xxx_compute_` functions are created. It makes them static (STB_LOCAL in the case of ELF).
   [LLVM Linkage Types](https://llvm.org/docs/LangRef.html#linkage-types)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tqchen merged pull request #7634: [MIPS] Fix CALL16 reloc at 0x290 not against global symbol

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #7634:
URL: https://github.com/apache/tvm/pull/7634


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tqchen commented on pull request #7634: [MIPS] Fix CALL16 reloc at 0x290 not against global symbol

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #7634:
URL: https://github.com/apache/tvm/pull/7634#issuecomment-796781972


   Thanks @apivovarov !


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org