Skip to content

Commit 5fa3ff9

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I5d581e51a88dfea3c0a725101adaa351dad3078a
2 parents 06da300 + f2d500c commit 5fa3ff9

File tree

120 files changed

+6573
-1426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+6573
-1426
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2927,6 +2927,23 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
29272927
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: ignoring relocation from data to data\n");
29282928
}
29292929

2930+
static BinaryFunction *getInitFunctionIfStaticBinary(BinaryContext &BC) {
2931+
// Workaround for https://github.com/llvm/llvm-project/issues/100096
2932+
// ("[BOLT] GOT array pointer incorrectly rewritten"). In aarch64
2933+
// static glibc binaries, the .init section's _init function pointer can
2934+
// alias with a data pointer for the end of an array. GOT rewriting
2935+
// currently can't detect this and updates the data pointer to the
2936+
// moved _init, causing a runtime crash. Skipping _init on the other
2937+
// hand should be harmless.
2938+
if (!BC.IsStaticExecutable)
2939+
return nullptr;
2940+
const BinaryData *BD = BC.getBinaryDataByName("_init");
2941+
if (!BD || BD->getSectionName() != ".init")
2942+
return nullptr;
2943+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: skip _init in for GOT workaround.\n");
2944+
return BC.getBinaryFunctionAtAddress(BD->getAddress());
2945+
}
2946+
29302947
void RewriteInstance::selectFunctionsToProcess() {
29312948
// Extend the list of functions to process or skip from a file.
29322949
auto populateFunctionNames = [](cl::opt<std::string> &FunctionNamesFile,
@@ -3047,6 +3064,9 @@ void RewriteInstance::selectFunctionsToProcess() {
30473064
return true;
30483065
};
30493066

3067+
if (BinaryFunction *Init = getInitFunctionIfStaticBinary(*BC))
3068+
Init->setIgnored();
3069+
30503070
for (auto &BFI : BC->getBinaryFunctions()) {
30513071
BinaryFunction &Function = BFI.second;
30523072

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Regression test for https://github.com/llvm/llvm-project/issues/100096
2+
# static glibc binaries crash on startup because _init is moved and
3+
# shares its address with an array end pointer. The GOT rewriting can't
4+
# tell the two pointers apart and incorrectly updates the _array_end
5+
# address. Test checks that _init is not moved.
6+
7+
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
8+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--section-start=.data=0x1000 -Wl,--section-start=.init=0x1004
9+
# RUN: llvm-bolt %t.exe -o %t.bolt
10+
# RUN: llvm-nm %t.exe | FileCheck --check-prefix=CHECK-ORIGINAL %s
11+
# RUN: llvm-nm %t.bolt | FileCheck --check-prefix=CHECK-BOLTED %s
12+
13+
.section .data
14+
.globl _array_end
15+
_array_start:
16+
.word 0x0
17+
18+
_array_end:
19+
.section .init,"ax",@progbits
20+
.globl _init
21+
22+
# Check that bolt doesn't move _init.
23+
#
24+
# CHECK-ORIGINAL: 0000000000001004 T _init
25+
# CHECK-BOLTED: 0000000000001004 T _init
26+
_init:
27+
ret
28+
29+
.section .text,"ax",@progbits
30+
.globl _start
31+
32+
# Check that bolt is moving some other functions.
33+
#
34+
# CHECK-ORIGINAL: 0000000000001008 T _start
35+
# CHECK-BOLTED-NOT: 0000000000001008 T _start
36+
_start:
37+
bl _init
38+
adrp x0, #:got:_array_end
39+
ldr x0, [x0, #:gotpage_lo15:_array_end]
40+
adrp x0, #:got:_init
41+
ldr x0, [x0, #:gotpage_lo15:_init]
42+
ret
43+

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,10 @@ Modified Compiler Flags
463463
to utilize these vector libraries. The behavior for all other vector function
464464
libraries remains unchanged.
465465

466-
- The ``-Wnontrivial-memaccess`` warning has been updated to also warn about
466+
- The ``-Wnontrivial-memcall`` warning has been added to warn about
467467
passing non-trivially-copyable destrination parameter to ``memcpy``,
468468
``memset`` and similar functions for which it is a documented undefined
469-
behavior.
469+
behavior. It is implied by ``-Wnontrivial-memaccess``
470470

471471
Removed Compiler Flags
472472
-------------------------

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ def SizeofArrayDecay : DiagGroup<"sizeof-array-decay">;
683683
def SizeofPointerMemaccess : DiagGroup<"sizeof-pointer-memaccess">;
684684
def MemsetTransposedArgs : DiagGroup<"memset-transposed-args">;
685685
def DynamicClassMemaccess : DiagGroup<"dynamic-class-memaccess">;
686-
def NonTrivialMemaccess : DiagGroup<"nontrivial-memaccess">;
686+
def NonTrivialMemcall : DiagGroup<"nontrivial-memcall">;
687+
def NonTrivialMemaccess : DiagGroup<"nontrivial-memaccess", [NonTrivialMemcall]>;
687688
def SuspiciousBzero : DiagGroup<"suspicious-bzero">;
688689
def SuspiciousMemaccess : DiagGroup<"suspicious-memaccess",
689690
[SizeofPointerMemaccess, DynamicClassMemaccess,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def warn_cstruct_memaccess : Warning<
798798
def warn_cxxstruct_memaccess : Warning<
799799
"first argument in call to "
800800
"%0 is a pointer to non-trivially copyable type %1">,
801-
InGroup<NonTrivialMemaccess>;
801+
InGroup<NonTrivialMemcall>;
802802
def note_nontrivial_field : Note<
803803
"field is non-trivial to %select{copy|default-initialize}0">;
804804
def err_non_trivial_c_union_in_invalid_context : Error<

clang/lib/Headers/avx512vpopcntdqintrin.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@
2121
__target__("avx512vpopcntdq,evex512"), \
2222
__min_vector_width__(512)))
2323

24-
static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi64(__m512i __A) {
24+
#if defined(__cplusplus) && (__cplusplus >= 201103L)
25+
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
26+
#else
27+
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
28+
#endif
29+
30+
static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
31+
_mm512_popcnt_epi64(__m512i __A) {
2532
return (__m512i)__builtin_elementwise_popcount((__v8du)__A);
2633
}
2734

@@ -36,7 +43,8 @@ _mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
3643
return _mm512_mask_popcnt_epi64((__m512i)_mm512_setzero_si512(), __U, __A);
3744
}
3845

39-
static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi32(__m512i __A) {
46+
static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
47+
_mm512_popcnt_epi32(__m512i __A) {
4048
return (__m512i)__builtin_elementwise_popcount((__v16su)__A);
4149
}
4250

clang/lib/Headers/avx512vpopcntdqvlintrin.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
__target__("avx512vpopcntdq,avx512vl,no-evex512"), \
2626
__min_vector_width__(256)))
2727

28-
static __inline__ __m128i __DEFAULT_FN_ATTRS128
28+
#if defined(__cplusplus) && (__cplusplus >= 201103L)
29+
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
30+
#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
31+
#else
32+
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
33+
#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
34+
#endif
35+
36+
static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2937
_mm_popcnt_epi64(__m128i __A) {
3038
return (__m128i)__builtin_elementwise_popcount((__v2du)__A);
3139
}
@@ -41,7 +49,7 @@ _mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
4149
return _mm_mask_popcnt_epi64((__m128i)_mm_setzero_si128(), __U, __A);
4250
}
4351

44-
static __inline__ __m128i __DEFAULT_FN_ATTRS128
52+
static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4553
_mm_popcnt_epi32(__m128i __A) {
4654
return (__m128i)__builtin_elementwise_popcount((__v4su)__A);
4755
}
@@ -57,7 +65,7 @@ _mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
5765
return _mm_mask_popcnt_epi32((__m128i)_mm_setzero_si128(), __U, __A);
5866
}
5967

60-
static __inline__ __m256i __DEFAULT_FN_ATTRS256
68+
static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6169
_mm256_popcnt_epi64(__m256i __A) {
6270
return (__m256i)__builtin_elementwise_popcount((__v4du)__A);
6371
}
@@ -73,7 +81,7 @@ _mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
7381
return _mm256_mask_popcnt_epi64((__m256i)_mm256_setzero_si256(), __U, __A);
7482
}
7583

