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
|
From 2cc1e414c8baf7d2e2b9492d3343b0e84508c186 Mon Sep 17 00:00:00 2001
From: Andy Fiddaman <omnios@citrus-it.co.uk>
Date: Mon, 11 Jan 2021 14:09:40 +0000
Subject: 13185 -zassert-deflib does not work for 64-bit objects
---
gcc/gcc.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index eced0d53aae..3b74f3c2970 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7017,15 +7017,34 @@ is_directory (const char *path1, bool linker)
*cp = '\0';
/* Exclude directories that the linker is known to search. */
- if (linker
- && IS_DIR_SEPARATOR (path[0])
- && ((cp - path == 6
- && filename_ncmp (path + 1, "lib", 3) == 0)
- || (cp - path == 10
+ if (linker && IS_DIR_SEPARATOR (path[0])) {
+ size_t len = cp - path;
+
+ if (len >= 6 && filename_ncmp (path + 1, "lib", 3) == 0) {
+ if (len == 6)
+ return 0;
+ if (multilib_os_dir != NULL
+ && len == 6 + strlen(multilib_os_dir) + 1
+ && filename_ncmp(path + 5, multilib_os_dir,
+ strlen(multilib_os_dir)) == 0) {
+ return 0;
+ }
+ }
+
+ if (len >= 10
&& filename_ncmp (path + 1, "usr", 3) == 0
&& IS_DIR_SEPARATOR (path[4])
- && filename_ncmp (path + 5, "lib", 3) == 0)))
- return 0;
+ && filename_ncmp (path + 5, "lib", 3) == 0) {
+ if (len == 10)
+ return 0;
+ if (multilib_os_dir != NULL
+ && len == 10 + strlen(multilib_os_dir) + 1
+ && filename_ncmp(path + 9, multilib_os_dir,
+ strlen(multilib_os_dir)) == 0) {
+ return 0;
+ }
+ }
+ }
return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
}
|