summaryrefslogtreecommitdiff
blob: d39eb5d482bb6566f7d9af190813f2fff0d820b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 16337b6a4a14c8eb7ae57341aa04d7d571f00783 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
Date: Fri, 14 Dec 2018 20:43:04 +0100
Subject: [PATCH 04/14] Force -O0 in conform tests to survive $CC changes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In bug #659030 Gentoo started passing user's CFLAGS via $CC variable.
conform tests should but are not ready to handle -O1/-O2 yet.
Tests fail to validate headers due to inlining of weak symbol aliases
and other problems. Let's force it back to -O0 until it's fixed upstream.

Original patch by Sergei, ported to the new python test framework by Andreas

Bug: https://bugs.gentoo.org/659030
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
 conform/conformtest.py   | 6 ++++--
 conform/linknamespace.py | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 94a7ee110f..90c81ac88e 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -566,7 +566,7 @@ class HeaderTests(object):
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
             c_file_out.write('#include <%s>\n%s' % (self.header, text))
-        cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
+        cmd = ('%s %s -O0 -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)
         except subprocess.CalledProcessError:
@@ -620,7 +620,9 @@ class HeaderTests(object):
         out_file = os.path.join(self.temp_dir, 'namespace-out')
         with open(c_file, 'w') as c_file_out:
             c_file_out.write('#include <%s>\n' % self.header)
-        cmd = ('%s %s -E %s -P -Wp,-dN > %s'
+        # -O0 to negate effect of possible -O<N> passed to $CC
+        # See https://bugs.gentoo.org/659030#c6
+        cmd = ('%s -O0 %s -E %s -P -Wp,-dN > %s'
                % (self.cc, self.cflags_namespace, c_file, out_file))
         subprocess.check_call(cmd, shell=True)
         bad_tokens = set()
diff --git a/conform/linknamespace.py b/conform/linknamespace.py
index f7fe3a7a0a..ad87fd2a6d 100644
--- a/conform/linknamespace.py
+++ b/conform/linknamespace.py
@@ -157,7 +157,9 @@ def main():
     files_seen = set()
     all_undef = {}
     current_undef = {}
-    compiler = '%s %s' % (args.cc, args.flags)
+    # -O0 avoid failures like
+    # '[initial] ptsname_r -> [libc.a(ptsname.o)] ptsname'
+    compiler = '%s %s -O0' % (args.cc, args.flags)
     c_syms = glibcconform.list_exported_functions(compiler, args.standard,
                                                   args.header)
     with tempfile.TemporaryDirectory() as temp_dir:
-- 
2.34.1