76-
static __inline__ __m256i __DEFAULT_FN_ATTRS256
84+
static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
7785
_mm256_popcnt_epi32(__m256i __A) {
7886
return (__m256i)__builtin_elementwise_popcount((__v8su)__A);
7987
}

clang/test/CodeGen/X86/avx512vpopcntdq-builtins.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -emit-llvm -o - -Wall -Werror | FileCheck %s
22

33
#include <immintrin.h>
4+
#include "builtin_test_helpers.h"
45

56
__m512i test_mm512_popcnt_epi64(__m512i __A) {
67
// CHECK-LABEL: @test_mm512_popcnt_epi64
78
// CHECK: @llvm.ctpop.v8i64
89
return _mm512_popcnt_epi64(__A);
910
}
11+
TEST_CONSTEXPR(match_v8di(_mm512_popcnt_epi64((__m512i)(__v8di){+5, -3, -10, +8, 0, -256, +256, -128}), 2, 31, 30, 1, 0, 24, 1, 25));
12+
1013
__m512i test_mm512_mask_popcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
1114
// CHECK-LABEL: @test_mm512_mask_popcnt_epi64
1215
// CHECK: @llvm.ctpop.v8i64
1316
// CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
1417
return _mm512_mask_popcnt_epi64(__W, __U, __A);
1518
}
19+
1620
__m512i test_mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
1721
// CHECK-LABEL: @test_mm512_maskz_popcnt_epi64
1822
// CHECK: @llvm.ctpop.v8i64
1923
// CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
2024
return _mm512_maskz_popcnt_epi64(__U, __A);
2125
}
26+
2227
__m512i test_mm512_popcnt_epi32(__m512i __A) {
2328
// CHECK-LABEL: @test_mm512_popcnt_epi32
2429
// CHECK: @llvm.ctpop.v16i32
2530
return _mm512_popcnt_epi32(__A);
2631
}
32+
TEST_CONSTEXPR(match_v16si(_mm512_popcnt_epi32((__m512i)(__v16si){+5, -3, -10, +8, 0, -256, +256, -128, +3, +9, +15, +33, +63, +129, +511, +1025}), 2, 31, 30, 1, 0, 24, 1, 25, 2, 2, 4, 2, 6, 2, 9, 2));
33+
2734
__m512i test_mm512_mask_popcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
2835
// CHECK-LABEL: @test_mm512_mask_popcnt_epi32
2936
// CHECK: @llvm.ctpop.v16i32
3037
// CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
3138
return _mm512_mask_popcnt_epi32(__W, __U, __A);
3239
}
40+
3341
__m512i test_mm512_maskz_popcnt_epi32(__mmask16 __U, __m512i __A) {
3442
// CHECK-LABEL: @test_mm512_maskz_popcnt_epi32
3543
// CHECK: @llvm.ctpop.v16i32

clang/test/CodeGen/X86/avx512vpopcntdqvl-builtins.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
22

33
#include <immintrin.h>
4+
#include "builtin_test_helpers.h"
45

56
__m128i test_mm_popcnt_epi64(__m128i __A) {
67
// CHECK-LABEL: @test_mm_popcnt_epi64
78
// CHECK: @llvm.ctpop.v2i64
89
return _mm_popcnt_epi64(__A);
910
}
11+
TEST_CONSTEXPR(match_v2di(_mm_popcnt_epi64((__m128i)(__v2di){+5, -3}), 2, 63));
12+
1013
__m128i test_mm_mask_popcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
1114
// CHECK-LABEL: @test_mm_mask_popcnt_epi64
1215
// CHECK: @llvm.ctpop.v2i64
1316
// CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}
1417
return _mm_mask_popcnt_epi64(__W, __U, __A);
1518
}
19+
1620
__m128i test_mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
1721
// CHECK-LABEL: @test_mm_maskz_popcnt_epi64
1822
// CHECK: @llvm.ctpop.v2i64
1923
// CHECK: select <2 x i1> %{{.+}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}
2024
return _mm_maskz_popcnt_epi64(__U, __A);
2125
}
26+
2227
__m128i test_mm_popcnt_epi32(__m128i __A) {
2328
// CHECK-LABEL: @test_mm_popcnt_epi32
2429
// CHECK: @llvm.ctpop.v4i32
2530
return _mm_popcnt_epi32(__A);
2631
}
32+
TEST_CONSTEXPR(match_v4si(_mm_popcnt_epi32((__m128i)(__v4si){+5, -3, -10, +8}), 2, 31, 30, 1));
33+
2734
__m128i test_mm_mask_popcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
2835
// CHECK-LABEL: @test_mm_mask_popcnt_epi32
2936
// CHECK: @llvm.ctpop.v4i32
3037
// CHECK: select <4 x i1> %{{.+}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
3138
return _mm_mask_popcnt_epi32(__W, __U, __A);
3239
}
40+
3341
__m128i test_mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
3442
// CHECK-LABEL: @test_mm_maskz_popcnt_epi32
3543
// CHECK: @llvm.ctpop.v4i32
@@ -42,29 +50,36 @@ __m256i test_mm256_popcnt_epi64(__m256i __A) {
4250
// CHECK: @llvm.ctpop.v4i64
4351
return _mm256_popcnt_epi64(__A);
4452
}
53+
TEST_CONSTEXPR(match_v4di(_mm256_popcnt_epi64((__m256i)(__v4di){+5, -3, -10, +8}), 2, 63, 62, 1));
54+
4555
__m256i test_mm256_mask_popcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
4656
// CHECK-LABEL: @test_mm256_mask_popcnt_epi64
4757
// CHECK: @llvm.ctpop.v4i64
4858
// CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
4959
return _mm256_mask_popcnt_epi64(__W, __U, __A);
5060
}
61+
5162
__m256i test_mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
5263
// CHECK-LABEL: @test_mm256_maskz_popcnt_epi64
5364
// CHECK: @llvm.ctpop.v4i64
5465
// CHECK: select <4 x i1> %{{.+}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
5566
return _mm256_maskz_popcnt_epi64(__U, __A);
5667
}
68+
5769
__m256i test_mm256_popcnt_epi32(__m256i __A) {
5870
// CHECK-LABEL: @test_mm256_popcnt_epi32
5971
// CHECK: @llvm.ctpop.v8i32
6072
return _mm256_popcnt_epi32(__A);
6173
}
74+
TEST_CONSTEXPR(match_v8si(_mm256_popcnt_epi32((__m256i)(__v8si){+5, -3, -10, +8, 0, -256, +256, -128}), 2, 31, 30, 1, 0, 24, 1, 25));
75+
6276
__m256i test_mm256_mask_popcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
6377
// CHECK-LABEL: @test_mm256_mask_popcnt_epi32
6478
// CHECK: @llvm.ctpop.v8i32
6579
// CHECK: select <8 x i1> %{{.+}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}
6680
return _mm256_mask_popcnt_epi32(__W, __U, __A);
6781
}
82+
6883
__m256i test_mm256_maskz_popcnt_epi32(__mmask8 __U, __m256i __A) {
6984
// CHECK-LABEL: @test_mm256_maskz_popcnt_epi32
7085
// CHECK: @llvm.ctpop.v8i32

clang/test/CodeGen/X86/builtin_test_helpers.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ constexpr bool match_m256i(__m256i _v, unsigned long long a, unsigned long long
7373
return v[0] == a && v[1] == b && v[2] == c && v[3] == d;
7474
}
7575

76+
constexpr bool match_v4di(__m256i _v, long long a, long long b, long long c, long long d) {
77+
__v4di v = (__v4di)_v;
78+
return v[0] == a && v[1] == b && v[2] == c && v[3] == d;
79+
}
80+
81+
constexpr bool match_v8si(__m256i _v, int a, int b, int c, int d, int e, int f, int g, int h) {
82+
__v8si v = (__v8si)_v;
83+
return v[0] == a && v[1] == b && v[2] == c && v[3] == d && v[4] == e && v[5] == f && v[6] == g && v[7] == h;
84+
}
85+
7686
constexpr bool match_m512(__m512 v, float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p) {
7787
return v[0] == a && v[1] == b && v[2] == c && v[3] == d && v[4] == e && v[5] == f && v[6] == g && v[7] == h && v[8] == i && v[9] == j && v[10] == k && v[11] == l && v[12] == m && v[13] == n && v[14] == o && v[15] == p;
7888
}
@@ -86,6 +96,16 @@ constexpr bool match_m512i(__m512i _v, unsigned long long a, unsigned long long
8696
return v[0] == a && v[1] == b && v[2] == c && v[3] == d && v[4] == e && v[5] == f && v[6] == g && v[7] == h;
8797
}
8898

99+
constexpr bool match_v8di(__m512i _v, long long a, long long b, long long c, long long d, long long e, long long f, long long g, long long h) {
100+
__v8di v = (__v8di)_v;
101+
return v[0] == a && v[1] == b && v[2] == c && v[3] == d && v[4] == e && v[5] == f && v[6] == g && v[7] == h;
102+
}
103+
104+
constexpr bool match_v16si(__m512i _v, int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p) {
105+
__v16si v = (__v16si)_v;
106+
return v[0] == a && v[1] == b && v[2] == c && v[3] == d && v[4] == e && v[5] == f && v[6] == g && v[7] == h && v[8] == i && v[9] == j && v[10] == k && v[11] == l && v[12] == m && v[13] == n && v[14] == o && v[15] == p;
107+
}
108+
89109
#define TEST_CONSTEXPR(...) static_assert(__VA_ARGS__)
90110

91111
#else

clang/test/SemaCXX/warn-memaccess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wnontrivial-memaccess %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wnontrivial-memcall %s
22

33
extern "C" void *bzero(void *, unsigned);
44
extern "C" void *memset(void *, int, unsigned);

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,12 @@ else ()
849849
if (CAN_TARGET_${arch})
850850
cmake_push_check_state()
851851
# TODO: we should probably make most of the checks in builtin-config depend on the target flags.
852-
message(STATUS "Performing additional configure checks with target flags: ${TARGET_${arch}_CFLAGS}")
853852
set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
854-
list(APPEND CMAKE_REQUIRED_FLAGS ${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}})
853+
# CMAKE_REQUIRED_FLAGS must be a space separated string but unlike TARGET_${arch}_CFLAGS,
854+
# BUILTIN_CFLAGS_${arch} is a CMake list, so we have to join it to create a valid command line.
855+
list(JOIN BUILTIN_CFLAGS " " CMAKE_REQUIRED_FLAGS)
856+
set(CMAKE_REQUIRED_FLAGS "${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}}")
857+
message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}")
855858
# For ARM archs, exclude any VFP builtins if VFP is not supported
856859
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
857860
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ createCopyFunc(mlir::Location loc, lower::AbstractConverter &converter,
744744
mlir::func::FuncOp funcOp =
745745
modBuilder.create<mlir::func::FuncOp>(loc, copyFuncName, funcType);
746746
funcOp.setVisibility(mlir::SymbolTable::Visibility::Private);
747+
fir::factory::setInternalLinkage(funcOp);
747748
builder.createBlock(&funcOp.getRegion(), funcOp.getRegion().end(), argsTy,
748749
{loc, loc});
749750
builder.setInsertionPointToStart(&funcOp.getRegion().back());

flang/lib/Optimizer/OpenMP/LowerWorkshare.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ static mlir::func::FuncOp createCopyFunc(mlir::Location loc, mlir::Type varType,
153153

154154
if (auto decl = module.lookupSymbol<mlir::func::FuncOp>(copyFuncName))
155155
return decl;
156+
156157
// create function
157158
mlir::OpBuilder::InsertionGuard guard(builder);
158159
mlir::OpBuilder modBuilder(module.getBodyRegion());
@@ -161,6 +162,7 @@ static mlir::func::FuncOp createCopyFunc(mlir::Location loc, mlir::Type varType,
161162
mlir::func::FuncOp funcOp =
162163
modBuilder.create<mlir::func::FuncOp>(loc, copyFuncName, funcType);
163164
funcOp.setVisibility(mlir::SymbolTable::Visibility::Private);
165+
fir::factory::setInternalLinkage(funcOp);
164166
builder.createBlock(&funcOp.getRegion(), funcOp.getRegion().end(), argsTy,
165167
{loc, loc});
166168
builder.setInsertionPointToStart(&funcOp.getRegion().back());

0 commit comments

Comments
 (0)