For a definition (of most linkage types), dso_local is set for ELF -fno-pic/-fpie
and COFF, but not for Mach-O. This nuance causes unneeded binary format differences.
This patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `
if there is an explicit linkage.
* Clang will set dso_local for Mach-O, which is currently implied by TargetMachine.cpp. This will make COFF/Mach-O and executable ELF similar.
* Eventually I hope we can make dso_local the textual LLVM IR default (write explicit "dso_preemptable" when applicable) and -fpic ELF will be similar to everything else. This patch helps move toward that goal.
57 lines
2.6 KiB
C++
57 lines
2.6 KiB
C++
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 | \
|
|
// RUN: FileCheck --check-prefixes=FP80,FP80-ELF32 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin | \
|
|
// RUN: FileCheck --check-prefixes=FP80,FP80-DARWIN %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 | \
|
|
// RUN: FileCheck --check-prefixes=FP80,FP80-ELF64 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin | \
|
|
// RUN: FileCheck --check-prefixes=FP80,FP80-DARWIN %s
|
|
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 -mlong-double-64 | \
|
|
// RUN: FileCheck --check-prefixes=FP64,FP64-X32 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin -mlong-double-64 | \
|
|
// RUN: FileCheck --check-prefixes=FP64,FP64-X32 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 -mlong-double-64 | \
|
|
// RUN: FileCheck --check-prefixes=FP64,FP64-X64 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin -mlong-double-64 | \
|
|
// RUN: FileCheck --check-prefixes=FP64,FP64-X64 %s
|
|
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 -mlong-double-128 | \
|
|
// RUN: FileCheck --check-prefix=FP128 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin -mlong-double-128 | \
|
|
// RUN: FileCheck --check-prefix=FP128 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 -mlong-double-128 | \
|
|
// RUN: FileCheck --check-prefix=FP128 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin -mlong-double-128 | \
|
|
// RUN: FileCheck --check-prefix=FP128 %s
|
|
|
|
// Check -malign-double increases the alignment from 4 to 8 on x86-32.
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 -mlong-double-64 \
|
|
// RUN: -malign-double | FileCheck --check-prefixes=FP64,FP64-X64 %s
|
|
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 -mlong-double-64 \
|
|
// RUN: -malign-double | FileCheck --check-prefixes=FP64,FP64-X64 %s
|
|
|
|
long double x = 0;
|
|
int size = sizeof(x);
|
|
|
|
// FP80-ELF32: @x ={{.*}} global x86_fp80 {{.*}}, align 4
|
|
// FP80-ELF32: @size ={{.*}} global i32 12
|
|
// FP80-ELF64: @x ={{.*}} global x86_fp80 {{.*}}, align 16
|
|
// FP80-ELF64: @size ={{.*}} global i32 16
|
|
// FP80-DARWIN: @x ={{.*}} global x86_fp80 {{.*}}, align 16
|
|
// FP80-DARWIN: @size ={{.*}} global i32 16
|
|
|
|
// FP64-X32: @x ={{.*}} global double {{.*}}, align 4
|
|
// FP64-X32: @size ={{.*}} global i32 8
|
|
// FP64-X64: @x ={{.*}} global double {{.*}}, align 8
|
|
// FP64-X64: @size ={{.*}} global i32 8
|
|
|
|
// FP128: @x ={{.*}} global fp128 {{.*}}, align 16
|
|
// FP128: @size ={{.*}} global i32 16
|
|
|
|
long double foo(long double d) { return d; }
|
|
|
|
// FP64: double @_Z3fooe(double %d)
|
|
// FP80: x86_fp80 @_Z3fooe(x86_fp80 %d)
|
|
// FP128: fp128 @_Z3foog(fp128 %d)
|