[all-commits] [llvm/llvm-project] 219d00: [test] Make ELF tests immune to dso_local/dso_pree...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Dec 31 14:04:00 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 219d00e0d90941d3e54fc711ea1e7b5e4b5b4335
      https://github.com/llvm/llvm-project/commit/219d00e0d90941d3e54fc711ea1e7b5e4b5b4335
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-12-31 (Thu, 31 Dec 2020)

  Changed paths:
    M clang/test/CodeGenCUDA/lambda-reference-var.cu
    M clang/test/CodeGenCXX/default_calling_conv.cpp
    M clang/test/Driver/hip-fpie-option.hip
    M clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp

  Log Message:
  -----------
  [test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences

ELF -cc1 -mrelocation-model pic will default to no semantic interposition plus
setting dso_local on default visibility external linkage definitions, so that
COFF, Mach-O and ELF output will be similar.

This patch makes tests immune to the differences.


  Commit: d1fd72343c6ff58a3b66bc0df56fed9ac21e4056
      https://github.com/llvm/llvm-project/commit/d1fd72343c6ff58a3b66bc0df56fed9ac21e4056
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-12-31 (Thu, 31 Dec 2020)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGen/attr-arm-sve-vector-bits-globals.c
    R clang/test/CodeGen/semantic-interposition-no.c
    M clang/test/CodeGen/semantic-interposition.c
    M clang/test/CodeGenCXX/RelativeVTablesABI/child-inheritted-from-parent-in-comdat.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-1.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-2.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/diamond-virtual-inheritance.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/inheritted-virtual-function.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/inline-virtual-function.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/multiple-inheritance.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/no-alias-when-dso-local.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/override-pure-virtual-method.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/overriden-virtual-function.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-flag.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/simple-vtable-definition.cpp
    M clang/test/Driver/fsemantic-interposition.c
    M llvm/include/llvm/IR/Module.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/IR/Module.cpp

  Log Message:
  -----------
  Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions

The idea is that the CC1 default for ELF should set dso_local on default
visibility external linkage definitions in the default -mrelocation-model pic
mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar.

The refactoring is made available by 2820a2ca3a0e69c3f301845420e0067ffff2251b.

Currently only x86 supports local aliases. We move the decision to the driver.
There are three CC1 states:

* -fsemantic-interposition: make some linkages interposable and make default visibility external linkage definitions dso_preemptable.
* (default): selected if the target supports .Lfoo$local: make default visibility external linkage definitions dso_local
* -fhalf-no-semantic-interposition: if neither option is set or the target does not support .Lfoo$local: like -fno-semantic-interposition but local aliases are not used. So references can be interposed if not optimized out.

Add -fhalf-no-semantic-interposition to a few tests using the half-based semantic interposition behavior.


Compare: https://github.com/llvm/llvm-project/compare/14dc69b09218...d1fd72343c6f


More information about the All-commits mailing list