diff options
119 files changed, 1973 insertions, 3853 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index eef45fe4ef..cdec9e4d6c 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -36,6 +36,7 @@ class BBHandledException(Exception): | |||
36 | 36 | ||
37 | import os | 37 | import os |
38 | import logging | 38 | import logging |
39 | from collections import namedtuple | ||
39 | 40 | ||
40 | 41 | ||
41 | class NullHandler(logging.Handler): | 42 | class NullHandler(logging.Handler): |
@@ -227,3 +228,14 @@ def deprecate_import(current, modulename, fromlist, renames = None): | |||
227 | 228 | ||
228 | setattr(sys.modules[current], newname, newobj) | 229 | setattr(sys.modules[current], newname, newobj) |
229 | 230 | ||
231 | TaskData = namedtuple("TaskData", [ | ||
232 | "pn", | ||
233 | "taskname", | ||
234 | "fn", | ||
235 | "deps", | ||
236 | "provides", | ||
237 | "taskhash", | ||
238 | "unihash", | ||
239 | "hashfn", | ||
240 | "taskhash_deps", | ||
241 | ]) | ||
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 25b614f1e4..6318ef4a8f 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -318,9 +318,10 @@ class BBCooker: | |||
318 | try: | 318 | try: |
319 | with hashserv.create_client(upstream) as client: | 319 | with hashserv.create_client(upstream) as client: |
320 | client.ping() | 320 | client.ping() |
321 | except ConnectionError as e: | 321 | except (ConnectionError, ImportError) as e: |
322 | bb.warn("BB_HASHSERVE_UPSTREAM is not valid, unable to connect hash equivalence server at '%s': %s" | 322 | bb.warn("BB_HASHSERVE_UPSTREAM is not valid, unable to connect hash equivalence server at '%s': %s" |
323 | % (upstream, repr(e))) | 323 | % (upstream, repr(e))) |
324 | upstream = None | ||
324 | 325 | ||
325 | self.hashservaddr = "unix://%s/hashserve.sock" % self.data.getVar("TOPDIR") | 326 | self.hashservaddr = "unix://%s/hashserve.sock" % self.data.getVar("TOPDIR") |
326 | self.hashserv = hashserv.create_server( | 327 | self.hashserv = hashserv.create_server( |
@@ -1458,7 +1459,6 @@ class BBCooker: | |||
1458 | 1459 | ||
1459 | if t in task or getAllTaskSignatures: | 1460 | if t in task or getAllTaskSignatures: |
1460 | try: | 1461 | try: |
1461 | rq.rqdata.prepare_task_hash(tid) | ||
1462 | sig.append([pn, t, rq.rqdata.get_task_unihash(tid)]) | 1462 | sig.append([pn, t, rq.rqdata.get_task_unihash(tid)]) |
1463 | except KeyError: | 1463 | except KeyError: |
1464 | sig.append(self.getTaskSignatures(target, [t])[0]) | 1464 | sig.append(self.getTaskSignatures(target, [t])[0]) |
diff --git a/bitbake/lib/bb/fetch2/gcp.py b/bitbake/lib/bb/fetch2/gcp.py index f40ce2eaa5..eb3e0c6a6b 100644 --- a/bitbake/lib/bb/fetch2/gcp.py +++ b/bitbake/lib/bb/fetch2/gcp.py | |||
@@ -23,6 +23,7 @@ import urllib.parse, urllib.error | |||
23 | from bb.fetch2 import FetchMethod | 23 | from bb.fetch2 import FetchMethod |
24 | from bb.fetch2 import FetchError | 24 | from bb.fetch2 import FetchError |
25 | from bb.fetch2 import logger | 25 | from bb.fetch2 import logger |
26 | from bb.fetch2 import runfetchcmd | ||
26 | 27 | ||
27 | class GCP(FetchMethod): | 28 | class GCP(FetchMethod): |
28 | """ | 29 | """ |
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index a4358f1374..7ffdaa6fd7 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py | |||
@@ -49,20 +49,23 @@ class SkipPackage(SkipRecipe): | |||
49 | __mtime_cache = {} | 49 | __mtime_cache = {} |
50 | def cached_mtime(f): | 50 | def cached_mtime(f): |
51 | if f not in __mtime_cache: | 51 | if f not in __mtime_cache: |
52 | __mtime_cache[f] = os.stat(f)[stat.ST_MTIME] | 52 | res = os.stat(f) |
53 | __mtime_cache[f] = (res.st_mtime_ns, res.st_size, res.st_ino) | ||
53 | return __mtime_cache[f] | 54 | return __mtime_cache[f] |
54 | 55 | ||
55 | def cached_mtime_noerror(f): | 56 | def cached_mtime_noerror(f): |
56 | if f not in __mtime_cache: | 57 | if f not in __mtime_cache: |
57 | try: | 58 | try: |
58 | __mtime_cache[f] = os.stat(f)[stat.ST_MTIME] | 59 | res = os.stat(f) |
60 | __mtime_cache[f] = (res.st_mtime_ns, res.st_size, res.st_ino) | ||
59 | except OSError: | 61 | except OSError: |
60 | return 0 | 62 | return 0 |
61 | return __mtime_cache[f] | 63 | return __mtime_cache[f] |
62 | 64 | ||
63 | def check_mtime(f, mtime): | 65 | def check_mtime(f, mtime): |
64 | try: | 66 | try: |
65 | current_mtime = os.stat(f)[stat.ST_MTIME] | 67 | res = os.stat(f) |
68 | current_mtime = (res.st_mtime_ns, res.st_size, res.st_ino) | ||
66 | __mtime_cache[f] = current_mtime | 69 | __mtime_cache[f] = current_mtime |
67 | except OSError: | 70 | except OSError: |
68 | current_mtime = 0 | 71 | current_mtime = 0 |
@@ -70,7 +73,8 @@ def check_mtime(f, mtime): | |||
70 | 73 | ||
71 | def update_mtime(f): | 74 | def update_mtime(f): |
72 | try: | 75 | try: |
73 | __mtime_cache[f] = os.stat(f)[stat.ST_MTIME] | 76 | res = os.stat(f) |
77 | __mtime_cache[f] = (res.st_mtime_ns, res.st_size, res.st_ino) | ||
74 | except OSError: | 78 | except OSError: |
75 | if f in __mtime_cache: | 79 | if f in __mtime_cache: |
76 | del __mtime_cache[f] | 80 | del __mtime_cache[f] |
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index bc7e18175d..93079a9776 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -1273,27 +1273,41 @@ class RunQueueData: | |||
1273 | 1273 | ||
1274 | bb.parse.siggen.set_setscene_tasks(self.runq_setscene_tids) | 1274 | bb.parse.siggen.set_setscene_tasks(self.runq_setscene_tids) |
1275 | 1275 | ||
1276 | starttime = time.time() | ||
1277 | lasttime = starttime | ||
1278 | |||
1276 | # Iterate over the task list and call into the siggen code | 1279 | # Iterate over the task list and call into the siggen code |
1277 | dealtwith = set() | 1280 | dealtwith = set() |
1278 | todeal = set(self.runtaskentries) | 1281 | todeal = set(self.runtaskentries) |
1279 | while todeal: | 1282 | while todeal: |
1283 | ready = set() | ||
1280 | for tid in todeal.copy(): | 1284 | for tid in todeal.copy(): |
1281 | if not (self.runtaskentries[tid].depends - dealtwith): | 1285 | if not (self.runtaskentries[tid].depends - dealtwith): |
1282 | dealtwith.add(tid) | 1286 | self.runtaskentries[tid].taskhash_deps = bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) |
1283 | todeal.remove(tid) | 1287 | # get_taskhash for a given tid *must* be called before get_unihash* below |
1284 | self.prepare_task_hash(tid) | 1288 | self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) |
1285 | bb.event.check_for_interrupts(self.cooker.data) | 1289 | ready.add(tid) |
1290 | unihashes = bb.parse.siggen.get_unihashes(ready) | ||
1291 | for tid in ready: | ||
1292 | dealtwith.add(tid) | ||
1293 | todeal.remove(tid) | ||
1294 | self.runtaskentries[tid].unihash = unihashes[tid] | ||
1295 | |||
1296 | bb.event.check_for_interrupts(self.cooker.data) | ||
1297 | |||
1298 | if time.time() > (lasttime + 30): | ||
1299 | lasttime = time.time() | ||
1300 | hashequiv_logger.verbose("Initial setup loop progress: %s of %s in %s" % (len(todeal), len(self.runtaskentries), lasttime - starttime)) | ||
1301 | |||
1302 | endtime = time.time() | ||
1303 | if (endtime-starttime > 60): | ||
1304 | hashequiv_logger.verbose("Initial setup loop took: %s" % (endtime-starttime)) | ||
1286 | 1305 | ||
1287 | bb.parse.siggen.writeout_file_checksum_cache() | 1306 | bb.parse.siggen.writeout_file_checksum_cache() |
1288 | 1307 | ||
1289 | #self.dump_data() | 1308 | #self.dump_data() |
1290 | return len(self.runtaskentries) | 1309 | return len(self.runtaskentries) |
1291 | 1310 | ||
1292 | def prepare_task_hash(self, tid): | ||
1293 | bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) | ||
1294 | self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) | ||
1295 | self.runtaskentries[tid].unihash = bb.parse.siggen.get_unihash(tid) | ||
1296 | |||
1297 | def dump_data(self): | 1311 | def dump_data(self): |
1298 | """ | 1312 | """ |
1299 | Dump some debug information on the internal data structures | 1313 | Dump some debug information on the internal data structures |
@@ -2438,14 +2452,17 @@ class RunQueueExecute: | |||
2438 | taskdepdata_cache = {} | 2452 | taskdepdata_cache = {} |
2439 | for task in self.rqdata.runtaskentries: | 2453 | for task in self.rqdata.runtaskentries: |
2440 | (mc, fn, taskname, taskfn) = split_tid_mcfn(task) | 2454 | (mc, fn, taskname, taskfn) = split_tid_mcfn(task) |
2441 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] | 2455 | taskdepdata_cache[task] = bb.TaskData( |
2442 | deps = self.rqdata.runtaskentries[task].depends | 2456 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn], |
2443 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] | 2457 | taskname = taskname, |
2444 | taskhash = self.rqdata.runtaskentries[task].hash | 2458 | fn = fn, |
2445 | unihash = self.rqdata.runtaskentries[task].unihash | 2459 | deps = self.filtermcdeps(task, mc, self.rqdata.runtaskentries[task].depends), |
2446 | deps = self.filtermcdeps(task, mc, deps) | 2460 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn], |
2447 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] | 2461 | taskhash = self.rqdata.runtaskentries[task].hash, |
2448 | taskdepdata_cache[task] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn] | 2462 | unihash = self.rqdata.runtaskentries[task].unihash, |
2463 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn], | ||
2464 | taskhash_deps = self.rqdata.runtaskentries[task].taskhash_deps, | ||
2465 | ) | ||
2449 | 2466 | ||
2450 | self.taskdepdata_cache = taskdepdata_cache | 2467 | self.taskdepdata_cache = taskdepdata_cache |
2451 | 2468 | ||
@@ -2460,9 +2477,11 @@ class RunQueueExecute: | |||
2460 | while next: | 2477 | while next: |
2461 | additional = [] | 2478 | additional = [] |
2462 | for revdep in next: | 2479 | for revdep in next: |
2463 | self.taskdepdata_cache[revdep][6] = self.rqdata.runtaskentries[revdep].unihash | 2480 | self.taskdepdata_cache[revdep] = self.taskdepdata_cache[revdep]._replace( |
2481 | unihash=self.rqdata.runtaskentries[revdep].unihash | ||
2482 | ) | ||
2464 | taskdepdata[revdep] = self.taskdepdata_cache[revdep] | 2483 | taskdepdata[revdep] = self.taskdepdata_cache[revdep] |
2465 | for revdep2 in self.taskdepdata_cache[revdep][3]: | 2484 | for revdep2 in self.taskdepdata_cache[revdep].deps: |
2466 | if revdep2 not in taskdepdata: | 2485 | if revdep2 not in taskdepdata: |
2467 | additional.append(revdep2) | 2486 | additional.append(revdep2) |
2468 | next = additional | 2487 | next = additional |
@@ -2556,17 +2575,28 @@ class RunQueueExecute: | |||
2556 | elif self.rqdata.runtaskentries[p].depends.isdisjoint(total): | 2575 | elif self.rqdata.runtaskentries[p].depends.isdisjoint(total): |
2557 | next.add(p) | 2576 | next.add(p) |
2558 | 2577 | ||
2578 | starttime = time.time() | ||
2579 | lasttime = starttime | ||
2580 | |||
2559 | # When an item doesn't have dependencies in total, we can process it. Drop items from total when handled | 2581 | # When an item doesn't have dependencies in total, we can process it. Drop items from total when handled |
2560 | while next: | 2582 | while next: |
2561 | current = next.copy() | 2583 | current = next.copy() |
2562 | next = set() | 2584 | next = set() |
2585 | ready = {} | ||
2563 | for tid in current: | 2586 | for tid in current: |
2564 | if self.rqdata.runtaskentries[p].depends and not self.rqdata.runtaskentries[tid].depends.isdisjoint(total): | 2587 | if self.rqdata.runtaskentries[p].depends and not self.rqdata.runtaskentries[tid].depends.isdisjoint(total): |
2565 | continue | 2588 | continue |
2589 | # get_taskhash for a given tid *must* be called before get_unihash* below | ||
2590 | ready[tid] = bb.parse.siggen.get_taskhash(tid, self.rqdata.runtaskentries[tid].depends, self.rqdata.dataCaches) | ||
2591 | |||
2592 | unihashes = bb.parse.siggen.get_unihashes(ready.keys()) | ||
2593 | |||
2594 | for tid in ready: | ||
2566 | orighash = self.rqdata.runtaskentries[tid].hash | 2595 | orighash = self.rqdata.runtaskentries[tid].hash |
2567 | newhash = bb.parse.siggen.get_taskhash(tid, self.rqdata.runtaskentries[tid].depends, self.rqdata.dataCaches) | 2596 | newhash = ready[tid] |
2568 | origuni = self.rqdata.runtaskentries[tid].unihash | 2597 | origuni = self.rqdata.runtaskentries[tid].unihash |
2569 | newuni = bb.parse.siggen.get_unihash(tid) | 2598 | newuni = unihashes[tid] |
2599 | |||
2570 | # FIXME, need to check it can come from sstate at all for determinism? | 2600 | # FIXME, need to check it can come from sstate at all for determinism? |
2571 | remapped = False | 2601 | remapped = False |
2572 | if newuni == origuni: | 2602 | if newuni == origuni: |
@@ -2587,6 +2617,15 @@ class RunQueueExecute: | |||
2587 | next |= self.rqdata.runtaskentries[tid].revdeps | 2617 | next |= self.rqdata.runtaskentries[tid].revdeps |
2588 | total.remove(tid) | 2618 | total.remove(tid) |
2589 | next.intersection_update(total) | 2619 | next.intersection_update(total) |
2620 | bb.event.check_for_interrupts(self.cooker.data) | ||
2621 | |||
2622 | if time.time() > (lasttime + 30): | ||
2623 | lasttime = time.time() | ||
2624 | hashequiv_logger.verbose("Rehash loop slow progress: %s in %s" % (len(total), lasttime - starttime)) | ||
2625 | |||
2626 | endtime = time.time() | ||
2627 | if (endtime-starttime > 60): | ||
2628 | hashequiv_logger.verbose("Rehash loop took more than 60s: %s" % (endtime-starttime)) | ||
2590 | 2629 | ||
2591 | if changed: | 2630 | if changed: |
2592 | for mc in self.rq.worker: | 2631 | for mc in self.rq.worker: |
@@ -2806,13 +2845,19 @@ class RunQueueExecute: | |||
2806 | additional = [] | 2845 | additional = [] |
2807 | for revdep in next: | 2846 | for revdep in next: |
2808 | (mc, fn, taskname, taskfn) = split_tid_mcfn(revdep) | 2847 | (mc, fn, taskname, taskfn) = split_tid_mcfn(revdep) |
2809 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] | ||
2810 | deps = getsetscenedeps(revdep) | 2848 | deps = getsetscenedeps(revdep) |
2811 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] | 2849 | |
2812 | taskhash = self.rqdata.runtaskentries[revdep].hash | 2850 | taskdepdata[revdep] = bb.TaskData( |
2813 | unihash = self.rqdata.runtaskentries[revdep].unihash | 2851 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn], |
2814 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] | 2852 | taskname = taskname, |
2815 | taskdepdata[revdep] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn] | 2853 | fn = fn, |
2854 | deps = deps, | ||
2855 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn], | ||
2856 | taskhash = self.rqdata.runtaskentries[revdep].hash, | ||
2857 | unihash = self.rqdata.runtaskentries[revdep].unihash, | ||
2858 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn], | ||
2859 | taskhash_deps = self.rqdata.runtaskentries[revdep].taskhash_deps, | ||
2860 | ) | ||
2816 | for revdep2 in deps: | 2861 | for revdep2 in deps: |
2817 | if revdep2 not in taskdepdata: | 2862 | if revdep2 not in taskdepdata: |
2818 | additional.append(revdep2) | 2863 | additional.append(revdep2) |
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 8ab08ec961..65ca0811d5 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -381,7 +381,7 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
381 | self.taints[tid] = taint | 381 | self.taints[tid] = taint |
382 | logger.warning("%s is tainted from a forced run" % tid) | 382 | logger.warning("%s is tainted from a forced run" % tid) |
383 | 383 | ||
384 | return | 384 | return set(dep for _, dep in self.runtaskdeps[tid]) |
385 | 385 | ||
386 | def get_taskhash(self, tid, deps, dataCaches): | 386 | def get_taskhash(self, tid, deps, dataCaches): |
387 | 387 | ||
@@ -726,10 +726,13 @@ class SignatureGeneratorUniHashMixIn(object): | |||
726 | return result | 726 | return result |
727 | 727 | ||
728 | if self.max_parallel <= 1 or len(queries) <= 1: | 728 | if self.max_parallel <= 1 or len(queries) <= 1: |
729 | # No parallelism required. Make the query serially with the single client | 729 | # No parallelism required. Make the query using a single client |
730 | with self.client() as client: | 730 | with self.client() as client: |
731 | for tid, args in queries.items(): | 731 | keys = list(queries.keys()) |
732 | query_result[tid] = client.get_unihash(*args) | 732 | unihashes = client.get_unihash_batch(queries[k] for k in keys) |
733 | |||
734 | for idx, k in enumerate(keys): | ||
735 | query_result[k] = unihashes[idx] | ||
733 | else: | 736 | else: |
734 | with self.client_pool() as client_pool: | 737 | with self.client_pool() as client_pool: |
735 | query_result = client_pool.get_unihashes(queries) | 738 | query_result = client_pool.get_unihashes(queries) |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 85c1f79ff3..8a91f51d36 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1421,7 +1421,7 @@ class FetchLatestVersionTest(FetcherTest): | |||
1421 | # combination version pattern | 1421 | # combination version pattern |
1422 | ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https;branch=master", "cd44ee6644c3641507fb53b8a2a69137f2971219", "", "") | 1422 | ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https;branch=master", "cd44ee6644c3641507fb53b8a2a69137f2971219", "", "") |
1423 | : "1.2.0", | 1423 | : "1.2.0", |
1424 | ("u-boot-mkimage", "git://git.denx.de/u-boot.git;branch=master;protocol=git", "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c", "", "") | 1424 | ("u-boot-mkimage", "git://source.denx.de/u-boot/u-boot.git;branch=master;protocol=https", "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c", "", "") |
1425 | : "2014.01", | 1425 | : "2014.01", |
1426 | # version pattern "yyyymmdd" | 1426 | # version pattern "yyyymmdd" |
1427 | ("mobile-broadband-provider-info", "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https;branch=master", "4ed19e11c2975105b71b956440acdb25d46a347d", "", "") | 1427 | ("mobile-broadband-provider-info", "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https;branch=master", "4ed19e11c2975105b71b956440acdb25d46a347d", "", "") |
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py index 0b254beddd..775faf935a 100644 --- a/bitbake/lib/hashserv/client.py +++ b/bitbake/lib/hashserv/client.py | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | import logging | 6 | import logging |
7 | import socket | 7 | import socket |
8 | import asyncio | ||
8 | import bb.asyncrpc | 9 | import bb.asyncrpc |
9 | import json | 10 | import json |
10 | from . import create_async_client | 11 | from . import create_async_client |
@@ -13,6 +14,66 @@ from . import create_async_client | |||
13 | logger = logging.getLogger("hashserv.client") | 14 | logger = logging.getLogger("hashserv.client") |
14 | 15 | ||
15 | 16 | ||
17 | class Batch(object): | ||
18 | def __init__(self): | ||
19 | self.done = False | ||
20 | self.cond = asyncio.Condition() | ||
21 | self.pending = [] | ||
22 | self.results = [] | ||
23 | self.sent_count = 0 | ||
24 | |||
25 | async def recv(self, socket): | ||
26 | while True: | ||
27 | async with self.cond: | ||
28 | await self.cond.wait_for(lambda: self.pending or self.done) | ||
29 | |||
30 | if not self.pending: | ||
31 | if self.done: | ||
32 | return | ||
33 | continue | ||
34 | |||
35 | r = await socket.recv() | ||
36 | self.results.append(r) | ||
37 | |||
38 | async with self.cond: | ||
39 | self.pending.pop(0) | ||
40 | |||
41 | async def send(self, socket, msgs): | ||
42 | try: | ||
43 | # In the event of a restart due to a reconnect, all in-flight | ||
44 | # messages need to be resent first to keep to result count in sync | ||
45 | for m in self.pending: | ||
46 | await socket.send(m) | ||
47 | |||
48 | for m in msgs: | ||
49 | # Add the message to the pending list before attempting to send | ||
50 | # it so that if the send fails it will be retried | ||
51 | async with self.cond: | ||
52 | self.pending.append(m) | ||
53 | self.cond.notify() | ||
54 | self.sent_count += 1 | ||
55 | |||
56 | await socket.send(m) | ||
57 | |||
58 | finally: | ||
59 | async with self.cond: | ||
60 | self.done = True | ||
61 | self.cond.notify() | ||
62 | |||
63 | async def process(self, socket, msgs): | ||
64 | await asyncio.gather( | ||
65 | self.recv(socket), | ||
66 | self.send(socket, msgs), | ||
67 | ) | ||
68 | |||
69 | if len(self.results) != self.sent_count: | ||
70 | raise ValueError( | ||
71 | f"Expected result count {len(self.results)}. Expected {self.sent_count}" | ||
72 | ) | ||
73 | |||
74 | return self.results | ||
75 | |||
76 | |||
16 | class AsyncClient(bb.asyncrpc.AsyncClient): | 77 | class AsyncClient(bb.asyncrpc.AsyncClient): |
17 | MODE_NORMAL = 0 | 78 | MODE_NORMAL = 0 |
18 | MODE_GET_STREAM = 1 | 79 | MODE_GET_STREAM = 1 |
@@ -36,11 +97,27 @@ class AsyncClient(bb.asyncrpc.AsyncClient): | |||
36 | if become: | 97 | if become: |
37 | await self.become_user(become) | 98 | await self.become_user(become) |
38 | 99 | ||
39 | async def send_stream(self, mode, msg): | 100 | async def send_stream_batch(self, mode, msgs): |
101 | """ | ||
102 | Does a "batch" process of stream messages. This sends the query | ||
103 | messages as fast as possible, and simultaneously attempts to read the | ||
104 | messages back. This helps to mitigate the effects of latency to the | ||
105 | hash equivalence server be allowing multiple queries to be "in-flight" | ||
106 | at once | ||
107 | |||
108 | The implementation does more complicated tracking using a count of sent | ||
109 | messages so that `msgs` can be a generator function (i.e. its length is | ||
110 | unknown) | ||
111 | |||
112 | """ | ||
113 | |||
114 | b = Batch() | ||
115 | |||
40 | async def proc(): | 116 | async def proc(): |
117 | nonlocal b | ||
118 | |||
41 | await self._set_mode(mode) | 119 | await self._set_mode(mode) |
42 | await self.socket.send(msg) | 120 | return await b.process(self.socket, msgs) |
43 | return await self.socket.recv() | ||
44 | 121 | ||
45 | return await self._send_wrapper(proc) | 122 | return await self._send_wrapper(proc) |
46 | 123 | ||
@@ -89,10 +166,15 @@ class AsyncClient(bb.asyncrpc.AsyncClient): | |||
89 | self.mode = new_mode | 166 | self.mode = new_mode |
90 | 167 | ||
91 | async def get_unihash(self, method, taskhash): | 168 | async def get_unihash(self, method, taskhash): |
92 | r = await self.send_stream(self.MODE_GET_STREAM, "%s %s" % (method, taskhash)) | 169 | r = await self.get_unihash_batch([(method, taskhash)]) |
93 | if not r: | 170 | return r[0] |
94 | return None | 171 | |
95 | return r | 172 | async def get_unihash_batch(self, args): |
173 | result = await self.send_stream_batch( | ||
174 | self.MODE_GET_STREAM, | ||
175 | (f"{method} {taskhash}" for method, taskhash in args), | ||
176 | ) | ||
177 | return [r if r else None for r in result] | ||
96 | 178 | ||
97 | async def report_unihash(self, taskhash, method, outhash, unihash, extra={}): | 179 | async def report_unihash(self, taskhash, method, outhash, unihash, extra={}): |
98 | m = extra.copy() | 180 | m = extra.copy() |
@@ -115,8 +197,12 @@ class AsyncClient(bb.asyncrpc.AsyncClient): | |||
115 | ) | 197 | ) |
116 | 198 | ||
117 | async def unihash_exists(self, unihash): | 199 | async def unihash_exists(self, unihash): |
118 | r = await self.send_stream(self.MODE_EXIST_STREAM, unihash) | 200 | r = await self.unihash_exists_batch([unihash]) |
119 | return r == "true" | 201 | return r[0] |
202 | |||
203 | async def unihash_exists_batch(self, unihashes): | ||
204 | result = await self.send_stream_batch(self.MODE_EXIST_STREAM, unihashes) | ||
205 | return [r == "true" for r in result] | ||
120 | 206 | ||
121 | async def get_outhash(self, method, outhash, taskhash, with_unihash=True): | 207 | async def get_outhash(self, method, outhash, taskhash, with_unihash=True): |
122 | return await self.invoke( | 208 | return await self.invoke( |
@@ -237,10 +323,12 @@ class Client(bb.asyncrpc.Client): | |||
237 | "connect_tcp", | 323 | "connect_tcp", |
238 | "connect_websocket", | 324 | "connect_websocket", |
239 | "get_unihash", | 325 | "get_unihash", |
326 | "get_unihash_batch", | ||
240 | "report_unihash", | 327 | "report_unihash", |
241 | "report_unihash_equiv", | 328 | "report_unihash_equiv", |
242 | "get_taskhash", | 329 | "get_taskhash", |
243 | "unihash_exists", | 330 | "unihash_exists", |
331 | "unihash_exists_batch", | ||
244 | "get_outhash", | 332 | "get_outhash", |
245 | "get_stats", | 333 | "get_stats", |
246 | "reset_stats", | 334 | "reset_stats", |
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index 0809453cf8..5349cd5867 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -594,6 +594,43 @@ class HashEquivalenceCommonTests(object): | |||
594 | 7: None, | 594 | 7: None, |
595 | }) | 595 | }) |
596 | 596 | ||
597 | def test_get_unihash_batch(self): | ||
598 | TEST_INPUT = ( | ||
599 | # taskhash outhash unihash | ||
600 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', 'afe240a439959ce86f5e322f8c208e1fedefea9e813f2140c81af866cc9edf7e','218e57509998197d570e2c98512d0105985dffc9'), | ||
601 | # Duplicated taskhash with multiple output hashes and unihashes. | ||
602 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', 'ae9a7d252735f0dafcdb10e2e02561ca3a47314c'), | ||
603 | # Equivalent hash | ||
604 | ("044c2ec8aaf480685a00ff6ff49e6162e6ad34e1", '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', "def64766090d28f627e816454ed46894bb3aab36"), | ||
605 | ("e3da00593d6a7fb435c7e2114976c59c5fd6d561", "1cf8713e645f491eb9c959d20b5cae1c47133a292626dda9b10709857cbe688a", "3b5d3d83f07f259e9086fcb422c855286e18a57d"), | ||
606 | ('35788efcb8dfb0a02659d81cf2bfd695fb30faf9', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2cd'), | ||
607 | ('35788efcb8dfb0a02659d81cf2bfd695fb30fafa', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2ce'), | ||
608 | ('9d81d76242cc7cfaf7bf74b94b9cd2e29324ed74', '8470d56547eea6236d7c81a644ce74670ca0bbda998e13c629ef6bb3f0d60b69', '05d2a63c81e32f0a36542ca677e8ad852365c538'), | ||
609 | ) | ||
610 | EXTRA_QUERIES = ( | ||
611 | "6b6be7a84ab179b4240c4302518dc3f6", | ||
612 | ) | ||
613 | |||
614 | for taskhash, outhash, unihash in TEST_INPUT: | ||
615 | self.client.report_unihash(taskhash, self.METHOD, outhash, unihash) | ||
616 | |||
617 | |||
618 | result = self.client.get_unihash_batch( | ||
619 | [(self.METHOD, data[0]) for data in TEST_INPUT] + | ||
620 | [(self.METHOD, e) for e in EXTRA_QUERIES] | ||
621 | ) | ||
622 | |||
623 | self.assertListEqual(result, [ | ||
624 | "218e57509998197d570e2c98512d0105985dffc9", | ||
625 | "218e57509998197d570e2c98512d0105985dffc9", | ||
626 | "218e57509998197d570e2c98512d0105985dffc9", | ||
627 | "3b5d3d83f07f259e9086fcb422c855286e18a57d", | ||
628 | "f46d3fbb439bd9b921095da657a4de906510d2cd", | ||
629 | "f46d3fbb439bd9b921095da657a4de906510d2cd", | ||
630 | "05d2a63c81e32f0a36542ca677e8ad852365c538", | ||
631 | None, | ||
632 | ]) | ||
633 | |||
597 | def test_client_pool_unihash_exists(self): | 634 | def test_client_pool_unihash_exists(self): |
598 | TEST_INPUT = ( | 635 | TEST_INPUT = ( |
599 | # taskhash outhash unihash | 636 | # taskhash outhash unihash |
@@ -636,6 +673,44 @@ class HashEquivalenceCommonTests(object): | |||
636 | result = client_pool.unihashes_exist(query) | 673 | result = client_pool.unihashes_exist(query) |
637 | self.assertDictEqual(result, expected) | 674 | self.assertDictEqual(result, expected) |
638 | 675 | ||
676 | def test_unihash_exists_batch(self): | ||
677 | TEST_INPUT = ( | ||
678 | # taskhash outhash unihash | ||
679 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', 'afe240a439959ce86f5e322f8c208e1fedefea9e813f2140c81af866cc9edf7e','218e57509998197d570e2c98512d0105985dffc9'), | ||
680 | # Duplicated taskhash with multiple output hashes and unihashes. | ||
681 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', 'ae9a7d252735f0dafcdb10e2e02561ca3a47314c'), | ||
682 | # Equivalent hash | ||
683 | ("044c2ec8aaf480685a00ff6ff49e6162e6ad34e1", '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', "def64766090d28f627e816454ed46894bb3aab36"), | ||
684 | ("e3da00593d6a7fb435c7e2114976c59c5fd6d561", "1cf8713e645f491eb9c959d20b5cae1c47133a292626dda9b10709857cbe688a", "3b5d3d83f07f259e9086fcb422c855286e18a57d"), | ||
685 | ('35788efcb8dfb0a02659d81cf2bfd695fb30faf9', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2cd'), | ||
686 | ('35788efcb8dfb0a02659d81cf2bfd695fb30fafa', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2ce'), | ||
687 | ('9d81d76242cc7cfaf7bf74b94b9cd2e29324ed74', '8470d56547eea6236d7c81a644ce74670ca0bbda998e13c629ef6bb3f0d60b69', '05d2a63c81e32f0a36542ca677e8ad852365c538'), | ||
688 | ) | ||
689 | EXTRA_QUERIES = ( | ||
690 | "6b6be7a84ab179b4240c4302518dc3f6", | ||
691 | ) | ||
692 | |||
693 | result_unihashes = set() | ||
694 | |||
695 | |||
696 | for taskhash, outhash, unihash in TEST_INPUT: | ||
697 | result = self.client.report_unihash(taskhash, self.METHOD, outhash, unihash) | ||
698 | result_unihashes.add(result["unihash"]) | ||
699 | |||
700 | query = [] | ||
701 | expected = [] | ||
702 | |||
703 | for _, _, unihash in TEST_INPUT: | ||
704 | query.append(unihash) | ||
705 | expected.append(unihash in result_unihashes) | ||
706 | |||
707 | |||
708 | for unihash in EXTRA_QUERIES: | ||
709 | query.append(unihash) | ||
710 | expected.append(False) | ||
711 | |||
712 | result = self.client.unihash_exists_batch(query) | ||
713 | self.assertListEqual(result, expected) | ||
639 | 714 | ||
640 | def test_auth_read_perms(self): | 715 | def test_auth_read_perms(self): |
641 | admin_client = self.start_auth_server() | 716 | admin_client = self.start_auth_server() |
diff --git a/meta-selftest/classes/localpkgfeed.bbclass b/meta-selftest/classes/localpkgfeed.bbclass new file mode 100644 index 0000000000..b796375e55 --- /dev/null +++ b/meta-selftest/classes/localpkgfeed.bbclass | |||
@@ -0,0 +1,27 @@ | |||
1 | # Create a subset of the package feed that just contain the | ||
2 | # packages depended on by this recipe. | ||
3 | |||
4 | LOCALPKGFEED_DIR = "${WORKDIR}/localpkgfeed" | ||
5 | |||
6 | addtask localpkgfeed after do_build | ||
7 | do_localpkgfeed[cleandirs] = "${LOCALPKGFEED_DIR}" | ||
8 | do_localpkgfeed[nostamp] = "1" | ||
9 | |||
10 | def get_packaging_class(d): | ||
11 | package_class = d.getVar("PACKAGE_CLASSES").split()[0] | ||
12 | return package_class.replace("package_", "") | ||
13 | |||
14 | python () { | ||
15 | packaging = get_packaging_class(d) | ||
16 | d.setVarFlag("do_localpkgfeed", "rdeptask", "do_package_write_" + packaging) | ||
17 | } | ||
18 | |||
19 | python do_localpkgfeed() { | ||
20 | import oe.package_manager | ||
21 | |||
22 | packaging = get_packaging_class(d) | ||
23 | deploydir = d.getVar("DEPLOY_DIR_" + packaging.upper()) | ||
24 | task = "package_write_" + packaging | ||
25 | |||
26 | oe.package_manager.create_packages_dir(d, d.getVar("LOCALPKGFEED_DIR"), deploydir, task, True, True) | ||
27 | } | ||
diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass index cc3564c36a..d32509aa6d 100644 --- a/meta/classes-recipe/go.bbclass +++ b/meta/classes-recipe/go.bbclass | |||
@@ -48,8 +48,6 @@ GO_RPATH:class-native = "${@'-r ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE | |||
48 | GO_RPATH_LINK:class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}" | 48 | GO_RPATH_LINK:class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}" |
49 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}" | 49 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}" |
50 | GO_LINKMODE ?= "" | 50 | GO_LINKMODE ?= "" |
51 | GO_LINKMODE:class-nativesdk = "--linkmode=external" | ||
52 | GO_LINKMODE:class-native = "--linkmode=external" | ||
53 | GO_EXTRA_LDFLAGS ?= "" | 51 | GO_EXTRA_LDFLAGS ?= "" |
54 | GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}" | 52 | GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}" |
55 | # Use system loader. If uninative is used, the uninative loader will be patched automatically | 53 | # Use system loader. If uninative is used, the uninative loader will be patched automatically |
diff --git a/meta/classes-recipe/goarch.bbclass b/meta/classes-recipe/goarch.bbclass index 6899ec28e4..1ebe03864f 100644 --- a/meta/classes-recipe/goarch.bbclass +++ b/meta/classes-recipe/goarch.bbclass | |||
@@ -38,13 +38,13 @@ BASE_GOARM:armv5 = '5' | |||
38 | # Go supports dynamic linking on a limited set of architectures. | 38 | # Go supports dynamic linking on a limited set of architectures. |
39 | # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go | 39 | # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go |
40 | GO_DYNLINK = "" | 40 | GO_DYNLINK = "" |
41 | GO_DYNLINK:arm = "" | 41 | GO_DYNLINK:arm ?= "1" |
42 | GO_DYNLINK:aarch64 = "" | 42 | GO_DYNLINK:aarch64 ?= "1" |
43 | GO_DYNLINK:x86 = "" | 43 | GO_DYNLINK:x86 ?= "1" |
44 | GO_DYNLINK:x86-64 = "" | 44 | GO_DYNLINK:x86-64 ?= "1" |
45 | GO_DYNLINK:powerpc64 = "" | 45 | GO_DYNLINK:powerpc64 ?= "1" |
46 | GO_DYNLINK:powerpc64le = "" | 46 | GO_DYNLINK:powerpc64le ?= "1" |
47 | GO_DYNLINK:class-native = "" | 47 | GO_DYNLINK:class-native ?= "" |
48 | GO_DYNLINK:class-nativesdk = "" | 48 | GO_DYNLINK:class-nativesdk = "" |
49 | 49 | ||
50 | # define here because everybody inherits this class | 50 | # define here because everybody inherits this class |
diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass index 913cb8788c..2f948ecbf8 100644 --- a/meta/classes-recipe/image_types.bbclass +++ b/meta/classes-recipe/image_types.bbclass | |||
@@ -112,18 +112,22 @@ IMAGE_CMD:btrfs () { | |||
112 | } | 112 | } |
113 | 113 | ||
114 | oe_mksquashfs () { | 114 | oe_mksquashfs () { |
115 | local comp=$1 | 115 | local comp=$1; shift |
116 | local suffix=$2 | 116 | local extra_imagecmd="$@" |
117 | |||
118 | if [ "$comp" = "zstd" ]; then | ||
119 | suffix="zst" | ||
120 | fi | ||
117 | 121 | ||
118 | # Use the bitbake reproducible timestamp instead of the hardcoded squashfs one | 122 | # Use the bitbake reproducible timestamp instead of the hardcoded squashfs one |
119 | export SOURCE_DATE_EPOCH=$(stat -c '%Y' ${IMAGE_ROOTFS}) | 123 | export SOURCE_DATE_EPOCH=$(stat -c '%Y' ${IMAGE_ROOTFS}) |
120 | mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}.squashfs${comp:+-}${suffix:-$comp} ${EXTRA_IMAGECMD} -noappend ${comp:+-comp }$comp | 124 | mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}.squashfs${comp:+-}${suffix:-$comp} -noappend ${comp:+-comp }$comp $extra_imagecmd |
121 | } | 125 | } |
122 | IMAGE_CMD:squashfs = "oe_mksquashfs" | 126 | IMAGE_CMD:squashfs = "oe_mksquashfs '' ${EXTRA_IMAGECMD}" |
123 | IMAGE_CMD:squashfs-xz = "oe_mksquashfs xz" | 127 | IMAGE_CMD:squashfs-xz = "oe_mksquashfs xz ${EXTRA_IMAGECMD}" |
124 | IMAGE_CMD:squashfs-lzo = "oe_mksquashfs lzo" | 128 | IMAGE_CMD:squashfs-lzo = "oe_mksquashfs lzo ${EXTRA_IMAGECMD}" |
125 | IMAGE_CMD:squashfs-lz4 = "oe_mksquashfs lz4" | 129 | IMAGE_CMD:squashfs-lz4 = "oe_mksquashfs lz4 ${EXTRA_IMAGECMD}" |
126 | IMAGE_CMD:squashfs-zst = "oe_mksquashfs zstd zst" | 130 | IMAGE_CMD:squashfs-zst = "oe_mksquashfs zstd ${EXTRA_IMAGECMD}" |
127 | 131 | ||
128 | IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}.erofs ${IMAGE_ROOTFS}" | 132 | IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}.erofs ${IMAGE_ROOTFS}" |
129 | IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}.erofs-lz4 ${IMAGE_ROOTFS}" | 133 | IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}.erofs-lz4 ${IMAGE_ROOTFS}" |
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index b084d6d69d..c0a2056fec 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass | |||
@@ -463,7 +463,7 @@ kernel_do_install() { | |||
463 | rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" | 463 | rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" |
464 | rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" | 464 | rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" |
465 | # Remove empty module directories to prevent QA issues | 465 | # Remove empty module directories to prevent QA issues |
466 | find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete | 466 | [ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete |
467 | else | 467 | else |
468 | bbnote "no modules to install" | 468 | bbnote "no modules to install" |
469 | fi | 469 | fi |
diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 7a0b8047e4..c8e097f2f2 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass | |||
@@ -367,7 +367,7 @@ do_uboot_assemble_fitimage() { | |||
367 | done | 367 | done |
368 | 368 | ||
369 | for binary in ${UBOOT_BINARIES}; do | 369 | for binary in ${UBOOT_BINARIES}; do |
370 | k=$(expr $j + 1); | 370 | k=$(expr $k + 1); |
371 | if [ $k -eq $i ]; then | 371 | if [ $k -eq $i ]; then |
372 | break; | 372 | break; |
373 | fi | 373 | fi |
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 20eb3a0446..58ef13f423 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -190,7 +190,7 @@ RECIPE_MAINTAINER:pn-gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <r | |||
190 | RECIPE_MAINTAINER:pn-gcc-crosssdk-${SDK_SYS} = "Khem Raj <raj.khem@gmail.com>" | 190 | RECIPE_MAINTAINER:pn-gcc-crosssdk-${SDK_SYS} = "Khem Raj <raj.khem@gmail.com>" |
191 | RECIPE_MAINTAINER:pn-gcc-runtime = "Khem Raj <raj.khem@gmail.com>" | 191 | RECIPE_MAINTAINER:pn-gcc-runtime = "Khem Raj <raj.khem@gmail.com>" |
192 | RECIPE_MAINTAINER:pn-gcc-sanitizers = "Khem Raj <raj.khem@gmail.com>" | 192 | RECIPE_MAINTAINER:pn-gcc-sanitizers = "Khem Raj <raj.khem@gmail.com>" |
193 | RECIPE_MAINTAINER:pn-gcc-source-13.2.0 = "Khem Raj <raj.khem@gmail.com>" | 193 | RECIPE_MAINTAINER:pn-gcc-source-13.3.0 = "Khem Raj <raj.khem@gmail.com>" |
194 | RECIPE_MAINTAINER:pn-gconf = "Ross Burton <ross.burton@arm.com>" | 194 | RECIPE_MAINTAINER:pn-gconf = "Ross Burton <ross.burton@arm.com>" |
195 | RECIPE_MAINTAINER:pn-gcr = "Alexander Kanavin <alex.kanavin@gmail.com>" | 195 | RECIPE_MAINTAINER:pn-gcr = "Alexander Kanavin <alex.kanavin@gmail.com>" |
196 | RECIPE_MAINTAINER:pn-gdb = "Khem Raj <raj.khem@gmail.com>" | 196 | RECIPE_MAINTAINER:pn-gdb = "Khem Raj <raj.khem@gmail.com>" |
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py index 6774cdb794..d3b2317894 100644 --- a/meta/lib/oe/package_manager/__init__.py +++ b/meta/lib/oe/package_manager/__init__.py | |||
@@ -449,7 +449,7 @@ class PackageManager(object, metaclass=ABCMeta): | |||
449 | return res | 449 | return res |
450 | return _append(uris, base_paths) | 450 | return _append(uris, base_paths) |
451 | 451 | ||
452 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies): | 452 | def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies, include_self=False): |
453 | """ | 453 | """ |
454 | Go through our do_package_write_X dependencies and hardlink the packages we depend | 454 | Go through our do_package_write_X dependencies and hardlink the packages we depend |
455 | upon into the repo directory. This prevents us seeing other packages that may | 455 | upon into the repo directory. This prevents us seeing other packages that may |
@@ -486,14 +486,17 @@ def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie | |||
486 | bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") | 486 | bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") |
487 | pkgdeps = set() | 487 | pkgdeps = set() |
488 | start = [start] | 488 | start = [start] |
489 | seen = set(start) | 489 | if include_self: |
490 | seen = set() | ||
491 | else: | ||
492 | seen = set(start) | ||
490 | # Support direct dependencies (do_rootfs -> do_package_write_X) | 493 | # Support direct dependencies (do_rootfs -> do_package_write_X) |
491 | # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X) | 494 | # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X) |
492 | while start: | 495 | while start: |
493 | next = [] | 496 | next = [] |
494 | for dep2 in start: | 497 | for dep2 in start: |
495 | for dep in taskdepdata[dep2][3]: | 498 | for dep in taskdepdata[dep2][3]: |
496 | if taskdepdata[dep][0] != pn: | 499 | if include_self or taskdepdata[dep][0] != pn: |
497 | if "do_" + taskname in dep: | 500 | if "do_" + taskname in dep: |
498 | pkgdeps.add(dep) | 501 | pkgdeps.add(dep) |
499 | elif dep not in seen: | 502 | elif dep not in seen: |
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py index 8cc9953a02..47e72cc7a6 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -4,6 +4,7 @@ | |||
4 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
5 | # | 5 | # |
6 | 6 | ||
7 | import glob | ||
7 | import re | 8 | import re |
8 | import shutil | 9 | import shutil |
9 | import subprocess | 10 | import subprocess |
@@ -134,11 +135,16 @@ class OpkgDpkgPM(PackageManager): | |||
134 | tmp_dir = tempfile.mkdtemp() | 135 | tmp_dir = tempfile.mkdtemp() |
135 | current_dir = os.getcwd() | 136 | current_dir = os.getcwd() |
136 | os.chdir(tmp_dir) | 137 | os.chdir(tmp_dir) |
137 | data_tar = 'data.tar.zst' | ||
138 | 138 | ||
139 | try: | 139 | try: |
140 | cmd = [ar_cmd, 'x', pkg_path] | 140 | cmd = [ar_cmd, 'x', pkg_path] |
141 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | 141 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) |
142 | data_tar = glob.glob("data.tar.*") | ||
143 | if len(data_tar) != 1: | ||
144 | bb.fatal("Unable to extract %s package. Failed to identify " | ||
145 | "data tarball (found tarballs '%s').", | ||
146 | pkg_path, data_tar) | ||
147 | data_tar = data_tar[0] | ||
142 | cmd = [tar_cmd, 'xf', data_tar] | 148 | cmd = [tar_cmd, 'xf', data_tar] |
143 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | 149 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) |
144 | except subprocess.CalledProcessError as e: | 150 | except subprocess.CalledProcessError as e: |
@@ -153,6 +159,7 @@ class OpkgDpkgPM(PackageManager): | |||
153 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) | 159 | bb.note("Extracted %s to %s" % (pkg_path, tmp_dir)) |
154 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) | 160 | bb.utils.remove(os.path.join(tmp_dir, "debian-binary")) |
155 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) | 161 | bb.utils.remove(os.path.join(tmp_dir, "control.tar.gz")) |
162 | bb.utils.remove(os.path.join(tmp_dir, data_tar)) | ||
156 | os.chdir(current_dir) | 163 | os.chdir(current_dir) |
157 | 164 | ||
158 | return tmp_dir | 165 | return tmp_dir |
@@ -505,7 +512,4 @@ class OpkgPM(OpkgDpkgPM): | |||
505 | bb.fatal("Unable to get information for package '%s' while " | 512 | bb.fatal("Unable to get information for package '%s' while " |
506 | "trying to extract the package." % pkg) | 513 | "trying to extract the package." % pkg) |
507 | 514 | ||
508 | tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info) | 515 | return super(OpkgPM, self).extract(pkg, pkg_info) |
509 | bb.utils.remove(os.path.join(tmp_dir, "data.tar.zst")) | ||
510 | |||
511 | return tmp_dir | ||
diff --git a/meta/lib/oeqa/selftest/cases/debuginfod.py b/meta/lib/oeqa/selftest/cases/debuginfod.py index 505b4be837..46c0cd87bb 100644 --- a/meta/lib/oeqa/selftest/cases/debuginfod.py +++ b/meta/lib/oeqa/selftest/cases/debuginfod.py | |||
@@ -62,7 +62,7 @@ class Debuginfod(OESelftestTestCase): | |||
62 | 62 | ||
63 | raise TimeoutError("Cannot connect debuginfod, still %d scan jobs running" % latest) | 63 | raise TimeoutError("Cannot connect debuginfod, still %d scan jobs running" % latest) |
64 | 64 | ||
65 | def start_debuginfod(self): | 65 | def start_debuginfod(self, feed_dir): |
66 | # We assume that the caller has already bitbake'd elfutils-native:do_addto_recipe_sysroot | 66 | # We assume that the caller has already bitbake'd elfutils-native:do_addto_recipe_sysroot |
67 | 67 | ||
68 | # Save some useful paths for later | 68 | # Save some useful paths for later |
@@ -82,7 +82,7 @@ class Debuginfod(OESelftestTestCase): | |||
82 | # Disable rescanning, this is a one-shot test | 82 | # Disable rescanning, this is a one-shot test |
83 | "--rescan-time=0", | 83 | "--rescan-time=0", |
84 | "--groom-time=0", | 84 | "--groom-time=0", |
85 | get_bb_var("DEPLOY_DIR"), | 85 | feed_dir, |
86 | ] | 86 | ] |
87 | 87 | ||
88 | format = get_bb_var("PACKAGE_CLASSES").split()[0] | 88 | format = get_bb_var("PACKAGE_CLASSES").split()[0] |
@@ -114,11 +114,12 @@ class Debuginfod(OESelftestTestCase): | |||
114 | self.write_config(""" | 114 | self.write_config(""" |
115 | TMPDIR = "${TOPDIR}/tmp-debuginfod" | 115 | TMPDIR = "${TOPDIR}/tmp-debuginfod" |
116 | DISTRO_FEATURES:append = " debuginfod" | 116 | DISTRO_FEATURES:append = " debuginfod" |
117 | INHERIT += "localpkgfeed" | ||
117 | """) | 118 | """) |
118 | bitbake("elfutils-native:do_addto_recipe_sysroot xz xz:do_package") | 119 | bitbake("elfutils-native:do_addto_recipe_sysroot xz xz:do_package xz:do_localpkgfeed") |
119 | 120 | ||
120 | try: | 121 | try: |
121 | self.start_debuginfod() | 122 | self.start_debuginfod(get_bb_var("LOCALPKGFEED_DIR", "xz")) |
122 | 123 | ||
123 | env = os.environ.copy() | 124 | env = os.environ.copy() |
124 | env["DEBUGINFOD_URLS"] = "http://localhost:%d/" % self.port | 125 | env["DEBUGINFOD_URLS"] = "http://localhost:%d/" % self.port |
@@ -141,12 +142,13 @@ DISTRO_FEATURES:append = " debuginfod" | |||
141 | self.write_config(""" | 142 | self.write_config(""" |
142 | TMPDIR = "${TOPDIR}/tmp-debuginfod" | 143 | TMPDIR = "${TOPDIR}/tmp-debuginfod" |
143 | DISTRO_FEATURES:append = " debuginfod" | 144 | DISTRO_FEATURES:append = " debuginfod" |
145 | INHERIT += "localpkgfeed" | ||
144 | CORE_IMAGE_EXTRA_INSTALL += "elfutils xz" | 146 | CORE_IMAGE_EXTRA_INSTALL += "elfutils xz" |
145 | """) | 147 | """) |
146 | bitbake("core-image-minimal elfutils-native:do_addto_recipe_sysroot") | 148 | bitbake("core-image-minimal elfutils-native:do_addto_recipe_sysroot xz:do_localpkgfeed") |
147 | 149 | ||
148 | try: | 150 | try: |
149 | self.start_debuginfod() | 151 | self.start_debuginfod(get_bb_var("LOCALPKGFEED_DIR", "xz")) |
150 | 152 | ||
151 | with runqemu("core-image-minimal", runqemuparams="nographic") as qemu: | 153 | with runqemu("core-image-minimal", runqemuparams="nographic") as qemu: |
152 | cmd = "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/xz" % (qemu.server_ip, self.port) | 154 | cmd = "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/xz" % (qemu.server_ip, self.port) |
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index bc1e40ef83..44a2a50f2e 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -286,10 +286,13 @@ class DevtoolTestCase(OESelftestTestCase): | |||
286 | else: | 286 | else: |
287 | self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') | 287 | self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') |
288 | 288 | ||
289 | def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri): | 289 | def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri, srcrev=None): |
290 | self.track_for_cleanup(self.workspacedir) | 290 | self.track_for_cleanup(self.workspacedir) |
291 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 291 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
292 | result = runCmd('devtool add --version %s %s %s' % (version, pn, git_url)) | 292 | command = 'devtool add --version %s %s %s' % (version, pn, git_url) |
293 | if srcrev : | ||
294 | command += ' --srcrev %s' %srcrev | ||
295 | result = runCmd(command) | ||
293 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') | 296 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') |
294 | # Check the recipe name is correct | 297 | # Check the recipe name is correct |
295 | recipefile = get_bb_var('FILE', pn) | 298 | recipefile = get_bb_var('FILE', pn) |
@@ -479,11 +482,12 @@ class DevtoolAddTests(DevtoolBase): | |||
479 | 482 | ||
480 | def test_devtool_add_git_style2(self): | 483 | def test_devtool_add_git_style2(self): |
481 | version = 'v3.1.0' | 484 | version = 'v3.1.0' |
485 | srcrev = 'v3.1.0' | ||
482 | pn = 'mbedtls' | 486 | pn = 'mbedtls' |
483 | # this will trigger reformat_git_uri with branch parameter in url | 487 | # this will trigger reformat_git_uri with branch parameter in url |
484 | git_url = "'git://git@github.com/ARMmbed/mbedtls.git;protocol=https'" | 488 | git_url = "'git://git@github.com/ARMmbed/mbedtls.git;protocol=https'" |
485 | resulting_src_uri = "gitsm://git@github.com/ARMmbed/mbedtls.git;protocol=https;branch=master" | 489 | resulting_src_uri = "git://git@github.com/ARMmbed/mbedtls.git;protocol=https;branch=master" |
486 | self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri) | 490 | self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri, srcrev) |
487 | 491 | ||
488 | def test_devtool_add_library(self): | 492 | def test_devtool_add_library(self): |
489 | # Fetch source | 493 | # Fetch source |
@@ -749,6 +753,25 @@ class DevtoolModifyTests(DevtoolBase): | |||
749 | result = runCmd('devtool status') | 753 | result = runCmd('devtool status') |
750 | self.assertNotIn('mdadm', result.output) | 754 | self.assertNotIn('mdadm', result.output) |
751 | 755 | ||
756 | def test_devtool_modify_go(self): | ||
757 | import oe.path | ||
758 | from tempfile import TemporaryDirectory | ||
759 | with TemporaryDirectory(prefix='devtoolqa') as tempdir: | ||
760 | self.track_for_cleanup(self.workspacedir) | ||
761 | self.add_command_to_tearDown('bitbake -c clean go-helloworld') | ||
762 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
763 | result = runCmd('devtool modify go-helloworld -x %s' % tempdir) | ||
764 | self.assertExists( | ||
765 | oe.path.join(tempdir, 'src', 'golang.org', 'x', 'example', 'go.mod'), | ||
766 | 'Extracted source could not be found' | ||
767 | ) | ||
768 | self.assertExists( | ||
769 | oe.path.join(self.workspacedir, 'conf', 'layer.conf'), | ||
770 | 'Workspace directory not created' | ||
771 | ) | ||
772 | matches = glob.glob(oe.path.join(self.workspacedir, 'appends', 'go-helloworld_*.bbappend')) | ||
773 | self.assertTrue(matches, 'bbappend not created %s' % result.output) | ||
774 | |||
752 | def test_devtool_buildclean(self): | 775 | def test_devtool_buildclean(self): |
753 | def assertFile(path, *paths): | 776 | def assertFile(path, *paths): |
754 | f = os.path.join(path, *paths) | 777 | f = os.path.join(path, *paths) |
@@ -1405,14 +1428,30 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1405 | runCmd('echo "Bar" > new-file', cwd=tempdir) | 1428 | runCmd('echo "Bar" > new-file', cwd=tempdir) |
1406 | runCmd('git add new-file', cwd=tempdir) | 1429 | runCmd('git add new-file', cwd=tempdir) |
1407 | runCmd('git commit -m "Add new file"', cwd=tempdir) | 1430 | runCmd('git commit -m "Add new file"', cwd=tempdir) |
1408 | self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' % | ||
1409 | os.path.dirname(recipefile)) | ||
1410 | runCmd('devtool update-recipe %s' % testrecipe) | 1431 | runCmd('devtool update-recipe %s' % testrecipe) |
1411 | expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)), | 1432 | expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)), |
1412 | (' M', '.*/makedevs/makedevs.c$'), | 1433 | (' M', '.*/makedevs/makedevs.c$'), |
1413 | ('??', '.*/makedevs/new-local$'), | 1434 | ('??', '.*/makedevs/new-local$'), |
1414 | ('??', '.*/makedevs/0001-Add-new-file.patch$')] | 1435 | ('??', '.*/makedevs/0001-Add-new-file.patch$')] |
1415 | self._check_repo_status(os.path.dirname(recipefile), expected_status) | 1436 | self._check_repo_status(os.path.dirname(recipefile), expected_status) |
1437 | # Now try to update recipe in another layer, so first, clean it | ||
1438 | runCmd('cd %s; git clean -fd .; git checkout .' % os.path.dirname(recipefile)) | ||
1439 | # Create a temporary layer and add it to bblayers.conf | ||
1440 | self._create_temp_layer(templayerdir, True, 'templayer') | ||
1441 | # Update recipe in templayer | ||
1442 | result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) | ||
1443 | self.assertNotIn('WARNING:', result.output) | ||
1444 | # Check recipe is still clean | ||
1445 | self._check_repo_status(os.path.dirname(recipefile), []) | ||
1446 | splitpath = os.path.dirname(recipefile).split(os.sep) | ||
1447 | appenddir = os.path.join(templayerdir, splitpath[-2], splitpath[-1]) | ||
1448 | bbappendfile = self._check_bbappend(testrecipe, recipefile, appenddir) | ||
1449 | patchfile = os.path.join(appenddir, testrecipe, '0001-Add-new-file.patch') | ||
1450 | new_local_file = os.path.join(appenddir, testrecipe, 'new_local') | ||
1451 | local_file = os.path.join(appenddir, testrecipe, 'makedevs.c') | ||
1452 | self.assertExists(patchfile, 'Patch file 0001-Add-new-file.patch not created') | ||
1453 | self.assertExists(local_file, 'File makedevs.c not created') | ||
1454 | self.assertExists(patchfile, 'File new_local not created') | ||
1416 | 1455 | ||
1417 | def test_devtool_update_recipe_local_files_2(self): | 1456 | def test_devtool_update_recipe_local_files_2(self): |
1418 | """Check local source files support when oe-local-files is in Git""" | 1457 | """Check local source files support when oe-local-files is in Git""" |
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 57844b289a..99186175e5 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py | |||
@@ -194,8 +194,23 @@ class OESelftestTestContextExecutor(OETestContextExecutor): | |||
194 | parser.add_argument('-R', '--skip-tests', required=False, action='store', | 194 | parser.add_argument('-R', '--skip-tests', required=False, action='store', |
195 | nargs='+', dest="skips", default=None, | 195 | nargs='+', dest="skips", default=None, |
196 | help='Skip the tests specified. Format should be <module>[.<class>[.<test_method>]]') | 196 | help='Skip the tests specified. Format should be <module>[.<class>[.<test_method>]]') |
197 | |||
198 | def check_parallel_support(parameter): | ||
199 | if not parameter.isdigit(): | ||
200 | import argparse | ||
201 | raise argparse.ArgumentTypeError("argument -j/--num-processes: invalid int value: '%s' " % str(parameter)) | ||
202 | |||
203 | processes = int(parameter) | ||
204 | if processes: | ||
205 | try: | ||
206 | import testtools, subunit | ||
207 | except ImportError: | ||
208 | print("Failed to import testtools or subunit, the testcases will run serially") | ||
209 | processes = None | ||
210 | return processes | ||
211 | |||
197 | parser.add_argument('-j', '--num-processes', dest='processes', action='store', | 212 | parser.add_argument('-j', '--num-processes', dest='processes', action='store', |
198 | type=int, help="number of processes to execute in parallel with") | 213 | type=check_parallel_support, help="number of processes to execute in parallel with") |
199 | 214 | ||
200 | parser.add_argument('-t', '--select-tag', dest="select_tags", | 215 | parser.add_argument('-t', '--select-tag', dest="select_tags", |
201 | action='append', default=None, | 216 | action='append', default=None, |
diff --git a/meta/lib/oeqa/utils/postactions.py b/meta/lib/oeqa/utils/postactions.py index 8104400ac2..ecdddd2d40 100644 --- a/meta/lib/oeqa/utils/postactions.py +++ b/meta/lib/oeqa/utils/postactions.py | |||
@@ -25,7 +25,7 @@ def create_artifacts_directory(d, tc): | |||
25 | def get_target_disk_usage(d, tc): | 25 | def get_target_disk_usage(d, tc): |
26 | output_file = os.path.join(get_json_result_dir(d), "artifacts", "target_disk_usage.txt") | 26 | output_file = os.path.join(get_json_result_dir(d), "artifacts", "target_disk_usage.txt") |
27 | try: | 27 | try: |
28 | (status, output) = tc.target.run('df -hl') | 28 | (status, output) = tc.target.run('df -h') |
29 | with open(output_file, 'w') as f: | 29 | with open(output_file, 'w') as f: |
30 | f.write(output) | 30 | f.write(output) |
31 | f.write("\n") | 31 | f.write("\n") |
diff --git a/meta/lib/patchtest/tests/test_metadata.py b/meta/lib/patchtest/tests/test_metadata.py index be609dbd04..f5dbcf01ed 100644 --- a/meta/lib/patchtest/tests/test_metadata.py +++ b/meta/lib/patchtest/tests/test_metadata.py | |||
@@ -18,12 +18,12 @@ class TestMetadata(base.Metadata): | |||
18 | lictag_re = pyparsing.AtLineStart("License-Update:") | 18 | lictag_re = pyparsing.AtLineStart("License-Update:") |
19 | lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum) | 19 | lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum) |
20 | lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum) | 20 | lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum) |
21 | add_mark = pyparsing.Regex('\+ ') | 21 | add_mark = pyparsing.Regex('\\+ ') |
22 | max_length = 200 | 22 | max_length = 200 |
23 | metadata_src_uri = 'SRC_URI' | 23 | metadata_src_uri = 'SRC_URI' |
24 | md5sum = 'md5sum' | 24 | md5sum = 'md5sum' |
25 | sha256sum = 'sha256sum' | 25 | sha256sum = 'sha256sum' |
26 | git_regex = pyparsing.Regex('^git\:\/\/.*') | 26 | git_regex = pyparsing.Regex('^git\\:\\/\\/.*') |
27 | metadata_summary = 'SUMMARY' | 27 | metadata_summary = 'SUMMARY' |
28 | cve_check_ignore_var = 'CVE_CHECK_IGNORE' | 28 | cve_check_ignore_var = 'CVE_CHECK_IGNORE' |
29 | cve_status_var = 'CVE_STATUS' | 29 | cve_status_var = 'CVE_STATUS' |
diff --git a/meta/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch b/meta/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch deleted file mode 100644 index 74e3de1ce9..0000000000 --- a/meta/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | From c25f8d1f7a6203dfeb10b39f80ffd314bb84a58d Mon Sep 17 00:00:00 2001 | ||
2 | From: Baruch Siach <baruch@tkos.co.il> | ||
3 | Date: Thu, 22 Dec 2016 15:26:30 +0200 | ||
4 | Subject: [PATCH] libc-compat.h: add musl workaround | ||
5 | |||
6 | The libc-compat.h kernel header uses glibc specific macros (__GLIBC__ and | ||
7 | __USE_MISC) to solve conflicts with libc provided headers. This patch makes | ||
8 | libc-compat.h work for musl libc as well. | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | |||
12 | Taken From: | ||
13 | https://git.buildroot.net/buildroot/tree/package/iproute2/0001-Add-the-musl-workaround-to-the-libc-compat.h-copy.patch | ||
14 | |||
15 | Signed-off-by: Baruch Siach <baruch@tkos.co.il> | ||
16 | Signed-off-by: Maxin B. John <maxin.john@intel.com> | ||
17 | |||
18 | --- | ||
19 | include/uapi/linux/libc-compat.h | 4 +++- | ||
20 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h | ||
23 | index a159991..22198fa 100644 | ||
24 | --- a/include/uapi/linux/libc-compat.h | ||
25 | +++ b/include/uapi/linux/libc-compat.h | ||
26 | @@ -50,10 +50,12 @@ | ||
27 | #define _LIBC_COMPAT_H | ||
28 | |||
29 | /* We have included glibc headers... */ | ||
30 | -#if defined(__GLIBC__) | ||
31 | +#if 1 | ||
32 | +#define __USE_MISC | ||
33 | |||
34 | /* Coordinate with glibc net/if.h header. */ | ||
35 | #if defined(_NET_IF_H) && defined(__USE_MISC) | ||
36 | +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0 | ||
37 | |||
38 | /* GLIBC headers included first so don't define anything | ||
39 | * that would already be defined. */ | ||
diff --git a/meta/recipes-connectivity/iproute2/iproute2_6.7.0.bb b/meta/recipes-connectivity/iproute2/iproute2_6.7.0.bb index 640b3013f1..442c6bdd4f 100644 --- a/meta/recipes-connectivity/iproute2/iproute2_6.7.0.bb +++ b/meta/recipes-connectivity/iproute2/iproute2_6.7.0.bb | |||
@@ -11,9 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ | |||
11 | 11 | ||
12 | DEPENDS = "flex-native bison-native iptables libcap" | 12 | DEPENDS = "flex-native bison-native iptables libcap" |
13 | 13 | ||
14 | SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \ | 14 | SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz" |
15 | file://0001-libc-compat.h-add-musl-workaround.patch \ | ||
16 | " | ||
17 | 15 | ||
18 | SRC_URI[sha256sum] = "ff942dd9828d7d1f867f61fe72ce433078c31e5d8e4a78e20f02cb5892e8841d" | 16 | SRC_URI[sha256sum] = "ff942dd9828d7d1f867f61fe72ce433078c31e5d8e4a78e20f02cb5892e8841d" |
19 | 17 | ||
diff --git a/meta/recipes-connectivity/kea/files/0001-kea-fix-reproducible-build-failure.patch b/meta/recipes-connectivity/kea/files/0001-kea-fix-reproducible-build-failure.patch deleted file mode 100644 index 8a5bd00302..0000000000 --- a/meta/recipes-connectivity/kea/files/0001-kea-fix-reproducible-build-failure.patch +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | From f9bcfed5a1d44d9211c5f6eba403a9898c8c9057 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sudip Mukherjee <sudipm.mukherjee@gmail.com> | ||
3 | Date: Tue, 8 Aug 2023 19:03:13 +0100 | ||
4 | Subject: [PATCH] kea: fix reproducible build failure | ||
5 | |||
6 | New version of Kea has started using path of build-dir instead of | ||
7 | src-dir which results in reproducible builds failure. | ||
8 | Use src-dir as is used in v2.2.0 | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | https://gitlab.isc.org/isc-projects/kea/-/issues/3007 | ||
12 | |||
13 | Upstream has confirmed the patch will not be accepted but discussions | ||
14 | with upstream is still going on, we might have a proper solution later. | ||
15 | |||
16 | Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> | ||
17 | --- | ||
18 | src/bin/admin/kea-admin.in | 8 ++++---- | ||
19 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
20 | |||
21 | diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in | ||
22 | index 034a0ee..8ab11ab 100644 | ||
23 | --- a/src/bin/admin/kea-admin.in | ||
24 | +++ b/src/bin/admin/kea-admin.in | ||
25 | @@ -51,14 +51,14 @@ dump_qry="" | ||
26 | if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then | ||
27 | . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" | ||
28 | else | ||
29 | - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" | ||
30 | + . "@abs_top_srcdir@/src/bin/admin/admin-utils.sh" | ||
31 | fi | ||
32 | |||
33 | # Find the installed kea-lfc if available. Fallback to sources otherwise. | ||
34 | if test -x "@sbindir@/kea-lfc"; then | ||
35 | kea_lfc="@sbindir@/kea-lfc" | ||
36 | else | ||
37 | - kea_lfc="@abs_top_builddir@/src/bin/lfc/kea-lfc" | ||
38 | + kea_lfc="@abs_top_srcdir@/src/bin/lfc/kea-lfc" | ||
39 | fi | ||
40 | |||
41 | # Prints out usage version. | ||
42 | @@ -355,7 +355,7 @@ mysql_upgrade() { | ||
43 | # Check if there are any files in it | ||
44 | num_files=$(find "${upgrade_scripts_dir}" -name 'upgrade*.sh' -type f | wc -l) | ||
45 | if [ "$num_files" -eq 0 ]; then | ||
46 | - upgrade_scripts_dir=@abs_top_builddir@/src/share/database/scripts/mysql | ||
47 | + upgrade_scripts_dir=@abs_top_srcdir@/src/share/database/scripts/mysql | ||
48 | |||
49 | # Check if the scripts directory exists at all. | ||
50 | if [ ! -d ${upgrade_scripts_dir} ]; then | ||
51 | @@ -405,7 +405,7 @@ pgsql_upgrade() { | ||
52 | # Check if there are any files in it | ||
53 | num_files=$(find "${upgrade_scripts_dir}" -name 'upgrade*.sh' -type f | wc -l) | ||
54 | if [ "$num_files" -eq 0 ]; then | ||
55 | - upgrade_scripts_dir=@abs_top_builddir@/src/share/database/scripts/pgsql | ||
56 | + upgrade_scripts_dir=@abs_top_srcdir@/src/share/database/scripts/pgsql | ||
57 | |||
58 | # Check if the scripts directory exists at all. | ||
59 | if [ ! -d ${upgrade_scripts_dir} ]; then | ||
60 | -- | ||
61 | 2.39.2 | ||
62 | |||
diff --git a/meta/recipes-connectivity/kea/kea_2.4.1.bb b/meta/recipes-connectivity/kea/kea_2.4.1.bb index c3aa4dc8f0..9f8758f379 100644 --- a/meta/recipes-connectivity/kea/kea_2.4.1.bb +++ b/meta/recipes-connectivity/kea/kea_2.4.1.bb | |||
@@ -17,7 +17,6 @@ SRC_URI = "http://ftp.isc.org/isc/kea/${PV}/${BP}.tar.gz \ | |||
17 | file://fix-multilib-conflict.patch \ | 17 | file://fix-multilib-conflict.patch \ |
18 | file://fix_pid_keactrl.patch \ | 18 | file://fix_pid_keactrl.patch \ |
19 | file://0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch \ | 19 | file://0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch \ |
20 | file://0001-kea-fix-reproducible-build-failure.patch \ | ||
21 | " | 20 | " |
22 | SRC_URI[sha256sum] = "815c61f5c271caa4a1db31dd656eb50a7f6ea973da3690f7c8581408e180131a" | 21 | SRC_URI[sha256sum] = "815c61f5c271caa4a1db31dd656eb50a7f6ea973da3690f7c8581408e180131a" |
23 | 22 | ||
@@ -47,7 +46,7 @@ do_configure:prepend() { | |||
47 | # replace abs_top_builddir to avoid introducing the build path | 46 | # replace abs_top_builddir to avoid introducing the build path |
48 | # don't expand the abs_top_builddir on the target as the abs_top_builddir is meanlingless on the target | 47 | # don't expand the abs_top_builddir on the target as the abs_top_builddir is meanlingless on the target |
49 | find ${S} -type f -name *.sh.in | xargs sed -i "s:@abs_top_builddir@:@abs_top_builddir_placeholder@:g" | 48 | find ${S} -type f -name *.sh.in | xargs sed -i "s:@abs_top_builddir@:@abs_top_builddir_placeholder@:g" |
50 | sed -i "s:@abs_top_srcdir@:@abs_top_srcdir_placeholder@:g" ${S}/src/bin/admin/kea-admin.in | 49 | sed -i "s:@abs_top_builddir@:@abs_top_builddir_placeholder@:g" ${S}/src/bin/admin/kea-admin.in |
51 | } | 50 | } |
52 | 51 | ||
53 | # patch out build host paths for reproducibility | 52 | # patch out build host paths for reproducibility |
diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2024-2511.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2024-2511.patch deleted file mode 100644 index 8772f716d5..0000000000 --- a/meta/recipes-connectivity/openssl/openssl/CVE-2024-2511.patch +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | From e9d7083e241670332e0443da0f0d4ffb52829f08 Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt Caswell <matt@openssl.org> | ||
3 | Date: Tue, 5 Mar 2024 15:43:53 +0000 | ||
4 | Subject: [PATCH] Fix unconstrained session cache growth in TLSv1.3 | ||
5 | |||
6 | In TLSv1.3 we create a new session object for each ticket that we send. | ||
7 | We do this by duplicating the original session. If SSL_OP_NO_TICKET is in | ||
8 | use then the new session will be added to the session cache. However, if | ||
9 | early data is not in use (and therefore anti-replay protection is being | ||
10 | used), then multiple threads could be resuming from the same session | ||
11 | simultaneously. If this happens and a problem occurs on one of the threads, | ||
12 | then the original session object could be marked as not_resumable. When we | ||
13 | duplicate the session object this not_resumable status gets copied into the | ||
14 | new session object. The new session object is then added to the session | ||
15 | cache even though it is not_resumable. | ||
16 | |||
17 | Subsequently, another bug means that the session_id_length is set to 0 for | ||
18 | sessions that are marked as not_resumable - even though that session is | ||
19 | still in the cache. Once this happens the session can never be removed from | ||
20 | the cache. When that object gets to be the session cache tail object the | ||
21 | cache never shrinks again and grows indefinitely. | ||
22 | |||
23 | CVE-2024-2511 | ||
24 | |||
25 | Reviewed-by: Neil Horman <nhorman@openssl.org> | ||
26 | Reviewed-by: Tomas Mraz <tomas@openssl.org> | ||
27 | (Merged from https://github.com/openssl/openssl/pull/24043) | ||
28 | |||
29 | CVE: CVE-2024-2511 | ||
30 | Upstream-Status: Backport [https://github.com/openssl/openssl/commit/e9d7083e241670332e0443da0f0d4ffb52829f08] | ||
31 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
32 | --- | ||
33 | ssl/ssl_lib.c | 5 +++-- | ||
34 | ssl/ssl_sess.c | 28 ++++++++++++++++++++++------ | ||
35 | ssl/statem/statem_srvr.c | 5 ++--- | ||
36 | 3 files changed, 27 insertions(+), 11 deletions(-) | ||
37 | |||
38 | diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c | ||
39 | index 4afb43bc86e54..c51529ddab5bb 100644 | ||
40 | --- a/ssl/ssl_lib.c | ||
41 | +++ b/ssl/ssl_lib.c | ||
42 | @@ -4457,9 +4457,10 @@ void ssl_update_cache(SSL_CONNECTION *s, int mode) | ||
43 | |||
44 | /* | ||
45 | * If the session_id_length is 0, we are not supposed to cache it, and it | ||
46 | - * would be rather hard to do anyway :-) | ||
47 | + * would be rather hard to do anyway :-). Also if the session has already | ||
48 | + * been marked as not_resumable we should not cache it for later reuse. | ||
49 | */ | ||
50 | - if (s->session->session_id_length == 0) | ||
51 | + if (s->session->session_id_length == 0 || s->session->not_resumable) | ||
52 | return; | ||
53 | |||
54 | /* | ||
55 | diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c | ||
56 | index 3dcc4d81e5bc6..1fa6d17c46863 100644 | ||
57 | --- a/ssl/ssl_sess.c | ||
58 | +++ b/ssl/ssl_sess.c | ||
59 | @@ -127,16 +127,11 @@ SSL_SESSION *SSL_SESSION_new(void) | ||
60 | return ss; | ||
61 | } | ||
62 | |||
63 | -SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src) | ||
64 | -{ | ||
65 | - return ssl_session_dup(src, 1); | ||
66 | -} | ||
67 | - | ||
68 | /* | ||
69 | * Create a new SSL_SESSION and duplicate the contents of |src| into it. If | ||
70 | * ticket == 0 then no ticket information is duplicated, otherwise it is. | ||
71 | */ | ||
72 | -SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket) | ||
73 | +static SSL_SESSION *ssl_session_dup_intern(const SSL_SESSION *src, int ticket) | ||
74 | { | ||
75 | SSL_SESSION *dest; | ||
76 | |||
77 | @@ -265,6 +260,27 @@ SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket) | ||
78 | return NULL; | ||
79 | } | ||
80 | |||
81 | +SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src) | ||
82 | +{ | ||
83 | + return ssl_session_dup_intern(src, 1); | ||
84 | +} | ||
85 | + | ||
86 | +/* | ||
87 | + * Used internally when duplicating a session which might be already shared. | ||
88 | + * We will have resumed the original session. Subsequently we might have marked | ||
89 | + * it as non-resumable (e.g. in another thread) - but this copy should be ok to | ||
90 | + * resume from. | ||
91 | + */ | ||
92 | +SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket) | ||
93 | +{ | ||
94 | + SSL_SESSION *sess = ssl_session_dup_intern(src, ticket); | ||
95 | + | ||
96 | + if (sess != NULL) | ||
97 | + sess->not_resumable = 0; | ||
98 | + | ||
99 | + return sess; | ||
100 | +} | ||
101 | + | ||
102 | const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len) | ||
103 | { | ||
104 | if (len) | ||
105 | diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c | ||
106 | index 853af8c0aa9f9..d5f0ab091dacc 100644 | ||
107 | --- a/ssl/statem/statem_srvr.c | ||
108 | +++ b/ssl/statem/statem_srvr.c | ||
109 | @@ -2445,9 +2445,8 @@ CON_FUNC_RETURN tls_construct_server_hello(SSL_CONNECTION *s, WPACKET *pkt) | ||
110 | * so the following won't overwrite an ID that we're supposed | ||
111 | * to send back. | ||
112 | */ | ||
113 | - if (s->session->not_resumable || | ||
114 | - (!(SSL_CONNECTION_GET_CTX(s)->session_cache_mode & SSL_SESS_CACHE_SERVER) | ||
115 | - && !s->hit)) | ||
116 | + if (!(SSL_CONNECTION_GET_CTX(s)->session_cache_mode & SSL_SESS_CACHE_SERVER) | ||
117 | + && !s->hit) | ||
118 | s->session->session_id_length = 0; | ||
119 | |||
120 | if (usetls13) { | ||
diff --git a/meta/recipes-connectivity/openssl/openssl/bti.patch b/meta/recipes-connectivity/openssl/openssl/bti.patch deleted file mode 100644 index 748576c30c..0000000000 --- a/meta/recipes-connectivity/openssl/openssl/bti.patch +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | From ba8a599395f8b770c76316b5f5b0f3838567014f Mon Sep 17 00:00:00 2001 | ||
2 | From: Tom Cosgrove <tom.cosgrove@arm.com> | ||
3 | Date: Tue, 26 Mar 2024 13:18:00 +0000 | ||
4 | Subject: [PATCH] aarch64: fix BTI in bsaes assembly code | ||
5 | |||
6 | In Arm systems where BTI is enabled but the Crypto extensions are not (more | ||
7 | likely in FVPs than in real hardware), the bit-sliced assembler code will | ||
8 | be used. However, this wasn't annotated with BTI instructions when BTI was | ||
9 | enabled, so the moment libssl jumps into this code it (correctly) aborts. | ||
10 | |||
11 | Solve this by adding the missing BTI landing pads. | ||
12 | |||
13 | Upstream-Status: Submitted [https://github.com/openssl/openssl/pull/23982] | ||
14 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
15 | --- | ||
16 | crypto/aes/asm/bsaes-armv8.pl | 5 ++++- | ||
17 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/crypto/aes/asm/bsaes-armv8.pl b/crypto/aes/asm/bsaes-armv8.pl | ||
20 | index b3c97e439f..c3c5ff3e05 100644 | ||
21 | --- a/crypto/aes/asm/bsaes-armv8.pl | ||
22 | +++ b/crypto/aes/asm/bsaes-armv8.pl | ||
23 | @@ -1018,6 +1018,7 @@ _bsaes_key_convert: | ||
24 | // Initialisation vector overwritten with last quadword of ciphertext | ||
25 | // No output registers, usual AAPCS64 register preservation | ||
26 | ossl_bsaes_cbc_encrypt: | ||
27 | + AARCH64_VALID_CALL_TARGET | ||
28 | cmp x2, #128 | ||
29 | bhs .Lcbc_do_bsaes | ||
30 | b AES_cbc_encrypt | ||
31 | @@ -1270,7 +1271,7 @@ ossl_bsaes_cbc_encrypt: | ||
32 | // Output text filled in | ||
33 | // No output registers, usual AAPCS64 register preservation | ||
34 | ossl_bsaes_ctr32_encrypt_blocks: | ||
35 | - | ||
36 | + AARCH64_VALID_CALL_TARGET | ||
37 | cmp x2, #8 // use plain AES for | ||
38 | blo .Lctr_enc_short // small sizes | ||
39 | |||
40 | @@ -1476,6 +1477,7 @@ ossl_bsaes_ctr32_encrypt_blocks: | ||
41 | // Output ciphertext filled in | ||
42 | // No output registers, usual AAPCS64 register preservation | ||
43 | ossl_bsaes_xts_encrypt: | ||
44 | + AARCH64_VALID_CALL_TARGET | ||
45 | // Stack layout: | ||
46 | // sp -> | ||
47 | // nrounds*128-96 bytes: key schedule | ||
48 | @@ -1921,6 +1923,7 @@ ossl_bsaes_xts_encrypt: | ||
49 | // Output plaintext filled in | ||
50 | // No output registers, usual AAPCS64 register preservation | ||
51 | ossl_bsaes_xts_decrypt: | ||
52 | + AARCH64_VALID_CALL_TARGET | ||
53 | // Stack layout: | ||
54 | // sp -> | ||
55 | // nrounds*128-96 bytes: key schedule | ||
56 | -- | ||
57 | 2.34.1 | ||
58 | |||
diff --git a/meta/recipes-connectivity/openssl/openssl_3.2.1.bb b/meta/recipes-connectivity/openssl/openssl_3.2.2.bb index d37b68abbb..1c92707144 100644 --- a/meta/recipes-connectivity/openssl/openssl_3.2.1.bb +++ b/meta/recipes-connectivity/openssl/openssl_3.2.2.bb | |||
@@ -12,15 +12,13 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ | |||
12 | file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ | 12 | file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ |
13 | file://0001-Configure-do-not-tweak-mips-cflags.patch \ | 13 | file://0001-Configure-do-not-tweak-mips-cflags.patch \ |
14 | file://0001-Added-handshake-history-reporting-when-test-fails.patch \ | 14 | file://0001-Added-handshake-history-reporting-when-test-fails.patch \ |
15 | file://bti.patch \ | ||
16 | file://CVE-2024-2511.patch \ | ||
17 | " | 15 | " |
18 | 16 | ||
19 | SRC_URI:append:class-nativesdk = " \ | 17 | SRC_URI:append:class-nativesdk = " \ |
20 | file://environment.d-openssl.sh \ | 18 | file://environment.d-openssl.sh \ |
21 | " | 19 | " |
22 | 20 | ||
23 | SRC_URI[sha256sum] = "83c7329fe52c850677d75e5d0b0ca245309b97e8ecbcfdc1dfdc4ab9fac35b39" | 21 | SRC_URI[sha256sum] = "197149c18d9e9f292c43f0400acaba12e5f52cacfe050f3d199277ea738ec2e7" |
24 | 22 | ||
25 | inherit lib_package multilib_header multilib_script ptest perlnative manpages | 23 | inherit lib_package multilib_header multilib_script ptest perlnative manpages |
26 | MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" | 24 | MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" |
diff --git a/meta/recipes-connectivity/ppp/ppp_2.5.0.bb b/meta/recipes-connectivity/ppp/ppp_2.5.0.bb index 4b052f8ed9..5f0c75de83 100644 --- a/meta/recipes-connectivity/ppp/ppp_2.5.0.bb +++ b/meta/recipes-connectivity/ppp/ppp_2.5.0.bb | |||
@@ -5,7 +5,7 @@ SECTION = "console/network" | |||
5 | HOMEPAGE = "http://samba.org/ppp/" | 5 | HOMEPAGE = "http://samba.org/ppp/" |
6 | BUGTRACKER = "http://ppp.samba.org/cgi-bin/ppp-bugs" | 6 | BUGTRACKER = "http://ppp.samba.org/cgi-bin/ppp-bugs" |
7 | DEPENDS = "libpcap openssl virtual/crypt" | 7 | DEPENDS = "libpcap openssl virtual/crypt" |
8 | LICENSE = "BSD-3-Clause & BSD-3-Clause-Attribution & GPL-2.0-or-later & LGPL-2.0-or-later & PD" | 8 | LICENSE = "BSD-3-Clause & BSD-3-Clause-Attribution & GPL-2.0-or-later & LGPL-2.0-or-later & PD & RSA-MD" |
9 | LIC_FILES_CHKSUM = "file://pppd/ccp.c;beginline=1;endline=29;md5=e2c43fe6e81ff77d87dc9c290a424dea \ | 9 | LIC_FILES_CHKSUM = "file://pppd/ccp.c;beginline=1;endline=29;md5=e2c43fe6e81ff77d87dc9c290a424dea \ |
10 | file://pppd/plugins/passprompt.c;beginline=1;endline=10;md5=3bcbcdbf0e369c9a3e0b8c8275b065d8 \ | 10 | file://pppd/plugins/passprompt.c;beginline=1;endline=10;md5=3bcbcdbf0e369c9a3e0b8c8275b065d8 \ |
11 | file://pppd/tdb.c;beginline=1;endline=27;md5=4ca3a9991b011038d085d6675ae7c4e6 \ | 11 | file://pppd/tdb.c;beginline=1;endline=27;md5=4ca3a9991b011038d085d6675ae7c4e6 \ |
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index bded3757cc..5e8393c91c 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile | |||
@@ -58,7 +58,7 @@ resize() { | |||
58 | fi | 58 | fi |
59 | # only do this for /dev/tty[A-z] which are typically | 59 | # only do this for /dev/tty[A-z] which are typically |
60 | # serial ports | 60 | # serial ports |
61 | if [ $FIRSTTIMESETUP -eq 1 -a $SHLVL -eq 1 ] ; then | 61 | if [ $FIRSTTIMESETUP -eq 1 -a ${SHLVL:-1} -eq 1 ] ; then |
62 | case $(tty 2>/dev/null) in | 62 | case $(tty 2>/dev/null) in |
63 | /dev/tty[A-z]*) resize >/dev/null;; | 63 | /dev/tty[A-z]*) resize >/dev/null;; |
64 | esac | 64 | esac |
diff --git a/meta/recipes-core/busybox/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch b/meta/recipes-core/busybox/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch index 4635250170..ceb3ad7250 100644 --- a/meta/recipes-core/busybox/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch +++ b/meta/recipes-core/busybox/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch | |||
@@ -5,7 +5,7 @@ Subject: [PATCH 1/2] libbb: sockaddr2str: ensure only printable characters are | |||
5 | returned for the hostname part | 5 | returned for the hostname part |
6 | 6 | ||
7 | CVE: CVE-2022-28391 | 7 | CVE: CVE-2022-28391 |
8 | Upstream-Status: Pending | 8 | Upstream-Status: Submitted [https://bugs.busybox.net/show_bug.cgi?id=15001] |
9 | Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> | 9 | Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> |
10 | Signed-off-by: Steve Sakoman <steve@sakoman.com> | 10 | Signed-off-by: Steve Sakoman <steve@sakoman.com> |
11 | --- | 11 | --- |
diff --git a/meta/recipes-core/busybox/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch b/meta/recipes-core/busybox/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch index 0d7409ddc3..1dbc3388a4 100644 --- a/meta/recipes-core/busybox/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch +++ b/meta/recipes-core/busybox/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch | |||
@@ -8,7 +8,7 @@ Otherwise, terminal sequences can be injected, which enables various terminal in | |||
8 | attacks from DNS results. | 8 | attacks from DNS results. |
9 | 9 | ||
10 | CVE: CVE-2022-28391 | 10 | CVE: CVE-2022-28391 |
11 | Upstream-Status: Pending | 11 | Upstream-Status: Submitted [https://bugs.busybox.net/show_bug.cgi?id=15001] |
12 | Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> | 12 | Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> |
13 | Signed-off-by: Steve Sakoman <steve@sakoman.com> | 13 | Signed-off-by: Steve Sakoman <steve@sakoman.com> |
14 | --- | 14 | --- |
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/fix-regex.patch b/meta/recipes-core/glib-2.0/glib-2.0/fix-regex.patch deleted file mode 100644 index bdfbd55899..0000000000 --- a/meta/recipes-core/glib-2.0/glib-2.0/fix-regex.patch +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | From cce3ae98a2c1966719daabff5a4ec6cf94a846f6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Philip Withnall <pwithnall@gnome.org> | ||
3 | Date: Mon, 26 Feb 2024 16:55:44 +0000 | ||
4 | Subject: [PATCH] tests: Remove variable-length lookbehind tests for GRegex | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | PCRE2 10.43 has now introduced support for variable-length lookbehind, | ||
10 | so these tests now fail if GLib is built against PCRE2 10.43 or higher. | ||
11 | |||
12 | See | ||
13 | https://github.com/PCRE2Project/pcre2/blob/e8db6fa7137f4c6f66cb87e0a3c9467252ec1ef7/ChangeLog#L94. | ||
14 | |||
15 | Rather than making the tests conditional on the version of PCRE2 in use, | ||
16 | just remove them. They are mostly testing the PCRE2 code rather than | ||
17 | any code in GLib, so don’t have much value. | ||
18 | |||
19 | This should fix CI runs on msys2-mingw32, which updated to PCRE2 10.43 2 | ||
20 | days ago. | ||
21 | |||
22 | Signed-off-by: Philip Withnall <pwithnall@gnome.org> | ||
23 | |||
24 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/cce3ae98a2c1966719daabff5a4ec6cf94a846f6] | ||
25 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
26 | --- | ||
27 | glib/tests/regex.c | 10 ---------- | ||
28 | 1 file changed, 10 deletions(-) | ||
29 | |||
30 | diff --git a/glib/tests/regex.c b/glib/tests/regex.c | ||
31 | index 1082526292..d7a698ec67 100644 | ||
32 | --- a/glib/tests/regex.c | ||
33 | +++ b/glib/tests/regex.c | ||
34 | @@ -1885,16 +1885,6 @@ test_lookbehind (void) | ||
35 | g_match_info_free (match); | ||
36 | g_regex_unref (regex); | ||
37 | |||
38 | - regex = g_regex_new ("(?<!dogs?|cats?) x", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error); | ||
39 | - g_assert (regex == NULL); | ||
40 | - g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND); | ||
41 | - g_clear_error (&error); | ||
42 | - | ||
43 | - regex = g_regex_new ("(?<=ab(c|de)) foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error); | ||
44 | - g_assert (regex == NULL); | ||
45 | - g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND); | ||
46 | - g_clear_error (&error); | ||
47 | - | ||
48 | regex = g_regex_new ("(?<=abc|abde)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error); | ||
49 | g_assert (regex); | ||
50 | g_assert_no_error (error); | ||
51 | -- | ||
52 | GitLab | ||
53 | |||
54 | |||
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.78.4.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb index b1669ead75..1a4278b1bc 100644 --- a/meta/recipes-core/glib-2.0/glib-2.0_2.78.4.bb +++ b/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb | |||
@@ -16,14 +16,13 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ | |||
16 | file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ | 16 | file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ |
17 | file://0001-Switch-from-the-deprecated-distutils-module-to-the-p.patch \ | 17 | file://0001-Switch-from-the-deprecated-distutils-module-to-the-p.patch \ |
18 | file://memory-monitor.patch \ | 18 | file://memory-monitor.patch \ |
19 | file://fix-regex.patch \ | ||
20 | file://skip-timeout.patch \ | 19 | file://skip-timeout.patch \ |
21 | " | 20 | " |
22 | SRC_URI:append:class-native = " file://relocate-modules.patch \ | 21 | SRC_URI:append:class-native = " file://relocate-modules.patch \ |
23 | file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \ | 22 | file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \ |
24 | " | 23 | " |
25 | 24 | ||
26 | SRC_URI[sha256sum] = "24b8e0672dca120cc32d394bccb85844e732e04fe75d18bb0573b2dbc7548f63" | 25 | SRC_URI[sha256sum] = "244854654dd82c7ebcb2f8e246156d2a05eb9cd1ad07ed7a779659b4602c9fae" |
27 | 26 | ||
28 | # Find any meson cross files in FILESPATH that are relevant for the current | 27 | # Find any meson cross files in FILESPATH that are relevant for the current |
29 | # build (using siteinfo) and add them to EXTRA_OEMESON. | 28 | # build (using siteinfo) and add them to EXTRA_OEMESON. |
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc index b9516e77f0..91a3f5bcd5 100644 --- a/meta/recipes-core/glibc/glibc-common.inc +++ b/meta/recipes-core/glibc/glibc-common.inc | |||
@@ -2,7 +2,7 @@ SUMMARY = "GLIBC (GNU C Library)" | |||
2 | DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel." | 2 | DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel." |
3 | HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" | 3 | HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" |
4 | SECTION = "libs" | 4 | SECTION = "libs" |
5 | LICENSE = "GPL-2.0-only & LGPL-2.1-only" | 5 | LICENSE = "GPL-2.0-only & LGPL-2.1-or-later" |
6 | 6 | ||
7 | LIC_FILES_CHKSUM ?= "file://LICENSES;md5=f77e878d320e99e94ae9a4aea7f491d1 \ | 7 | LIC_FILES_CHKSUM ?= "file://LICENSES;md5=f77e878d320e99e94ae9a4aea7f491d1 \ |
8 | file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | 8 | file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc index 618a574566..1e4a323d64 100644 --- a/meta/recipes-core/glibc/glibc-version.inc +++ b/meta/recipes-core/glibc/glibc-version.inc | |||
@@ -1,6 +1,6 @@ | |||
1 | SRCBRANCH ?= "release/2.39/master" | 1 | SRCBRANCH ?= "release/2.39/master" |
2 | PV = "2.39+git" | 2 | PV = "2.39+git" |
3 | SRCREV_glibc ?= "1b9c1a0047fb26a65a9b2a7b8cd977243f7d353c" | 3 | SRCREV_glibc ?= "273a835fe7c685cc54266bb8b502787bad5e9bae" |
4 | SRCREV_localedef ?= "fab74f31b3811df543e24b6de47efdf45b538abc" | 4 | SRCREV_localedef ?= "fab74f31b3811df543e24b6de47efdf45b538abc" |
5 | 5 | ||
6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;protocol=https" | 6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;protocol=https" |
diff --git a/meta/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch index 066c3b1ea2..9bdfa76318 100644 --- a/meta/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch +++ b/meta/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch | |||
@@ -11,16 +11,15 @@ Upstream-Status: Inappropriate [ OE-Specific ] | |||
11 | 11 | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
13 | --- | 13 | --- |
14 | sysdeps/aarch64/bits/wordsize.h | 8 ++++++-- | 14 | sysdeps/aarch64/bits/wordsize.h | 11 +++++++++-- |
15 | sysdeps/arm/bits/wordsize.h | 1 + | 15 | sysdeps/arm/bits/wordsize.h | 22 +--------------------- |
16 | 2 files changed, 7 insertions(+), 2 deletions(-) | 16 | 2 files changed, 10 insertions(+), 23 deletions(-) |
17 | create mode 120000 sysdeps/arm/bits/wordsize.h | ||
18 | 17 | ||
19 | diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h | 18 | diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h |
20 | index 118e59172d..b4b0692eb5 100644 | 19 | index 118e59172d..ff86359fe8 100644 |
21 | --- a/sysdeps/aarch64/bits/wordsize.h | 20 | --- a/sysdeps/aarch64/bits/wordsize.h |
22 | +++ b/sysdeps/aarch64/bits/wordsize.h | 21 | +++ b/sysdeps/aarch64/bits/wordsize.h |
23 | @@ -17,12 +17,16 @@ | 22 | @@ -17,12 +17,19 @@ |
24 | License along with the GNU C Library; if not, see | 23 | License along with the GNU C Library; if not, see |
25 | <https://www.gnu.org/licenses/>. */ | 24 | <https://www.gnu.org/licenses/>. */ |
26 | 25 | ||
@@ -33,12 +32,42 @@ index 118e59172d..b4b0692eb5 100644 | |||
33 | # define __WORDSIZE32_SIZE_ULONG 1 | 32 | # define __WORDSIZE32_SIZE_ULONG 1 |
34 | # define __WORDSIZE32_PTRDIFF_LONG 1 | 33 | # define __WORDSIZE32_PTRDIFF_LONG 1 |
35 | +#else | 34 | +#else |
36 | +# define __WORDSIZE 32 | 35 | +#define __WORDSIZE 32 |
37 | +# define __WORDSIZE32_SIZE_ULONG 0 | 36 | +#define __WORDSIZE_TIME64_COMPAT32 1 |
38 | +# define __WORDSIZE32_PTRDIFF_LONG 0 | 37 | +#define __WORDSIZE32_SIZE_ULONG 0 |
38 | +#define __WORDSIZE32_PTRDIFF_LONG 0 | ||
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | +#ifdef __aarch64__ | ||
41 | #define __WORDSIZE_TIME64_COMPAT32 0 | 42 | #define __WORDSIZE_TIME64_COMPAT32 0 |
43 | +#endif | ||
44 | diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h | ||
45 | deleted file mode 100644 | ||
46 | index 6ecbfe7c86..0000000000 | ||
47 | --- a/sysdeps/arm/bits/wordsize.h | ||
48 | +++ /dev/null | ||
49 | @@ -1,21 +0,0 @@ | ||
50 | -/* Copyright (C) 1999-2024 Free Software Foundation, Inc. | ||
51 | - This file is part of the GNU C Library. | ||
52 | - | ||
53 | - The GNU C Library is free software; you can redistribute it and/or | ||
54 | - modify it under the terms of the GNU Lesser General Public | ||
55 | - License as published by the Free Software Foundation; either | ||
56 | - version 2.1 of the License, or (at your option) any later version. | ||
57 | - | ||
58 | - The GNU C Library is distributed in the hope that it will be useful, | ||
59 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
60 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
61 | - Lesser General Public License for more details. | ||
62 | - | ||
63 | - You should have received a copy of the GNU Lesser General Public | ||
64 | - License along with the GNU C Library; if not, see | ||
65 | - <https://www.gnu.org/licenses/>. */ | ||
66 | - | ||
67 | -#define __WORDSIZE 32 | ||
68 | -#define __WORDSIZE_TIME64_COMPAT32 1 | ||
69 | -#define __WORDSIZE32_SIZE_ULONG 0 | ||
70 | -#define __WORDSIZE32_PTRDIFF_LONG 0 | ||
42 | diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h | 71 | diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h |
43 | new file mode 120000 | 72 | new file mode 120000 |
44 | index 0000000000..4c4a788ec2 | 73 | index 0000000000..4c4a788ec2 |
diff --git a/meta/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch b/meta/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch deleted file mode 100644 index f6523c5498..0000000000 --- a/meta/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | From 73c26018ed0ecd9c807bb363cc2c2ab4aca66a82 Mon Sep 17 00:00:00 2001 | ||
2 | From: Szabolcs Nagy <szabolcs.nagy@arm.com> | ||
3 | Date: Wed, 13 Mar 2024 14:34:14 +0000 | ||
4 | Subject: [PATCH] aarch64: fix check for SVE support in assembler | ||
5 | |||
6 | Due to GCC bug 110901 -mcpu can override -march setting when compiling | ||
7 | asm code and thus a compiler targetting a specific cpu can fail the | ||
8 | configure check even when binutils gas supports SVE. | ||
9 | |||
10 | The workaround is that explicit .arch directive overrides both -mcpu | ||
11 | and -march, and since that's what the actual SVE memcpy uses the | ||
12 | configure check should use that too even if the GCC issue is fixed | ||
13 | independently. | ||
14 | |||
15 | Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=73c26018ed0ecd9c807bb363cc2c2ab4aca66a82] | ||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | Reviewed-by: Florian Weimer <fweimer@redhat.com> | ||
18 | --- | ||
19 | sysdeps/aarch64/configure | 5 +++-- | ||
20 | sysdeps/aarch64/configure.ac | 5 +++-- | ||
21 | 2 files changed, 6 insertions(+), 4 deletions(-) | ||
22 | mode change 100644 => 100755 sysdeps/aarch64/configure | ||
23 | |||
24 | diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure | ||
25 | old mode 100644 | ||
26 | new mode 100755 | ||
27 | index ca57edce47..9606137e8d | ||
28 | --- a/sysdeps/aarch64/configure | ||
29 | +++ b/sysdeps/aarch64/configure | ||
30 | @@ -325,9 +325,10 @@ then : | ||
31 | printf %s "(cached) " >&6 | ||
32 | else $as_nop | ||
33 | cat > conftest.s <<\EOF | ||
34 | - ptrue p0.b | ||
35 | + .arch armv8.2-a+sve | ||
36 | + ptrue p0.b | ||
37 | EOF | ||
38 | -if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5' | ||
39 | +if { ac_try='${CC-cc} -c conftest.s 1>&5' | ||
40 | { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 | ||
41 | (eval $ac_try) 2>&5 | ||
42 | ac_status=$? | ||
43 | diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac | ||
44 | index 27874eceb4..56d12d661d 100644 | ||
45 | --- a/sysdeps/aarch64/configure.ac | ||
46 | +++ b/sysdeps/aarch64/configure.ac | ||
47 | @@ -90,9 +90,10 @@ LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs]) | ||
48 | # Check if asm support armv8.2-a+sve | ||
49 | AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl | ||
50 | cat > conftest.s <<\EOF | ||
51 | - ptrue p0.b | ||
52 | + .arch armv8.2-a+sve | ||
53 | + ptrue p0.b | ||
54 | EOF | ||
55 | -if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then | ||
56 | +if AC_TRY_COMMAND(${CC-cc} -c conftest.s 1>&AS_MESSAGE_LOG_FD); then | ||
57 | libc_cv_aarch64_sve_asm=yes | ||
58 | else | ||
59 | libc_cv_aarch64_sve_asm=no | ||
60 | -- | ||
61 | 2.44.0 | ||
62 | |||
diff --git a/meta/recipes-core/glibc/glibc/0024-qemu-stale-process.patch b/meta/recipes-core/glibc/glibc/0023-qemu-stale-process.patch index c0a467fcec..c0a467fcec 100644 --- a/meta/recipes-core/glibc/glibc/0024-qemu-stale-process.patch +++ b/meta/recipes-core/glibc/glibc/0023-qemu-stale-process.patch | |||
diff --git a/meta/recipes-core/glibc/glibc_2.39.bb b/meta/recipes-core/glibc/glibc_2.39.bb index 9122472689..2484ae1cd9 100644 --- a/meta/recipes-core/glibc/glibc_2.39.bb +++ b/meta/recipes-core/glibc/glibc_2.39.bb | |||
@@ -16,6 +16,10 @@ CVE_STATUS[CVE-2019-1010025] = "disputed: \ | |||
16 | Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow \ | 16 | Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow \ |
17 | easier access for another. 'ASLR bypass itself is not a vulnerability.'" | 17 | easier access for another. 'ASLR bypass itself is not a vulnerability.'" |
18 | 18 | ||
19 | CVE_STATUS_GROUPS += "CVE_STATUS_STABLE_BACKPORTS" | ||
20 | CVE_STATUS_STABLE_BACKPORTS = "CVE-2024-2961 CVE-2024-33599 CVE-2024-33600 CVE-2024-33601 CVE-2024-33602" | ||
21 | CVE_STATUS_STABLE_BACKPORTS[status] = "cpe-stable-backport: fix available in used git hash" | ||
22 | |||
19 | DEPENDS += "gperf-native bison-native" | 23 | DEPENDS += "gperf-native bison-native" |
20 | 24 | ||
21 | NATIVESDKFIXES ?= "" | 25 | NATIVESDKFIXES ?= "" |
@@ -48,8 +52,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
48 | file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \ | 52 | file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \ |
49 | file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ | 53 | file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ |
50 | file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ | 54 | file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ |
51 | file://0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch \ | 55 | file://0023-qemu-stale-process.patch \ |
52 | file://0024-qemu-stale-process.patch \ | ||
53 | " | 56 | " |
54 | S = "${WORKDIR}/git" | 57 | S = "${WORKDIR}/git" |
55 | B = "${WORKDIR}/build-${TARGET_SYS}" | 58 | B = "${WORKDIR}/build-${TARGET_SYS}" |
diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb index c75dde5d13..c5d7bc18e7 100644 --- a/meta/recipes-core/images/build-appliance-image_15.0.0.bb +++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb | |||
@@ -26,7 +26,7 @@ inherit core-image setuptools3 features_check | |||
26 | 26 | ||
27 | REQUIRED_DISTRO_FEATURES += "xattr" | 27 | REQUIRED_DISTRO_FEATURES += "xattr" |
28 | 28 | ||
29 | SRCREV ?= "478a0070e157b46f6039b50f5d8ad0cbb9d776d5" | 29 | SRCREV ?= "b9b47b1a392b62364579332329dbff0d78e4b0b6" |
30 | SRC_URI = "git://git.yoctoproject.org/poky;branch=scarthgap \ | 30 | SRC_URI = "git://git.yoctoproject.org/poky;branch=scarthgap \ |
31 | file://Yocto_Build_Appliance.vmx \ | 31 | file://Yocto_Build_Appliance.vmx \ |
32 | file://Yocto_Build_Appliance.vmxf \ | 32 | file://Yocto_Build_Appliance.vmxf \ |
diff --git a/meta/recipes-core/libcgroup/libcgroup/0001-include-Makefile-install-systemd.h-by-default.patch b/meta/recipes-core/libcgroup/libcgroup/0001-include-Makefile-install-systemd.h-by-default.patch new file mode 100644 index 0000000000..4b743f9b33 --- /dev/null +++ b/meta/recipes-core/libcgroup/libcgroup/0001-include-Makefile-install-systemd.h-by-default.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From 592dcdcf243576bd2517d3da9bc18990de08e37e Mon Sep 17 00:00:00 2001 | ||
2 | From: Kamalesh Babulal <kamalesh.babulal@oracle.com> | ||
3 | Date: Mon, 27 Nov 2023 20:07:33 +0530 | ||
4 | Subject: [PATCH 1/1] include/Makefile: install systemd.h by default | ||
5 | |||
6 | Install systemd.h header file by default, as we have stub and defined | ||
7 | versions of the systemd functions for both non-systemd and systemd | ||
8 | enabled configurations. This will help packagers to ship package | ||
9 | without systemd support (--enable-systemd=no). | ||
10 | |||
11 | Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> | ||
12 | Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com> | ||
13 | |||
14 | Upstream-Status: Backport [https://github.com/libcgroup/libcgroup/commit/592dcdcf243576bd2517d3da9bc18990de08e37e] | ||
15 | |||
16 | Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com> | ||
17 | --- | ||
18 | include/Makefile.am | 6 +----- | ||
19 | 1 file changed, 1 insertion(+), 5 deletions(-) | ||
20 | |||
21 | diff --git a/include/Makefile.am b/include/Makefile.am | ||
22 | index 23cebaac..4cb05529 100644 | ||
23 | --- a/include/Makefile.am | ||
24 | +++ b/include/Makefile.am | ||
25 | @@ -2,8 +2,4 @@ | ||
26 | nobase_include_HEADERS = libcgroup.h libcgroup/error.h libcgroup/init.h \ | ||
27 | libcgroup/groups.h libcgroup/tasks.h \ | ||
28 | libcgroup/iterators.h libcgroup/config.h \ | ||
29 | - libcgroup/log.h libcgroup/tools.h | ||
30 | - | ||
31 | -if WITH_SYSTEMD | ||
32 | -nobase_include_HEADERS += libcgroup/systemd.h | ||
33 | -endif | ||
34 | + libcgroup/log.h libcgroup/tools.h libcgroup/systemd.h | ||
35 | -- | ||
36 | 2.39.2 | ||
37 | |||
diff --git a/meta/recipes-core/libcgroup/libcgroup_3.1.0.bb b/meta/recipes-core/libcgroup/libcgroup_3.1.0.bb index 4b4f19e36f..a1d27c7e7f 100644 --- a/meta/recipes-core/libcgroup/libcgroup_3.1.0.bb +++ b/meta/recipes-core/libcgroup/libcgroup_3.1.0.bb | |||
@@ -13,6 +13,7 @@ DEPENDS = "bison-native flex-native" | |||
13 | DEPENDS:append:libc-musl = " fts" | 13 | DEPENDS:append:libc-musl = " fts" |
14 | 14 | ||
15 | SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ | 15 | SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ |
16 | file://0001-include-Makefile-install-systemd.h-by-default.patch \ | ||
16 | " | 17 | " |
17 | UPSTREAM_CHECK_URI = "https://github.com/libcgroup/libcgroup/tags" | 18 | UPSTREAM_CHECK_URI = "https://github.com/libcgroup/libcgroup/tags" |
18 | 19 | ||
diff --git a/meta/recipes-core/ncurses/files/CVE-2023-45918.patch b/meta/recipes-core/ncurses/files/CVE-2023-45918.patch new file mode 100644 index 0000000000..fbdae49a61 --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-45918.patch | |||
@@ -0,0 +1,180 @@ | |||
1 | From bcf02d3242f1c7d57224a95f7903fcf4b5e7695d Mon Sep 17 00:00:00 2001 | ||
2 | From: Thomas E. Dickey <dickey@invisible-island.net> | ||
3 | Date: Fri, 16 Jun 2023 02:54:29 +0530 | ||
4 | Subject: [PATCH] Fix CVE-2023-45918 | ||
5 | |||
6 | CVE: CVE-2023-45918 | ||
7 | |||
8 | Upstream-Status: Backport [https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commit;h=bcf02d3242f1c7d57224a95f7903fcf4b5e7695d] | ||
9 | |||
10 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
11 | --- | ||
12 | ncurses/tinfo/comp_error.c | 15 ++++++--- | ||
13 | ncurses/tinfo/read_entry.c | 65 ++++++++++++++++++++++++++------------ | ||
14 | 2 files changed, 56 insertions(+), 24 deletions(-) | ||
15 | |||
16 | diff --git a/ncurses/tinfo/comp_error.c b/ncurses/tinfo/comp_error.c | ||
17 | index 48f48784..ee518e28 100644 | ||
18 | --- a/ncurses/tinfo/comp_error.c | ||
19 | +++ b/ncurses/tinfo/comp_error.c | ||
20 | @@ -60,8 +60,15 @@ _nc_get_source(void) | ||
21 | NCURSES_EXPORT(void) | ||
22 | _nc_set_source(const char *const name) | ||
23 | { | ||
24 | - FreeIfNeeded(SourceName); | ||
25 | - SourceName = strdup(name); | ||
26 | + if (name == NULL) { | ||
27 | + free(SourceName); | ||
28 | + SourceName = NULL; | ||
29 | + } else if (SourceName == NULL) { | ||
30 | + SourceName = strdup(name); | ||
31 | + } else if (strcmp(name, SourceName)) { | ||
32 | + free(SourceName); | ||
33 | + SourceName = strdup(name); | ||
34 | + } | ||
35 | } | ||
36 | |||
37 | NCURSES_EXPORT(void) | ||
38 | @@ -95,9 +102,9 @@ static NCURSES_INLINE void | ||
39 | where_is_problem(void) | ||
40 | { | ||
41 | fprintf(stderr, "\"%s\"", SourceName ? SourceName : "?"); | ||
42 | - if (_nc_curr_line >= 0) | ||
43 | + if (_nc_curr_line > 0) | ||
44 | fprintf(stderr, ", line %d", _nc_curr_line); | ||
45 | - if (_nc_curr_col >= 0) | ||
46 | + if (_nc_curr_col > 0) | ||
47 | fprintf(stderr, ", col %d", _nc_curr_col); | ||
48 | if (TermType != 0 && TermType[0] != '\0') | ||
49 | fprintf(stderr, ", terminal '%s'", TermType); | ||
50 | diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c | ||
51 | index 341337d2..b0c3ad26 100644 | ||
52 | --- a/ncurses/tinfo/read_entry.c | ||
53 | +++ b/ncurses/tinfo/read_entry.c | ||
54 | @@ -138,12 +138,13 @@ convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | -static void | ||
59 | -convert_strings(char *buf, char **Strings, int count, int size, char *table) | ||
60 | +static bool | ||
61 | +convert_strings(char *buf, char **Strings, int count, int size, | ||
62 | + char *table, bool always) | ||
63 | { | ||
64 | int i; | ||
65 | char *p; | ||
66 | - bool corrupt = FALSE; | ||
67 | + bool success = TRUE; | ||
68 | |||
69 | for (i = 0; i < count; i++) { | ||
70 | if (IS_NEG1(buf + 2 * i)) { | ||
71 | @@ -159,13 +160,10 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table) | ||
72 | TR(TRACE_DATABASE, ("Strings[%d] = %s", i, | ||
73 | _nc_visbuf(Strings[i]))); | ||
74 | } else { | ||
75 | - if (!corrupt) { | ||
76 | - corrupt = TRUE; | ||
77 | - TR(TRACE_DATABASE, | ||
78 | - ("ignore out-of-range index %d to Strings[]", nn)); | ||
79 | - _nc_warning("corrupt data found in convert_strings"); | ||
80 | - } | ||
81 | - Strings[i] = ABSENT_STRING; | ||
82 | + TR(TRACE_DATABASE, | ||
83 | + ("found out-of-range index %d to Strings[%d]", nn, i)); | ||
84 | + success = FALSE; | ||
85 | + break; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | @@ -175,10 +173,25 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table) | ||
90 | if (*p == '\0') | ||
91 | break; | ||
92 | /* if there is no NUL, ignore the string */ | ||
93 | - if (p >= table + size) | ||
94 | + if (p >= table + size) { | ||
95 | Strings[i] = ABSENT_STRING; | ||
96 | + } else if (p == Strings[i] && always) { | ||
97 | + TR(TRACE_DATABASE, | ||
98 | + ("found empty but required Strings[%d]", i)); | ||
99 | + success = FALSE; | ||
100 | + break; | ||
101 | + } | ||
102 | + } else if (always) { /* names are always needed */ | ||
103 | + TR(TRACE_DATABASE, | ||
104 | + ("found invalid but required Strings[%d]", i)); | ||
105 | + success = FALSE; | ||
106 | + break; | ||
107 | } | ||
108 | } | ||
109 | + if (!success) { | ||
110 | + _nc_warning("corrupt data found in convert_strings"); | ||
111 | + } | ||
112 | + return success; | ||
113 | } | ||
114 | |||
115 | static int | ||
116 | @@ -382,7 +395,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) | ||
117 | if (Read(string_table, (unsigned) str_size) != str_size) { | ||
118 | returnDB(TGETENT_NO); | ||
119 | } | ||
120 | - convert_strings(buf, ptr->Strings, str_count, str_size, string_table); | ||
121 | + if (!convert_strings(buf, ptr->Strings, str_count, str_size, | ||
122 | + string_table, FALSE)) { | ||
123 | + returnDB(TGETENT_NO); | ||
124 | + } | ||
125 | } | ||
126 | #if NCURSES_XNAMES | ||
127 | |||
128 | @@ -483,8 +499,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) | ||
129 | ("Before computing extended-string capabilities " | ||
130 | "str_count=%d, ext_str_count=%d", | ||
131 | str_count, ext_str_count)); | ||
132 | - convert_strings(buf, ptr->Strings + str_count, ext_str_count, | ||
133 | - ext_str_limit, ptr->ext_str_table); | ||
134 | + if (!convert_strings(buf, ptr->Strings + str_count, ext_str_count, | ||
135 | + ext_str_limit, ptr->ext_str_table, FALSE)) { | ||
136 | + returnDB(TGETENT_NO); | ||
137 | + } | ||
138 | for (i = ext_str_count - 1; i >= 0; i--) { | ||
139 | TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s", | ||
140 | i, i + str_count, | ||
141 | @@ -516,10 +534,13 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) | ||
142 | TR(TRACE_DATABASE, | ||
143 | ("ext_NAMES starting @%d in extended_strings, first = %s", | ||
144 | base, _nc_visbuf(ptr->ext_str_table + base))); | ||
145 | - convert_strings(buf + (2 * ext_str_count), | ||
146 | - ptr->ext_Names, | ||
147 | - (int) need, | ||
148 | - ext_str_limit, ptr->ext_str_table + base); | ||
149 | + if (!convert_strings(buf + (2 * ext_str_count), | ||
150 | + ptr->ext_Names, | ||
151 | + (int) need, | ||
152 | + ext_str_limit, ptr->ext_str_table + base, | ||
153 | + TRUE)) { | ||
154 | + returnDB(TGETENT_NO); | ||
155 | + } | ||
156 | } | ||
157 | |||
158 | TR(TRACE_DATABASE, | ||
159 | @@ -572,13 +593,17 @@ _nc_read_file_entry(const char *const filename, TERMTYPE2 *ptr) | ||
160 | int limit; | ||
161 | char buffer[MAX_ENTRY_SIZE + 1]; | ||
162 | |||
163 | - if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp)) | ||
164 | - > 0) { | ||
165 | + limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp); | ||
166 | + if (limit > 0) { | ||
167 | + const char *old_source = _nc_get_source(); | ||
168 | |||
169 | TR(TRACE_DATABASE, ("read terminfo %s", filename)); | ||
170 | + if (old_source == NULL) | ||
171 | + _nc_set_source(filename); | ||
172 | if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) { | ||
173 | _nc_free_termtype2(ptr); | ||
174 | } | ||
175 | + _nc_set_source(old_source); | ||
176 | } else { | ||
177 | code = TGETENT_NO; | ||
178 | } | ||
179 | -- | ||
180 | 2.40.0 | ||
diff --git a/meta/recipes-core/ncurses/files/CVE-2023-50495.patch b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch new file mode 100644 index 0000000000..7d90ddd30f --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch | |||
@@ -0,0 +1,301 @@ | |||
1 | From 7daae3f2139a678fe0ae0b42fcf8d807cbff485c Mon Sep 17 00:00:00 2001 | ||
2 | From: Mingli Yu <mingli.yu@windriver.com> | ||
3 | Date: Sun, 4 Feb 2024 13:42:38 +0800 | ||
4 | Subject: [PATCH] parse_entry.c: check return value of _nc_save_str | ||
5 | |||
6 | * check return value of _nc_save_str(), in special case for tic where | ||
7 | extended capabilities are processed but the terminal description was | ||
8 | not initialized (report by Ziqiao Kong). | ||
9 | |||
10 | * regenerate llib-* files. | ||
11 | |||
12 | CVE: CVE-2023-50495 | ||
13 | |||
14 | Upstream-Status: Backport [http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=7723dd6799ab10b32047ec73b14df9f107bafe99] | ||
15 | |||
16 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
17 | --- | ||
18 | ncurses/llib-lncurses | 15 +++++++++++++++ | ||
19 | ncurses/llib-lncursest | 15 +++++++++++++++ | ||
20 | ncurses/llib-lncursestw | 15 +++++++++++++++ | ||
21 | ncurses/llib-lncursesw | 15 +++++++++++++++ | ||
22 | ncurses/llib-ltinfo | 15 +++++++++++++++ | ||
23 | ncurses/llib-ltinfot | 15 +++++++++++++++ | ||
24 | ncurses/llib-ltinfotw | 15 +++++++++++++++ | ||
25 | ncurses/llib-ltinfow | 15 +++++++++++++++ | ||
26 | ncurses/tinfo/parse_entry.c | 23 ++++++++++++++++------- | ||
27 | 9 files changed, 136 insertions(+), 7 deletions(-) | ||
28 | |||
29 | diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses | ||
30 | index 211cf3b7..e4190aa2 100644 | ||
31 | --- a/ncurses/llib-lncurses | ||
32 | +++ b/ncurses/llib-lncurses | ||
33 | @@ -3656,6 +3656,21 @@ char *tiparm( | ||
34 | ...) | ||
35 | { return(*(char **)0); } | ||
36 | |||
37 | +#undef tiparm_s | ||
38 | +char *tiparm_s( | ||
39 | + int num_expected, | ||
40 | + int tparm_type, | ||
41 | + const char *string, | ||
42 | + ...) | ||
43 | + { return(*(char **)0); } | ||
44 | + | ||
45 | +#undef tiscan_s | ||
46 | +int tiscan_s( | ||
47 | + int *num_expected, | ||
48 | + int *tparm_type, | ||
49 | + const char *string) | ||
50 | + { return(*(int *)0); } | ||
51 | + | ||
52 | #undef _nc_tiparm | ||
53 | char *_nc_tiparm( | ||
54 | int expected, | ||
55 | diff --git a/ncurses/llib-lncursest b/ncurses/llib-lncursest | ||
56 | index 1b09d676..e07abba6 100644 | ||
57 | --- a/ncurses/llib-lncursest | ||
58 | +++ b/ncurses/llib-lncursest | ||
59 | @@ -3741,6 +3741,21 @@ char *tiparm( | ||
60 | ...) | ||
61 | { return(*(char **)0); } | ||
62 | |||
63 | +#undef tiparm_s | ||
64 | +char *tiparm_s( | ||
65 | + int num_expected, | ||
66 | + int tparm_type, | ||
67 | + const char *string, | ||
68 | + ...) | ||
69 | + { return(*(char **)0); } | ||
70 | + | ||
71 | +#undef tiscan_s | ||
72 | +int tiscan_s( | ||
73 | + int *num_expected, | ||
74 | + int *tparm_type, | ||
75 | + const char *string) | ||
76 | + { return(*(int *)0); } | ||
77 | + | ||
78 | #undef _nc_tiparm | ||
79 | char *_nc_tiparm( | ||
80 | int expected, | ||
81 | diff --git a/ncurses/llib-lncursestw b/ncurses/llib-lncursestw | ||
82 | index 4576e0fc..747c6be8 100644 | ||
83 | --- a/ncurses/llib-lncursestw | ||
84 | +++ b/ncurses/llib-lncursestw | ||
85 | @@ -4702,6 +4702,21 @@ char *tiparm( | ||
86 | ...) | ||
87 | { return(*(char **)0); } | ||
88 | |||
89 | +#undef tiparm_s | ||
90 | +char *tiparm_s( | ||
91 | + int num_expected, | ||
92 | + int tparm_type, | ||
93 | + const char *string, | ||
94 | + ...) | ||
95 | + { return(*(char **)0); } | ||
96 | + | ||
97 | +#undef tiscan_s | ||
98 | +int tiscan_s( | ||
99 | + int *num_expected, | ||
100 | + int *tparm_type, | ||
101 | + const char *string) | ||
102 | + { return(*(int *)0); } | ||
103 | + | ||
104 | #undef _nc_tiparm | ||
105 | char *_nc_tiparm( | ||
106 | int expected, | ||
107 | diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw | ||
108 | index 127350d2..862305d9 100644 | ||
109 | --- a/ncurses/llib-lncursesw | ||
110 | +++ b/ncurses/llib-lncursesw | ||
111 | @@ -4617,6 +4617,21 @@ char *tiparm( | ||
112 | ...) | ||
113 | { return(*(char **)0); } | ||
114 | |||
115 | +#undef tiparm_s | ||
116 | +char *tiparm_s( | ||
117 | + int num_expected, | ||
118 | + int tparm_type, | ||
119 | + const char *string, | ||
120 | + ...) | ||
121 | + { return(*(char **)0); } | ||
122 | + | ||
123 | +#undef tiscan_s | ||
124 | +int tiscan_s( | ||
125 | + int *num_expected, | ||
126 | + int *tparm_type, | ||
127 | + const char *string) | ||
128 | + { return(*(int *)0); } | ||
129 | + | ||
130 | #undef _nc_tiparm | ||
131 | char *_nc_tiparm( | ||
132 | int expected, | ||
133 | diff --git a/ncurses/llib-ltinfo b/ncurses/llib-ltinfo | ||
134 | index a5cd7cd3..31e5e9a6 100644 | ||
135 | --- a/ncurses/llib-ltinfo | ||
136 | +++ b/ncurses/llib-ltinfo | ||
137 | @@ -927,6 +927,21 @@ char *tiparm( | ||
138 | ...) | ||
139 | { return(*(char **)0); } | ||
140 | |||
141 | +#undef tiparm_s | ||
142 | +char *tiparm_s( | ||
143 | + int num_expected, | ||
144 | + int tparm_type, | ||
145 | + const char *string, | ||
146 | + ...) | ||
147 | + { return(*(char **)0); } | ||
148 | + | ||
149 | +#undef tiscan_s | ||
150 | +int tiscan_s( | ||
151 | + int *num_expected, | ||
152 | + int *tparm_type, | ||
153 | + const char *string) | ||
154 | + { return(*(int *)0); } | ||
155 | + | ||
156 | #undef _nc_tiparm | ||
157 | char *_nc_tiparm( | ||
158 | int expected, | ||
159 | diff --git a/ncurses/llib-ltinfot b/ncurses/llib-ltinfot | ||
160 | index bd3de812..48e5c25a 100644 | ||
161 | --- a/ncurses/llib-ltinfot | ||
162 | +++ b/ncurses/llib-ltinfot | ||
163 | @@ -1003,6 +1003,21 @@ char *tiparm( | ||
164 | ...) | ||
165 | { return(*(char **)0); } | ||
166 | |||
167 | +#undef tiparm_s | ||
168 | +char *tiparm_s( | ||
169 | + int num_expected, | ||
170 | + int tparm_type, | ||
171 | + const char *string, | ||
172 | + ...) | ||
173 | + { return(*(char **)0); } | ||
174 | + | ||
175 | +#undef tiscan_s | ||
176 | +int tiscan_s( | ||
177 | + int *num_expected, | ||
178 | + int *tparm_type, | ||
179 | + const char *string) | ||
180 | + { return(*(int *)0); } | ||
181 | + | ||
182 | #undef _nc_tiparm | ||
183 | char *_nc_tiparm( | ||
184 | int expected, | ||
185 | diff --git a/ncurses/llib-ltinfotw b/ncurses/llib-ltinfotw | ||
186 | index 4d35a1e1..64dfdfa5 100644 | ||
187 | --- a/ncurses/llib-ltinfotw | ||
188 | +++ b/ncurses/llib-ltinfotw | ||
189 | @@ -1025,6 +1025,21 @@ char *tiparm( | ||
190 | ...) | ||
191 | { return(*(char **)0); } | ||
192 | |||
193 | +#undef tiparm_s | ||
194 | +char *tiparm_s( | ||
195 | + int num_expected, | ||
196 | + int tparm_type, | ||
197 | + const char *string, | ||
198 | + ...) | ||
199 | + { return(*(char **)0); } | ||
200 | + | ||
201 | +#undef tiscan_s | ||
202 | +int tiscan_s( | ||
203 | + int *num_expected, | ||
204 | + int *tparm_type, | ||
205 | + const char *string) | ||
206 | + { return(*(int *)0); } | ||
207 | + | ||
208 | #undef _nc_tiparm | ||
209 | char *_nc_tiparm( | ||
210 | int expected, | ||
211 | diff --git a/ncurses/llib-ltinfow b/ncurses/llib-ltinfow | ||
212 | index db846764..7e17a35f 100644 | ||
213 | --- a/ncurses/llib-ltinfow | ||
214 | +++ b/ncurses/llib-ltinfow | ||
215 | @@ -949,6 +949,21 @@ char *tiparm( | ||
216 | ...) | ||
217 | { return(*(char **)0); } | ||
218 | |||
219 | +#undef tiparm_s | ||
220 | +char *tiparm_s( | ||
221 | + int num_expected, | ||
222 | + int tparm_type, | ||
223 | + const char *string, | ||
224 | + ...) | ||
225 | + { return(*(char **)0); } | ||
226 | + | ||
227 | +#undef tiscan_s | ||
228 | +int tiscan_s( | ||
229 | + int *num_expected, | ||
230 | + int *tparm_type, | ||
231 | + const char *string) | ||
232 | + { return(*(int *)0); } | ||
233 | + | ||
234 | #undef _nc_tiparm | ||
235 | char *_nc_tiparm( | ||
236 | int expected, | ||
237 | diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c | ||
238 | index 14bcb67e..0a0b5637 100644 | ||
239 | --- a/ncurses/tinfo/parse_entry.c | ||
240 | +++ b/ncurses/tinfo/parse_entry.c | ||
241 | @@ -110,7 +110,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
242 | /* Well, we are given a cancel for a name that we don't recognize */ | ||
243 | return _nc_extend_names(entryp, name, STRING); | ||
244 | default: | ||
245 | - return 0; | ||
246 | + return NULL; | ||
247 | } | ||
248 | |||
249 | /* Adjust the 'offset' (insertion-point) to keep the lists of extended | ||
250 | @@ -142,6 +142,11 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
251 | for (last = (unsigned) (max - 1); last > tindex; last--) | ||
252 | |||
253 | if (!found) { | ||
254 | + char *saved; | ||
255 | + | ||
256 | + if ((saved = _nc_save_str(name)) == NULL) | ||
257 | + return NULL; | ||
258 | + | ||
259 | switch (token_type) { | ||
260 | case BOOLEAN: | ||
261 | tp->ext_Booleans++; | ||
262 | @@ -169,7 +174,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
263 | TYPE_REALLOC(char *, actual, tp->ext_Names); | ||
264 | while (--actual > offset) | ||
265 | tp->ext_Names[actual] = tp->ext_Names[actual - 1]; | ||
266 | - tp->ext_Names[offset] = _nc_save_str(name); | ||
267 | + tp->ext_Names[offset] = saved; | ||
268 | } | ||
269 | |||
270 | temp.nte_name = tp->ext_Names[offset]; | ||
271 | @@ -364,6 +369,8 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
272 | bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); | ||
273 | bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); | ||
274 | if (is_use || is_tc) { | ||
275 | + char *saved; | ||
276 | + | ||
277 | if (!VALID_STRING(_nc_curr_token.tk_valstring) | ||
278 | || _nc_curr_token.tk_valstring[0] == '\0') { | ||
279 | _nc_warning("missing name for use-clause"); | ||
280 | @@ -377,11 +384,13 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
281 | _nc_curr_token.tk_valstring); | ||
282 | continue; | ||
283 | } | ||
284 | - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); | ||
285 | - entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
286 | - entryp->nuses++; | ||
287 | - if (entryp->nuses > 1 && is_tc) { | ||
288 | - BAD_TC_USAGE | ||
289 | + if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { | ||
290 | + entryp->uses[entryp->nuses].name = saved; | ||
291 | + entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
292 | + entryp->nuses++; | ||
293 | + if (entryp->nuses > 1 && is_tc) { | ||
294 | + BAD_TC_USAGE | ||
295 | + } | ||
296 | } | ||
297 | } else { | ||
298 | /* normal token lookup */ | ||
299 | -- | ||
300 | 2.25.1 | ||
301 | |||
diff --git a/meta/recipes-core/ncurses/ncurses_6.4.bb b/meta/recipes-core/ncurses/ncurses_6.4.bb index 2c621525f9..97130c06d6 100644 --- a/meta/recipes-core/ncurses/ncurses_6.4.bb +++ b/meta/recipes-core/ncurses/ncurses_6.4.bb | |||
@@ -6,6 +6,8 @@ SRC_URI += "file://0001-tic-hang.patch \ | |||
6 | file://exit_prototype.patch \ | 6 | file://exit_prototype.patch \ |
7 | file://0001-Fix-CVE-2023-29491.patch \ | 7 | file://0001-Fix-CVE-2023-29491.patch \ |
8 | file://0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch \ | 8 | file://0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch \ |
9 | file://CVE-2023-50495.patch \ | ||
10 | file://CVE-2023-45918.patch \ | ||
9 | " | 11 | " |
10 | # commit id corresponds to the revision in package version | 12 | # commit id corresponds to the revision in package version |
11 | SRCREV = "79b9071f2be20a24c7be031655a5638f6032f29f" | 13 | SRCREV = "79b9071f2be20a24c7be031655a5638f6032f29f" |
diff --git a/meta/recipes-core/newlib/libgloss_git.bb b/meta/recipes-core/newlib/libgloss_git.bb index 7e34e33c7a..3c97a7f296 100644 --- a/meta/recipes-core/newlib/libgloss_git.bb +++ b/meta/recipes-core/newlib/libgloss_git.bb | |||
@@ -6,7 +6,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/libgloss:" | |||
6 | 6 | ||
7 | SRC_URI:append = " file://libgloss-build-without-nostdinc.patch" | 7 | SRC_URI:append = " file://libgloss-build-without-nostdinc.patch" |
8 | SRC_URI:append:powerpc = " file://fix-rs6000-crt0.patch" | 8 | SRC_URI:append:powerpc = " file://fix-rs6000-crt0.patch" |
9 | SRC_URI:append:powerpc = " file://fix-rs6000-cflags.patch" | ||
10 | 9 | ||
11 | do_configure() { | 10 | do_configure() { |
12 | ${S}/libgloss/configure ${EXTRA_OECONF} | 11 | ${S}/libgloss/configure ${EXTRA_OECONF} |
diff --git a/meta/recipes-core/ttyrun/ttyrun_2.31.0.bb b/meta/recipes-core/ttyrun/ttyrun_2.31.0.bb index 122dd9d8e7..fac11d6310 100644 --- a/meta/recipes-core/ttyrun/ttyrun_2.31.0.bb +++ b/meta/recipes-core/ttyrun/ttyrun_2.31.0.bb | |||
@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=f5118f167b055bfd7c3450803f1847af" | |||
9 | SRC_URI = "git://github.com/ibm-s390-linux/s390-tools;protocol=https;branch=master" | 9 | SRC_URI = "git://github.com/ibm-s390-linux/s390-tools;protocol=https;branch=master" |
10 | SRCREV = "6f15ed326491a17d83ca60cd2bda47fb5e8a0175" | 10 | SRCREV = "6f15ed326491a17d83ca60cd2bda47fb5e8a0175" |
11 | 11 | ||
12 | CVE_PRODUCT = "s390-tools" | ||
13 | |||
12 | S = "${WORKDIR}/git" | 14 | S = "${WORKDIR}/git" |
13 | 15 | ||
14 | EXTRA_OEMAKE = "\ | 16 | EXTRA_OEMAKE = "\ |
diff --git a/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb b/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb index ba622fe716..27723c88ef 100644 --- a/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb +++ b/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb | |||
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=d40a07c27f5354 | |||
8 | 8 | ||
9 | SRC_URI = "git://git.yoctoproject.org/update-rc.d;branch=master;protocol=https" | 9 | SRC_URI = "git://git.yoctoproject.org/update-rc.d;branch=master;protocol=https" |
10 | SRCREV = "b8f950105010270a768aa12245d6abf166346015" | 10 | SRCREV = "b8f950105010270a768aa12245d6abf166346015" |
11 | PV .= "+git" | ||
11 | 12 | ||
12 | UPSTREAM_CHECK_COMMITS = "1" | 13 | UPSTREAM_CHECK_COMMITS = "1" |
13 | 14 | ||
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc index d506783f9a..48520ef951 100644 --- a/meta/recipes-core/util-linux/util-linux.inc +++ b/meta/recipes-core/util-linux/util-linux.inc | |||
@@ -40,6 +40,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin | |||
40 | file://avoid_parallel_tests.patch \ | 40 | file://avoid_parallel_tests.patch \ |
41 | file://0001-login-utils-include-libgen.h-for-basename-API.patch \ | 41 | file://0001-login-utils-include-libgen.h-for-basename-API.patch \ |
42 | file://fcntl-lock.c \ | 42 | file://fcntl-lock.c \ |
43 | file://CVE-2024-28085-0001.patch \ | ||
44 | file://CVE-2024-28085-0002.patch \ | ||
43 | " | 45 | " |
44 | 46 | ||
45 | SRC_URI[sha256sum] = "7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f" | 47 | SRC_URI[sha256sum] = "7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f" |
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0001.patch b/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0001.patch new file mode 100644 index 0000000000..af39931b3f --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0001.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From 07f0f0f5bd1e5e2268257ae1ff6d76a9b6c6ea8b Mon Sep 17 00:00:00 2001 | ||
2 | From: Karel Zak <kzak@redhat.com> | ||
3 | Date: Wed, 17 Jan 2024 12:37:08 +0100 | ||
4 | Subject: [PATCH] wall: fix calloc cal [-Werror=calloc-transposed-args] | ||
5 | |||
6 | term-utils/wall.c:143:37: error: xcalloc sizes specified with sizeof in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] | ||
7 | 143 | buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups); | ||
8 | | ^ | ||
9 | term-utils/wall.c:143:37: note: earlier argument should specify number of elements, later size of each element | ||
10 | |||
11 | Signed-off-by: Karel Zak <kzak@redhat.com> | ||
12 | |||
13 | CVE: CVE-2024-28085 | ||
14 | |||
15 | Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/07f0f0f5bd1e5e2268257ae1ff6d76a9b6c6ea8b] | ||
16 | |||
17 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
18 | --- | ||
19 | term-utils/wall.c | 2 +- | ||
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/term-utils/wall.c b/term-utils/wall.c | ||
23 | index 377db45..85c006a 100644 | ||
24 | --- a/term-utils/wall.c | ||
25 | +++ b/term-utils/wall.c | ||
26 | @@ -135,7 +135,7 @@ static struct group_workspace *init_group_workspace(const char *group) | ||
27 | |||
28 | buf->requested_group = get_group_gid(group); | ||
29 | buf->ngroups = sysconf(_SC_NGROUPS_MAX) + 1; /* room for the primary gid */ | ||
30 | - buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups); | ||
31 | + buf->groups = xcalloc(buf->ngroups, sizeof(*buf->groups)); | ||
32 | |||
33 | return buf; | ||
34 | } | ||
35 | -- | ||
36 | 2.40.0 | ||
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0002.patch b/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0002.patch new file mode 100644 index 0000000000..a2b914d580 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/CVE-2024-28085-0002.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 404b0781f52f7c045ca811b2dceec526408ac253 Mon Sep 17 00:00:00 2001 | ||
2 | From: Karel Zak <kzak@redhat.com> | ||
3 | Date: Thu, 21 Mar 2024 11:16:20 +0100 | ||
4 | Subject: [PATCH] wall: fix escape sequence Injection [CVE-2024-28085] | ||
5 | |||
6 | Let's use for all cases the same output function. | ||
7 | |||
8 | Reported-by: Skyler Ferrante <sjf5462@rit.edu> | ||
9 | Signed-off-by: Karel Zak <kzak@redhat.com> | ||
10 | |||
11 | CVE: CVE-2024-28085 | ||
12 | |||
13 | Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/404b0781f52f7c045ca811b2dceec526408ac253] | ||
14 | |||
15 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
16 | --- | ||
17 | term-utils/wall.c | 2 +- | ||
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/term-utils/wall.c b/term-utils/wall.c | ||
21 | index 85c006a..0212c03 100644 | ||
22 | --- a/term-utils/wall.c | ||
23 | +++ b/term-utils/wall.c | ||
24 | @@ -328,7 +328,7 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, | ||
25 | int i; | ||
26 | |||
27 | for (i = 0; i < mvecsz; i++) { | ||
28 | - fputs(mvec[i], fs); | ||
29 | + fputs_careful(mvec[i], fs, '^', true, TERM_WIDTH); | ||
30 | if (i < mvecsz - 1) | ||
31 | fputc(' ', fs); | ||
32 | } | ||
33 | -- | ||
34 | 2.40.0 | ||
diff --git a/meta/recipes-devtools/binutils/binutils-2.42.inc b/meta/recipes-devtools/binutils/binutils-2.42.inc index 3b6f47d4ce..d2f49560f3 100644 --- a/meta/recipes-devtools/binutils/binutils-2.42.inc +++ b/meta/recipes-devtools/binutils/binutils-2.42.inc | |||
@@ -36,5 +36,6 @@ SRC_URI = "\ | |||
36 | file://0013-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ | 36 | file://0013-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ |
37 | file://0014-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \ | 37 | file://0014-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \ |
38 | file://0015-gprofng-change-use-of-bignum-to-bigint.patch \ | 38 | file://0015-gprofng-change-use-of-bignum-to-bigint.patch \ |
39 | file://0016-aarch64-Remove-asserts-from-operand-qualifier-decode.patch \ | ||
39 | " | 40 | " |
40 | S = "${WORKDIR}/git" | 41 | S = "${WORKDIR}/git" |
diff --git a/meta/recipes-devtools/binutils/binutils/0016-aarch64-Remove-asserts-from-operand-qualifier-decode.patch b/meta/recipes-devtools/binutils/binutils/0016-aarch64-Remove-asserts-from-operand-qualifier-decode.patch new file mode 100644 index 0000000000..7b52425a38 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0016-aarch64-Remove-asserts-from-operand-qualifier-decode.patch | |||
@@ -0,0 +1,382 @@ | |||
1 | From 5b1c70bfe0d8f84dc28237d6150b7b9d57c791a8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Victor Do Nascimento <victor.donascimento@arm.com> | ||
3 | Date: Tue, 16 Apr 2024 11:49:15 +0100 | ||
4 | Subject: [PATCH] aarch64: Remove asserts from operand qualifier decoders | ||
5 | [PR31595] | ||
6 | |||
7 | Given that the disassembler should never abort when decoding | ||
8 | (potentially random) data, assertion statements in the | ||
9 | `get_*reg_qualifier_from_value' function family prove problematic. | ||
10 | |||
11 | Consider the random 32-bit word W, encoded in a data segment and | ||
12 | encountered on execution of `objdump -D <obj_name>'. | ||
13 | |||
14 | If: | ||
15 | |||
16 | (W & ~opcode_mask) == valid instruction | ||
17 | |||
18 | Then before `print_insn_aarch64_word' has a chance to report the | ||
19 | instruction as potentially undefined, an attempt will be made to have | ||
20 | the qualifiers for the instruction's register operands (if any) | ||
21 | decoded. If the relevant bits do not map onto a valid qualifier for | ||
22 | the matched instruction-like word, an abort will be triggered and the | ||
23 | execution of objdump aborted. | ||
24 | |||
25 | As this scenario is perfectly feasible and, in light of the fact that | ||
26 | objdump must successfully decode all sections of a given object file, | ||
27 | it is not appropriate to assert in this family of functions. | ||
28 | |||
29 | Therefore, we add a new pseudo-qualifier `AARCH64_OPND_QLF_ERR' for | ||
30 | handling invalid qualifier-associated values and re-purpose the | ||
31 | assertion conditions in qualifier-retrieving functions to be the | ||
32 | predicate guarding the returning of the calculated qualifier type. | ||
33 | If the predicate fails, we return this new qualifier and allow the | ||
34 | caller to handle the error as appropriate. | ||
35 | |||
36 | As these functions are called either from within | ||
37 | `aarch64_extract_operand' or `do_special_decoding', both of which are | ||
38 | expected to return non-zero values, it suffices that callers return | ||
39 | zero upon encountering `AARCH64_OPND_QLF_ERR'. | ||
40 | |||
41 | Ar present the error presented in the hypothetical scenario has been | ||
42 | encountered in `get_sreg_qualifier_from_value', but the change is made | ||
43 | to the whole family to keep the interface consistent. | ||
44 | |||
45 | Bug: https://sourceware.org/PR31595 | ||
46 | |||
47 | Upstream-Status: Backport [commit 2601b201e95ea0edab89342ee7137c74e88a8a79] | ||
48 | |||
49 | Signed-off-by: Mark Hatle <mark.hatle@amd.com> | ||
50 | --- | ||
51 | .../testsuite/binutils-all/aarch64/illegal.d | 1 + | ||
52 | .../testsuite/binutils-all/aarch64/illegal.s | 3 + | ||
53 | include/opcode/aarch64.h | 3 + | ||
54 | opcodes/aarch64-dis.c | 98 +++++++++++++++---- | ||
55 | 4 files changed, 87 insertions(+), 18 deletions(-) | ||
56 | |||
57 | diff --git a/binutils/testsuite/binutils-all/aarch64/illegal.d b/binutils/testsuite/binutils-all/aarch64/illegal.d | ||
58 | index 4b90a1d9f39..b69318aec85 100644 | ||
59 | --- a/binutils/testsuite/binutils-all/aarch64/illegal.d | ||
60 | +++ b/binutils/testsuite/binutils-all/aarch64/illegal.d | ||
61 | @@ -8,5 +8,6 @@ Disassembly of section \.text: | ||
62 | |||
63 | 0+000 <.*>: | ||
64 | [ ]+0:[ ]+68ea18cc[ ]+.inst[ ]+0x68ea18cc ; undefined | ||
65 | +[ ]+4:[ ]+9dc39839[ ]+.inst[ ]+0x9dc39839 ; undefined | ||
66 | #pass | ||
67 | |||
68 | diff --git a/binutils/testsuite/binutils-all/aarch64/illegal.s b/binutils/testsuite/binutils-all/aarch64/illegal.s | ||
69 | index 216cbe6f265..43668c6db55 100644 | ||
70 | --- a/binutils/testsuite/binutils-all/aarch64/illegal.s | ||
71 | +++ b/binutils/testsuite/binutils-all/aarch64/illegal.s | ||
72 | @@ -4,4 +4,7 @@ | ||
73 | # ldpsw x12, x6, [x6],#-8 ; illegal because one of the dest regs is also the address reg | ||
74 | .inst 0x68ea18cc | ||
75 | |||
76 | + # illegal, resembles the opcode `ldapur' with invalid qualifier bits | ||
77 | + .inst 0x9dc39839 | ||
78 | + | ||
79 | # FIXME: Add more illegal instructions here. | ||
80 | diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h | ||
81 | index 2fca9528c20..e8fe93ef127 100644 | ||
82 | --- a/include/opcode/aarch64.h | ||
83 | +++ b/include/opcode/aarch64.h | ||
84 | @@ -894,6 +894,9 @@ enum aarch64_opnd_qualifier | ||
85 | /* Special qualifier helping retrieve qualifier information during the | ||
86 | decoding time (currently not in use). */ | ||
87 | AARCH64_OPND_QLF_RETRIEVE, | ||
88 | + | ||
89 | + /* Special qualifier used for indicating error in qualifier retrieval. */ | ||
90 | + AARCH64_OPND_QLF_ERR, | ||
91 | }; | ||
92 | |||
93 | /* Instruction class. */ | ||
94 | diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c | ||
95 | index 96f42ae862a..b70e6da9eb7 100644 | ||
96 | --- a/opcodes/aarch64-dis.c | ||
97 | +++ b/opcodes/aarch64-dis.c | ||
98 | @@ -219,9 +219,10 @@ static inline enum aarch64_opnd_qualifier | ||
99 | get_greg_qualifier_from_value (aarch64_insn value) | ||
100 | { | ||
101 | enum aarch64_opnd_qualifier qualifier = AARCH64_OPND_QLF_W + value; | ||
102 | - assert (value <= 0x1 | ||
103 | - && aarch64_get_qualifier_standard_value (qualifier) == value); | ||
104 | - return qualifier; | ||
105 | + if (value <= 0x1 | ||
106 | + && aarch64_get_qualifier_standard_value (qualifier) == value) | ||
107 | + return qualifier; | ||
108 | + return AARCH64_OPND_QLF_ERR; | ||
109 | } | ||
110 | |||
111 | /* Given VALUE, return qualifier for a vector register. This does not support | ||
112 | @@ -237,9 +238,10 @@ get_vreg_qualifier_from_value (aarch64_insn value) | ||
113 | if (qualifier >= AARCH64_OPND_QLF_V_2H) | ||
114 | qualifier += 1; | ||
115 | |||
116 | - assert (value <= 0x8 | ||
117 | - && aarch64_get_qualifier_standard_value (qualifier) == value); | ||
118 | - return qualifier; | ||
119 | + if (value <= 0x8 | ||
120 | + && aarch64_get_qualifier_standard_value (qualifier) == value) | ||
121 | + return qualifier; | ||
122 | + return AARCH64_OPND_QLF_ERR; | ||
123 | } | ||
124 | |||
125 | /* Given VALUE, return qualifier for an FP or AdvSIMD scalar register. */ | ||
126 | @@ -248,9 +250,10 @@ get_sreg_qualifier_from_value (aarch64_insn value) | ||
127 | { | ||
128 | enum aarch64_opnd_qualifier qualifier = AARCH64_OPND_QLF_S_B + value; | ||
129 | |||
130 | - assert (value <= 0x4 | ||
131 | - && aarch64_get_qualifier_standard_value (qualifier) == value); | ||
132 | - return qualifier; | ||
133 | + if (value <= 0x4 | ||
134 | + && aarch64_get_qualifier_standard_value (qualifier) == value) | ||
135 | + return qualifier; | ||
136 | + return AARCH64_OPND_QLF_ERR; | ||
137 | } | ||
138 | |||
139 | /* Given the instruction in *INST which is probably half way through the | ||
140 | @@ -263,13 +266,17 @@ get_expected_qualifier (const aarch64_inst *inst, int i) | ||
141 | { | ||
142 | aarch64_opnd_qualifier_seq_t qualifiers; | ||
143 | /* Should not be called if the qualifier is known. */ | ||
144 | - assert (inst->operands[i].qualifier == AARCH64_OPND_QLF_NIL); | ||
145 | - int invalid_count; | ||
146 | - if (aarch64_find_best_match (inst, inst->opcode->qualifiers_list, | ||
147 | - i, qualifiers, &invalid_count)) | ||
148 | - return qualifiers[i]; | ||
149 | + if (inst->operands[i].qualifier == AARCH64_OPND_QLF_NIL) | ||
150 | + { | ||
151 | + int invalid_count; | ||
152 | + if (aarch64_find_best_match (inst, inst->opcode->qualifiers_list, | ||
153 | + i, qualifiers, &invalid_count)) | ||
154 | + return qualifiers[i]; | ||
155 | + else | ||
156 | + return AARCH64_OPND_QLF_NIL; | ||
157 | + } | ||
158 | else | ||
159 | - return AARCH64_OPND_QLF_NIL; | ||
160 | + return AARCH64_OPND_QLF_ERR; | ||
161 | } | ||
162 | |||
163 | /* Operand extractors. */ | ||
164 | @@ -355,6 +362,8 @@ aarch64_ext_reglane (const aarch64_operand *self, aarch64_opnd_info *info, | ||
165 | aarch64_insn value = extract_field (FLD_imm4_11, code, 0); | ||
166 | /* Depend on AARCH64_OPND_Ed to determine the qualifier. */ | ||
167 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
168 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
169 | + return 0; | ||
170 | shift = get_logsz (aarch64_get_qualifier_esize (info->qualifier)); | ||
171 | info->reglane.index = value >> shift; | ||
172 | } | ||
173 | @@ -374,6 +383,8 @@ aarch64_ext_reglane (const aarch64_operand *self, aarch64_opnd_info *info, | ||
174 | if (pos > 3) | ||
175 | return false; | ||
176 | info->qualifier = get_sreg_qualifier_from_value (pos); | ||
177 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
178 | + return 0; | ||
179 | info->reglane.index = (unsigned) (value >> 1); | ||
180 | } | ||
181 | } | ||
182 | @@ -381,6 +392,8 @@ aarch64_ext_reglane (const aarch64_operand *self, aarch64_opnd_info *info, | ||
183 | { | ||
184 | /* Need information in other operand(s) to help decoding. */ | ||
185 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
186 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
187 | + return 0; | ||
188 | switch (info->qualifier) | ||
189 | { | ||
190 | case AARCH64_OPND_QLF_S_4B: | ||
191 | @@ -405,6 +418,8 @@ aarch64_ext_reglane (const aarch64_operand *self, aarch64_opnd_info *info, | ||
192 | |||
193 | /* Need information in other operand(s) to help decoding. */ | ||
194 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
195 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
196 | + return 0; | ||
197 | switch (info->qualifier) | ||
198 | { | ||
199 | case AARCH64_OPND_QLF_S_H: | ||
200 | @@ -644,9 +659,15 @@ aarch64_ext_advsimd_imm_shift (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
201 | 1xxx 1 2D */ | ||
202 | info->qualifier = | ||
203 | get_vreg_qualifier_from_value ((pos << 1) | (int) Q); | ||
204 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
205 | + return false; | ||
206 | } | ||
207 | else | ||
208 | - info->qualifier = get_sreg_qualifier_from_value (pos); | ||
209 | + { | ||
210 | + info->qualifier = get_sreg_qualifier_from_value (pos); | ||
211 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
212 | + return 0; | ||
213 | + } | ||
214 | |||
215 | if (info->type == AARCH64_OPND_IMM_VLSR) | ||
216 | /* immh <shift> | ||
217 | @@ -773,6 +794,8 @@ aarch64_ext_advsimd_imm_modified (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
218 | |||
219 | /* cmode */ | ||
220 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
221 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
222 | + return 0; | ||
223 | switch (info->qualifier) | ||
224 | { | ||
225 | case AARCH64_OPND_QLF_NIL: | ||
226 | @@ -1014,6 +1037,8 @@ aarch64_ext_ft (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
227 | if (value > 0x4) | ||
228 | return false; | ||
229 | info->qualifier = get_sreg_qualifier_from_value (value); | ||
230 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
231 | + return 0; | ||
232 | } | ||
233 | |||
234 | return true; | ||
235 | @@ -1086,6 +1111,8 @@ aarch64_ext_rcpc3_addr_offset (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
236 | aarch64_operand_error *errors ATTRIBUTE_UNUSED) | ||
237 | { | ||
238 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
239 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
240 | + return 0; | ||
241 | |||
242 | /* Rn */ | ||
243 | info->addr.base_regno = extract_field (self->fields[0], code, 0); | ||
244 | @@ -1105,6 +1132,8 @@ aarch64_ext_addr_offset (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
245 | aarch64_operand_error *errors ATTRIBUTE_UNUSED) | ||
246 | { | ||
247 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
248 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
249 | + return 0; | ||
250 | |||
251 | /* Rn */ | ||
252 | info->addr.base_regno = extract_field (self->fields[0], code, 0); | ||
253 | @@ -1154,6 +1183,8 @@ aarch64_ext_addr_regoff (const aarch64_operand *self ATTRIBUTE_UNUSED, | ||
254 | /* Need information in other operand(s) to help achieve the decoding | ||
255 | from 'S' field. */ | ||
256 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
257 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
258 | + return 0; | ||
259 | /* Get the size of the data element that is accessed, which may be | ||
260 | different from that of the source register size, e.g. in strb/ldrb. */ | ||
261 | size = aarch64_get_qualifier_esize (info->qualifier); | ||
262 | @@ -1172,6 +1203,8 @@ aarch64_ext_addr_simm (const aarch64_operand *self, aarch64_opnd_info *info, | ||
263 | { | ||
264 | aarch64_insn imm; | ||
265 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
266 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
267 | + return 0; | ||
268 | |||
269 | /* Rn */ | ||
270 | info->addr.base_regno = extract_field (FLD_Rn, code, 0); | ||
271 | @@ -1210,6 +1243,8 @@ aarch64_ext_addr_uimm12 (const aarch64_operand *self, aarch64_opnd_info *info, | ||
272 | { | ||
273 | int shift; | ||
274 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
275 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
276 | + return 0; | ||
277 | shift = get_logsz (aarch64_get_qualifier_esize (info->qualifier)); | ||
278 | /* Rn */ | ||
279 | info->addr.base_regno = extract_field (self->fields[0], code, 0); | ||
280 | @@ -1228,6 +1263,8 @@ aarch64_ext_addr_simm10 (const aarch64_operand *self, aarch64_opnd_info *info, | ||
281 | aarch64_insn imm; | ||
282 | |||
283 | info->qualifier = get_expected_qualifier (inst, info->idx); | ||
284 | + if (info->qualifier == AARCH64_OPND_QLF_ERR) | ||
285 | + return 0; | ||
286 | /* Rn */ | ||
287 | info->addr.base_regno = extract_field (self->fields[0], code, 0); | ||
288 | /* simm10 */ | ||
289 | @@ -2467,6 +2504,8 @@ decode_sizeq (aarch64_inst *inst) | ||
290 | if (mask == 0x7) | ||
291 | { | ||
292 | inst->operands[idx].qualifier = get_vreg_qualifier_from_value (value); | ||
293 | + if (inst->operands[idx].qualifier == AARCH64_OPND_QLF_ERR) | ||
294 | + return 0; | ||
295 | return 1; | ||
296 | } | ||
297 | |||
298 | @@ -2649,6 +2688,8 @@ do_special_decoding (aarch64_inst *inst) | ||
299 | idx = select_operand_for_sf_field_coding (inst->opcode); | ||
300 | value = extract_field (FLD_sf, inst->value, 0); | ||
301 | inst->operands[idx].qualifier = get_greg_qualifier_from_value (value); | ||
302 | + if (inst->operands[idx].qualifier == AARCH64_OPND_QLF_ERR) | ||
303 | + return 0; | ||
304 | if ((inst->opcode->flags & F_N) | ||
305 | && extract_field (FLD_N, inst->value, 0) != value) | ||
306 | return 0; | ||
307 | @@ -2659,6 +2700,8 @@ do_special_decoding (aarch64_inst *inst) | ||
308 | idx = select_operand_for_sf_field_coding (inst->opcode); | ||
309 | value = extract_field (FLD_lse_sz, inst->value, 0); | ||
310 | inst->operands[idx].qualifier = get_greg_qualifier_from_value (value); | ||
311 | + if (inst->operands[idx].qualifier == AARCH64_OPND_QLF_ERR) | ||
312 | + return 0; | ||
313 | } | ||
314 | /* rcpc3 'size' field. */ | ||
315 | if (inst->opcode->flags & F_RCPC3_SIZE) | ||
316 | @@ -2670,12 +2713,18 @@ do_special_decoding (aarch64_inst *inst) | ||
317 | { | ||
318 | if (aarch64_operands[inst->operands[i].type].op_class | ||
319 | == AARCH64_OPND_CLASS_INT_REG) | ||
320 | - inst->operands[i].qualifier = get_greg_qualifier_from_value (value & 1); | ||
321 | + { | ||
322 | + inst->operands[i].qualifier = get_greg_qualifier_from_value (value & 1); | ||
323 | + if (inst->operands[i].qualifier == AARCH64_OPND_QLF_ERR) | ||
324 | + return 0; | ||
325 | + } | ||
326 | else if (aarch64_operands[inst->operands[i].type].op_class | ||
327 | == AARCH64_OPND_CLASS_FP_REG) | ||
328 | { | ||
329 | value += (extract_field (FLD_opc1, inst->value, 0) << 2); | ||
330 | inst->operands[i].qualifier = get_sreg_qualifier_from_value (value); | ||
331 | + if (inst->operands[i].qualifier == AARCH64_OPND_QLF_ERR) | ||
332 | + return 0; | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | @@ -2709,7 +2758,11 @@ do_special_decoding (aarch64_inst *inst) | ||
337 | /* For most related instruciton, the 'size' field is fully available for | ||
338 | operand encoding. */ | ||
339 | if (mask == 0x3) | ||
340 | - inst->operands[idx].qualifier = get_sreg_qualifier_from_value (value); | ||
341 | + { | ||
342 | + inst->operands[idx].qualifier = get_sreg_qualifier_from_value (value); | ||
343 | + if (inst->operands[idx].qualifier == AARCH64_OPND_QLF_ERR) | ||
344 | + return 0; | ||
345 | + } | ||
346 | else | ||
347 | { | ||
348 | get_operand_possible_qualifiers (idx, inst->opcode->qualifiers_list, | ||
349 | @@ -2744,6 +2797,9 @@ do_special_decoding (aarch64_inst *inst) | ||
350 | Q = (unsigned) extract_field (FLD_Q, inst->value, inst->opcode->mask); | ||
351 | inst->operands[0].qualifier = | ||
352 | get_vreg_qualifier_from_value ((num << 1) | Q); | ||
353 | + if (inst->operands[0].qualifier == AARCH64_OPND_QLF_ERR) | ||
354 | + return 0; | ||
355 | + | ||
356 | } | ||
357 | |||
358 | if ((inst->opcode->flags & F_OPD_SIZE) && inst->opcode->iclass == sve2_urqvs) | ||
359 | @@ -2753,7 +2809,11 @@ do_special_decoding (aarch64_inst *inst) | ||
360 | inst->opcode->mask); | ||
361 | inst->operands[0].qualifier | ||
362 | = get_vreg_qualifier_from_value (1 + (size << 1)); | ||
363 | + if (inst->operands[0].qualifier == AARCH64_OPND_QLF_ERR) | ||
364 | + return 0; | ||
365 | inst->operands[2].qualifier = get_sreg_qualifier_from_value (size); | ||
366 | + if (inst->operands[2].qualifier == AARCH64_OPND_QLF_ERR) | ||
367 | + return 0; | ||
368 | } | ||
369 | |||
370 | if (inst->opcode->flags & F_GPRSIZE_IN_Q) | ||
371 | @@ -2772,6 +2832,8 @@ do_special_decoding (aarch64_inst *inst) | ||
372 | assert (idx == 0 || idx == 1); | ||
373 | value = extract_field (FLD_Q, inst->value, 0); | ||
374 | inst->operands[idx].qualifier = get_greg_qualifier_from_value (value); | ||
375 | + if (inst->operands[idx].qualifier == AARCH64_OPND_QLF_ERR) | ||
376 | + return 0; | ||
377 | } | ||
378 | |||
379 | if (inst->opcode->flags & F_LDS_SIZE) | ||
380 | -- | ||
381 | 2.34.1 | ||
382 | |||
diff --git a/meta/recipes-devtools/expect/expect/0001-Resolve-string-formatting-issues.patch b/meta/recipes-devtools/expect/expect/0001-Resolve-string-formatting-issues.patch index af1d8c626c..bfb6dcd89a 100644 --- a/meta/recipes-devtools/expect/expect/0001-Resolve-string-formatting-issues.patch +++ b/meta/recipes-devtools/expect/expect/0001-Resolve-string-formatting-issues.patch | |||
@@ -3,7 +3,7 @@ From: Alexander Kanavin <alex.kanavin@gmail.com> | |||
3 | Date: Thu, 23 Mar 2017 13:44:41 +0200 | 3 | Date: Thu, 23 Mar 2017 13:44:41 +0200 |
4 | Subject: [PATCH] Resolve string formatting issues. | 4 | Subject: [PATCH] Resolve string formatting issues. |
5 | 5 | ||
6 | Upstream-Status: Inappropriate [upstream seems dead] | 6 | Upstream-Status: Inactive-Upstream [no activity since 2018; cvs server went read-only] |
7 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | 7 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
8 | --- | 8 | --- |
9 | exp_clib.c | 4 ++-- | 9 | exp_clib.c | 4 ++-- |
diff --git a/meta/recipes-devtools/expect/expect/0001-configure.in.patch b/meta/recipes-devtools/expect/expect/0001-configure.in.patch index 7595a254a8..618c4bee8e 100644 --- a/meta/recipes-devtools/expect/expect/0001-configure.in.patch +++ b/meta/recipes-devtools/expect/expect/0001-configure.in.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | Allow cross compiling. | 1 | Allow cross compiling. |
2 | 2 | ||
3 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> | 3 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> |
4 | Upstream-Status: Pending | 4 | Upstream-Status: Inactive-Upstream [no activity since 2018; cvs server went read-only] |
5 | --- | 5 | --- |
6 | diff -uNr a/configure.in b/configure.in | 6 | diff -uNr a/configure.in b/configure.in |
7 | --- a/configure.in 2012-12-14 15:31:32.623180450 +0100 | 7 | --- a/configure.in 2012-12-14 15:31:32.623180450 +0100 |
diff --git a/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch b/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch index 37512fb9bc..d73f4c3421 100644 --- a/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch +++ b/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch | |||
@@ -10,7 +10,7 @@ Aborted (core dumped) | |||
10 | 10 | ||
11 | Use PATH_MAX to fix the problem. | 11 | Use PATH_MAX to fix the problem. |
12 | 12 | ||
13 | Upstream-Status: Pending [Upstream seems dead] | 13 | Upstream-Status: Inactive-Upstream [no activity since 2018; cvs server went read-only] |
14 | 14 | ||
15 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | 15 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> |
16 | --- | 16 | --- |
diff --git a/meta/recipes-devtools/expect/expect/0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch b/meta/recipes-devtools/expect/expect/0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch index b1d322d5c9..40f7f3bd85 100644 --- a/meta/recipes-devtools/expect/expect/0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch +++ b/meta/recipes-devtools/expect/expect/0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch | |||
@@ -42,7 +42,7 @@ Example: | |||
42 | } | 42 | } |
43 | Author: Sergei Golovan <sgolovan@debian.org> | 43 | Author: Sergei Golovan <sgolovan@debian.org> |
44 | 44 | ||
45 | Upstream-Status: Pending | 45 | Upstream-Status: Inactive-Upstream [no activity since 2018; cvs server went read-only] |
46 | This patch is backported from fedora changes for expect: | 46 | This patch is backported from fedora changes for expect: |
47 | http://pkgs.fedoraproject.org/cgit/rpms/expect.git/commit/ | 47 | http://pkgs.fedoraproject.org/cgit/rpms/expect.git/commit/ |
48 | ?h=master&id=b6737eed550be93182f2ed194e836a6cbbcf4fa3 | 48 | ?h=master&id=b6737eed550be93182f2ed194e836a6cbbcf4fa3 |
diff --git a/meta/recipes-devtools/expect/expect/0002-tcl.m4.patch b/meta/recipes-devtools/expect/expect/0002-tcl.m4.patch index dc4c6ba406..eb178f462a 100644 --- a/meta/recipes-devtools/expect/expect/0002-tcl.m4.patch +++ b/meta/recipes-devtools/expect/expect/0002-tcl.m4.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | Use proper -L path when cross compiling. | 1 | Use proper -L path when cross compiling. |
2 | 2 | ||
3 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> | 3 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> |
4 | Upstream-Status: Pending | 4 | Upstream-Status: Inactive-Upstream [no activity since 2018; cvs server went read-only] |
5 | --- | 5 | --- |
6 | diff -uNr a/tclconfig/tcl.m4 b/tclconfig/tcl.m4 | 6 | diff -uNr a/tclconfig/tcl.m4 b/tclconfig/tcl.m4 |
7 | --- a/tclconfig/tcl.m4 2012-12-14 09:16:58.789861281 +0100 | 7 | --- a/tclconfig/tcl.m4 2012-12-14 09:16:58.789861281 +0100 |
diff --git a/meta/recipes-devtools/gcc/gcc-13.2.inc b/meta/recipes-devtools/gcc/gcc-13.3.inc index 603377a49a..90f5ef88a9 100644 --- a/meta/recipes-devtools/gcc/gcc-13.2.inc +++ b/meta/recipes-devtools/gcc/gcc-13.3.inc | |||
@@ -2,11 +2,11 @@ require gcc-common.inc | |||
2 | 2 | ||
3 | # Third digit in PV should be incremented after a minor release | 3 | # Third digit in PV should be incremented after a minor release |
4 | 4 | ||
5 | PV = "13.2.0" | 5 | PV = "13.3.0" |
6 | 6 | ||
7 | # BINV should be incremented to a revision after a minor gcc release | 7 | # BINV should be incremented to a revision after a minor gcc release |
8 | 8 | ||
9 | BINV = "13.2.0" | 9 | BINV = "13.3.0" |
10 | 10 | ||
11 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" | 11 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" |
12 | 12 | ||
@@ -65,11 +65,9 @@ SRC_URI = "${BASEURI} \ | |||
65 | file://0023-Fix-install-path-of-linux64.h.patch \ | 65 | file://0023-Fix-install-path-of-linux64.h.patch \ |
66 | file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \ | 66 | file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \ |
67 | file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ | 67 | file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ |
68 | file://CVE-2023-4039.patch \ | ||
69 | file://0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch \ | ||
70 | file://0027-Fix-gcc-vect-module-testcases.patch \ | 68 | file://0027-Fix-gcc-vect-module-testcases.patch \ |
71 | " | 69 | " |
72 | SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da" | 70 | SRC_URI[sha256sum] = "0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083" |
73 | 71 | ||
74 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}" | 72 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}" |
75 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" | 73 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" |
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_13.2.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_13.3.bb index bf53c5cd78..bf53c5cd78 100644 --- a/meta/recipes-devtools/gcc/gcc-cross-canadian_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc-cross_13.2.bb b/meta/recipes-devtools/gcc/gcc-cross_13.3.bb index b43cca0c52..b43cca0c52 100644 --- a/meta/recipes-devtools/gcc/gcc-cross_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-cross_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_13.2.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_13.3.bb index 40a6c4feff..40a6c4feff 100644 --- a/meta/recipes-devtools/gcc/gcc-crosssdk_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-crosssdk_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_13.2.bb b/meta/recipes-devtools/gcc/gcc-runtime_13.3.bb index dd430b57eb..dd430b57eb 100644 --- a/meta/recipes-devtools/gcc/gcc-runtime_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-runtime_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_13.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_13.3.bb index 8bda2ccad6..8bda2ccad6 100644 --- a/meta/recipes-devtools/gcc/gcc-sanitizers_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc-source_13.2.bb b/meta/recipes-devtools/gcc/gcc-source_13.3.bb index b890fa33ea..b890fa33ea 100644 --- a/meta/recipes-devtools/gcc/gcc-source_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc-source_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch index 079142c540..b0b77dbfa0 100644 --- a/meta/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch +++ b/meta/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch | |||
@@ -165,16 +165,21 @@ diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h | |||
165 | index aecaa02a199..62f88f7f9a2 100644 | 165 | index aecaa02a199..62f88f7f9a2 100644 |
166 | --- a/gcc/config/loongarch/gnu-user.h | 166 | --- a/gcc/config/loongarch/gnu-user.h |
167 | +++ b/gcc/config/loongarch/gnu-user.h | 167 | +++ b/gcc/config/loongarch/gnu-user.h |
168 | @@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see | 168 | @@ -31,16 +31,16 @@ along with GCC; see the file COPYING3. If not see |
169 | 169 | ||
170 | #undef GLIBC_DYNAMIC_LINKER | 170 | #undef GLIBC_DYNAMIC_LINKER |
171 | #define GLIBC_DYNAMIC_LINKER \ | 171 | #define GLIBC_DYNAMIC_LINKER \ |
172 | - "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1" | 172 | - "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1" |
173 | + SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1" | 173 | + SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1" |
174 | |||
175 | #define MUSL_ABI_SPEC \ | ||
176 | "%{mabi=lp64d:}" \ | ||
177 | "%{mabi=lp64f:-sp}" \ | ||
178 | "%{mabi=lp64s:-sf}" | ||
174 | 179 | ||
175 | #undef MUSL_DYNAMIC_LINKER | 180 | #undef MUSL_DYNAMIC_LINKER |
176 | #define MUSL_DYNAMIC_LINKER \ | 181 | #define MUSL_DYNAMIC_LINKER \ |
177 | - "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1" | 182 | - "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1" |
178 | + SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1" | 183 | + SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1" |
179 | 184 | ||
180 | #undef GNU_USER_TARGET_LINK_SPEC | 185 | #undef GNU_USER_TARGET_LINK_SPEC |
diff --git a/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch b/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch deleted file mode 100644 index a408a98698..0000000000 --- a/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | From adb60dc78e0da4877747f32347cee339364775be Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
3 | Date: Fri, 15 Sep 2023 09:19:14 +0100 | ||
4 | Subject: [PATCH] aarch64: Fix loose ldpstp check [PR111411] | ||
5 | |||
6 | aarch64_operands_ok_for_ldpstp contained the code: | ||
7 | |||
8 | /* One of the memory accesses must be a mempair operand. | ||
9 | If it is not the first one, they need to be swapped by the | ||
10 | peephole. */ | ||
11 | if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
12 | && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
13 | return false; | ||
14 | |||
15 | But the requirement isn't just that one of the accesses must be a | ||
16 | valid mempair operand. It's that the lower access must be, since | ||
17 | that's the access that will be used for the instruction operand. | ||
18 | |||
19 | gcc/ | ||
20 | PR target/111411 | ||
21 | * config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require | ||
22 | the lower memory access to a mem-pair operand. | ||
23 | |||
24 | gcc/testsuite/ | ||
25 | PR target/111411 | ||
26 | * gcc.dg/rtl/aarch64/pr111411.c: New test. | ||
27 | |||
28 | Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d38f45bcca62ca0c7afef4b579f82c5c2a01610] | ||
29 | Signed-off-by: Martin Jansa <martin.jansa@gmail.com> | ||
30 | --- | ||
31 | gcc/config/aarch64/aarch64.cc | 8 ++- | ||
32 | gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | 57 +++++++++++++++++++++ | ||
33 | 2 files changed, 60 insertions(+), 5 deletions(-) | ||
34 | create mode 100644 gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
35 | |||
36 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
37 | index 6118a3354ac..9b1f791ca8b 100644 | ||
38 | --- a/gcc/config/aarch64/aarch64.cc | ||
39 | +++ b/gcc/config/aarch64/aarch64.cc | ||
40 | @@ -26154,11 +26154,9 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load, | ||
41 | gcc_assert (known_eq (GET_MODE_SIZE (GET_MODE (mem_1)), | ||
42 | GET_MODE_SIZE (GET_MODE (mem_2)))); | ||
43 | |||
44 | - /* One of the memory accesses must be a mempair operand. | ||
45 | - If it is not the first one, they need to be swapped by the | ||
46 | - peephole. */ | ||
47 | - if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
48 | - && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
49 | + /* The lower memory access must be a mem-pair operand. */ | ||
50 | + rtx lower_mem = reversed ? mem_2 : mem_1; | ||
51 | + if (!aarch64_mem_pair_operand (lower_mem, GET_MODE (lower_mem))) | ||
52 | return false; | ||
53 | |||
54 | if (REG_P (reg_1) && FP_REGNUM_P (REGNO (reg_1))) | ||
55 | diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
56 | new file mode 100644 | ||
57 | index 00000000000..ad07e9c6c89 | ||
58 | --- /dev/null | ||
59 | +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
60 | @@ -0,0 +1,57 @@ | ||
61 | +/* { dg-do compile { target aarch64*-*-* } } */ | ||
62 | +/* { dg-require-effective-target lp64 } */ | ||
63 | +/* { dg-options "-O -fdisable-rtl-postreload -fpeephole2 -fno-schedule-fusion" } */ | ||
64 | + | ||
65 | +extern int data[]; | ||
66 | + | ||
67 | +void __RTL (startwith ("ira")) foo (void *ptr) | ||
68 | +{ | ||
69 | + (function "foo" | ||
70 | + (param "ptr" | ||
71 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
72 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
73 | + ) ;; param "ptr" | ||
74 | + (insn-chain | ||
75 | + (block 2 | ||
76 | + (edge-from entry (flags "FALLTHRU")) | ||
77 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
78 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
79 | + (insn 5 (set (reg:DI <1>) | ||
80 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
81 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <0>) | ||
82 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
83 | + (const_int 0))) | ||
84 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <1>) | ||
85 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
86 | + (const_int 0))) | ||
87 | + (edge-to exit (flags "FALLTHRU")) | ||
88 | + ) ;; block 2 | ||
89 | + ) ;; insn-chain | ||
90 | + ) ;; function | ||
91 | +} | ||
92 | + | ||
93 | +void __RTL (startwith ("ira")) bar (void *ptr) | ||
94 | +{ | ||
95 | + (function "bar" | ||
96 | + (param "ptr" | ||
97 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
98 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
99 | + ) ;; param "ptr" | ||
100 | + (insn-chain | ||
101 | + (block 2 | ||
102 | + (edge-from entry (flags "FALLTHRU")) | ||
103 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
104 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
105 | + (insn 5 (set (reg:DI <1>) | ||
106 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
107 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <1>) | ||
108 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
109 | + (const_int 0))) | ||
110 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <0>) | ||
111 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
112 | + (const_int 0))) | ||
113 | + (edge-to exit (flags "FALLTHRU")) | ||
114 | + ) ;; block 2 | ||
115 | + ) ;; insn-chain | ||
116 | + ) ;; function | ||
117 | +} | ||
diff --git a/meta/recipes-devtools/gcc/gcc/CVE-2023-4039.patch b/meta/recipes-devtools/gcc/gcc/CVE-2023-4039.patch deleted file mode 100644 index 81b5067c33..0000000000 --- a/meta/recipes-devtools/gcc/gcc/CVE-2023-4039.patch +++ /dev/null | |||
@@ -1,3093 +0,0 @@ | |||
1 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
2 | Subject: [PATCH 00/19] aarch64: Fix -fstack-protector issue | ||
3 | Date: Tue, 12 Sep 2023 16:25:10 +0100 | ||
4 | |||
5 | This series of patches fixes deficiencies in GCC's -fstack-protector | ||
6 | implementation for AArch64 when using dynamically allocated stack space. | ||
7 | This is CVE-2023-4039. See: | ||
8 | |||
9 | https://developer.arm.com/Arm%20Security%20Center/GCC%20Stack%20Protector%20Vulnerability%20AArch64 | ||
10 | https://github.com/metaredteam/external-disclosures/security/advisories/GHSA-x7ch-h5rf-w2mf | ||
11 | |||
12 | for more details. | ||
13 | |||
14 | The fix is to put the saved registers above the locals area when | ||
15 | -fstack-protector is used. | ||
16 | |||
17 | The series also fixes a stack-clash problem that I found while working | ||
18 | on the CVE. In unpatched sources, the stack-clash problem would only | ||
19 | trigger for unrealistic numbers of arguments (8K 64-bit arguments, or an | ||
20 | equivalent). But it would be a more significant issue with the new | ||
21 | -fstack-protector frame layout. It's therefore important that both | ||
22 | problems are fixed together. | ||
23 | |||
24 | Some reorganisation of the code seemed necessary to fix the problems in a | ||
25 | cleanish way. The series is therefore quite long, but only a handful of | ||
26 | patches should have any effect on code generation. | ||
27 | |||
28 | See the individual patches for a detailed description. | ||
29 | |||
30 | Tested on aarch64-linux-gnu. Pushed to trunk and to all active branches. | ||
31 | I've also pushed backports to GCC 7+ to vendors/ARM/heads/CVE-2023-4039. | ||
32 | |||
33 | CVE: CVE-2023-4039 | ||
34 | Upstream-Status: Backport | ||
35 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
36 | |||
37 | |||
38 | From 71a2aa2127283f450c623d3604dbcabe0e14a8d4 Mon Sep 17 00:00:00 2001 | ||
39 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
40 | Date: Tue, 12 Sep 2023 16:07:12 +0100 | ||
41 | Subject: [PATCH 01/19] aarch64: Use local frame vars in shrink-wrapping code | ||
42 | |||
43 | aarch64_layout_frame uses a shorthand for referring to | ||
44 | cfun->machine->frame: | ||
45 | |||
46 | aarch64_frame &frame = cfun->machine->frame; | ||
47 | |||
48 | This patch does the same for some other heavy users of the structure. | ||
49 | No functional change intended. | ||
50 | |||
51 | gcc/ | ||
52 | * config/aarch64/aarch64.cc (aarch64_save_callee_saves): Use | ||
53 | a local shorthand for cfun->machine->frame. | ||
54 | (aarch64_restore_callee_saves, aarch64_get_separate_components): | ||
55 | (aarch64_process_components): Likewise. | ||
56 | (aarch64_allocate_and_probe_stack_space): Likewise. | ||
57 | (aarch64_expand_prologue, aarch64_expand_epilogue): Likewise. | ||
58 | (aarch64_layout_frame): Use existing shorthand for one more case. | ||
59 | --- | ||
60 | gcc/config/aarch64/aarch64.cc | 123 ++++++++++++++++++---------------- | ||
61 | 1 file changed, 64 insertions(+), 59 deletions(-) | ||
62 | |||
63 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
64 | index 822a2b49a46..5d473d161d9 100644 | ||
65 | --- a/gcc/config/aarch64/aarch64.cc | ||
66 | +++ b/gcc/config/aarch64/aarch64.cc | ||
67 | @@ -8612,7 +8612,7 @@ aarch64_layout_frame (void) | ||
68 | frame.is_scs_enabled | ||
69 | = (!crtl->calls_eh_return | ||
70 | && sanitize_flags_p (SANITIZE_SHADOW_CALL_STACK) | ||
71 | - && known_ge (cfun->machine->frame.reg_offset[LR_REGNUM], 0)); | ||
72 | + && known_ge (frame.reg_offset[LR_REGNUM], 0)); | ||
73 | |||
74 | /* When shadow call stack is enabled, the scs_pop in the epilogue will | ||
75 | restore x30, and we don't need to pop x30 again in the traditional | ||
76 | @@ -9078,6 +9078,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
77 | unsigned start, unsigned limit, bool skip_wb, | ||
78 | bool hard_fp_valid_p) | ||
79 | { | ||
80 | + aarch64_frame &frame = cfun->machine->frame; | ||
81 | rtx_insn *insn; | ||
82 | unsigned regno; | ||
83 | unsigned regno2; | ||
84 | @@ -9092,8 +9093,8 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
85 | bool frame_related_p = aarch64_emit_cfi_for_reg_p (regno); | ||
86 | |||
87 | if (skip_wb | ||
88 | - && (regno == cfun->machine->frame.wb_push_candidate1 | ||
89 | - || regno == cfun->machine->frame.wb_push_candidate2)) | ||
90 | + && (regno == frame.wb_push_candidate1 | ||
91 | + || regno == frame.wb_push_candidate2)) | ||
92 | continue; | ||
93 | |||
94 | if (cfun->machine->reg_is_wrapped_separately[regno]) | ||
95 | @@ -9101,7 +9102,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
96 | |||
97 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
98 | reg = gen_rtx_REG (mode, regno); | ||
99 | - offset = start_offset + cfun->machine->frame.reg_offset[regno]; | ||
100 | + offset = start_offset + frame.reg_offset[regno]; | ||
101 | rtx base_rtx = stack_pointer_rtx; | ||
102 | poly_int64 sp_offset = offset; | ||
103 | |||
104 | @@ -9114,7 +9115,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
105 | { | ||
106 | gcc_assert (known_eq (start_offset, 0)); | ||
107 | poly_int64 fp_offset | ||
108 | - = cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
109 | + = frame.below_hard_fp_saved_regs_size; | ||
110 | if (hard_fp_valid_p) | ||
111 | base_rtx = hard_frame_pointer_rtx; | ||
112 | else | ||
113 | @@ -9136,8 +9137,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
114 | && (regno2 = aarch64_next_callee_save (regno + 1, limit)) <= limit | ||
115 | && !cfun->machine->reg_is_wrapped_separately[regno2] | ||
116 | && known_eq (GET_MODE_SIZE (mode), | ||
117 | - cfun->machine->frame.reg_offset[regno2] | ||
118 | - - cfun->machine->frame.reg_offset[regno])) | ||
119 | + frame.reg_offset[regno2] - frame.reg_offset[regno])) | ||
120 | { | ||
121 | rtx reg2 = gen_rtx_REG (mode, regno2); | ||
122 | rtx mem2; | ||
123 | @@ -9187,6 +9187,7 @@ static void | ||
124 | aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, | ||
125 | unsigned limit, bool skip_wb, rtx *cfi_ops) | ||
126 | { | ||
127 | + aarch64_frame &frame = cfun->machine->frame; | ||
128 | unsigned regno; | ||
129 | unsigned regno2; | ||
130 | poly_int64 offset; | ||
131 | @@ -9203,13 +9204,13 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, | ||
132 | rtx reg, mem; | ||
133 | |||
134 | if (skip_wb | ||
135 | - && (regno == cfun->machine->frame.wb_pop_candidate1 | ||
136 | - || regno == cfun->machine->frame.wb_pop_candidate2)) | ||
137 | + && (regno == frame.wb_pop_candidate1 | ||
138 | + || regno == frame.wb_pop_candidate2)) | ||
139 | continue; | ||
140 | |||
141 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
142 | reg = gen_rtx_REG (mode, regno); | ||
143 | - offset = start_offset + cfun->machine->frame.reg_offset[regno]; | ||
144 | + offset = start_offset + frame.reg_offset[regno]; | ||
145 | rtx base_rtx = stack_pointer_rtx; | ||
146 | if (mode == VNx2DImode && BYTES_BIG_ENDIAN) | ||
147 | aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, | ||
148 | @@ -9220,8 +9221,7 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, | ||
149 | && (regno2 = aarch64_next_callee_save (regno + 1, limit)) <= limit | ||
150 | && !cfun->machine->reg_is_wrapped_separately[regno2] | ||
151 | && known_eq (GET_MODE_SIZE (mode), | ||
152 | - cfun->machine->frame.reg_offset[regno2] | ||
153 | - - cfun->machine->frame.reg_offset[regno])) | ||
154 | + frame.reg_offset[regno2] - frame.reg_offset[regno])) | ||
155 | { | ||
156 | rtx reg2 = gen_rtx_REG (mode, regno2); | ||
157 | rtx mem2; | ||
158 | @@ -9326,6 +9326,7 @@ offset_12bit_unsigned_scaled_p (machine_mode mode, poly_int64 offset) | ||
159 | static sbitmap | ||
160 | aarch64_get_separate_components (void) | ||
161 | { | ||
162 | + aarch64_frame &frame = cfun->machine->frame; | ||
163 | sbitmap components = sbitmap_alloc (LAST_SAVED_REGNUM + 1); | ||
164 | bitmap_clear (components); | ||
165 | |||
166 | @@ -9342,18 +9343,18 @@ aarch64_get_separate_components (void) | ||
167 | if (mode == VNx2DImode && BYTES_BIG_ENDIAN) | ||
168 | continue; | ||
169 | |||
170 | - poly_int64 offset = cfun->machine->frame.reg_offset[regno]; | ||
171 | + poly_int64 offset = frame.reg_offset[regno]; | ||
172 | |||
173 | /* If the register is saved in the first SVE save slot, we use | ||
174 | it as a stack probe for -fstack-clash-protection. */ | ||
175 | if (flag_stack_clash_protection | ||
176 | - && maybe_ne (cfun->machine->frame.below_hard_fp_saved_regs_size, 0) | ||
177 | + && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) | ||
178 | && known_eq (offset, 0)) | ||
179 | continue; | ||
180 | |||
181 | /* Get the offset relative to the register we'll use. */ | ||
182 | if (frame_pointer_needed) | ||
183 | - offset -= cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
184 | + offset -= frame.below_hard_fp_saved_regs_size; | ||
185 | else | ||
186 | offset += crtl->outgoing_args_size; | ||
187 | |||
188 | @@ -9372,11 +9373,11 @@ aarch64_get_separate_components (void) | ||
189 | /* If the spare predicate register used by big-endian SVE code | ||
190 | is call-preserved, it must be saved in the main prologue | ||
191 | before any saves that use it. */ | ||
192 | - if (cfun->machine->frame.spare_pred_reg != INVALID_REGNUM) | ||
193 | - bitmap_clear_bit (components, cfun->machine->frame.spare_pred_reg); | ||
194 | + if (frame.spare_pred_reg != INVALID_REGNUM) | ||
195 | + bitmap_clear_bit (components, frame.spare_pred_reg); | ||
196 | |||
197 | - unsigned reg1 = cfun->machine->frame.wb_push_candidate1; | ||
198 | - unsigned reg2 = cfun->machine->frame.wb_push_candidate2; | ||
199 | + unsigned reg1 = frame.wb_push_candidate1; | ||
200 | + unsigned reg2 = frame.wb_push_candidate2; | ||
201 | /* If registers have been chosen to be stored/restored with | ||
202 | writeback don't interfere with them to avoid having to output explicit | ||
203 | stack adjustment instructions. */ | ||
204 | @@ -9485,6 +9486,7 @@ aarch64_get_next_set_bit (sbitmap bmp, unsigned int start) | ||
205 | static void | ||
206 | aarch64_process_components (sbitmap components, bool prologue_p) | ||
207 | { | ||
208 | + aarch64_frame &frame = cfun->machine->frame; | ||
209 | rtx ptr_reg = gen_rtx_REG (Pmode, frame_pointer_needed | ||
210 | ? HARD_FRAME_POINTER_REGNUM | ||
211 | : STACK_POINTER_REGNUM); | ||
212 | @@ -9499,9 +9501,9 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
213 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
214 | |||
215 | rtx reg = gen_rtx_REG (mode, regno); | ||
216 | - poly_int64 offset = cfun->machine->frame.reg_offset[regno]; | ||
217 | + poly_int64 offset = frame.reg_offset[regno]; | ||
218 | if (frame_pointer_needed) | ||
219 | - offset -= cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
220 | + offset -= frame.below_hard_fp_saved_regs_size; | ||
221 | else | ||
222 | offset += crtl->outgoing_args_size; | ||
223 | |||
224 | @@ -9526,14 +9528,14 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | - poly_int64 offset2 = cfun->machine->frame.reg_offset[regno2]; | ||
229 | + poly_int64 offset2 = frame.reg_offset[regno2]; | ||
230 | /* The next register is not of the same class or its offset is not | ||
231 | mergeable with the current one into a pair. */ | ||
232 | if (aarch64_sve_mode_p (mode) | ||
233 | || !satisfies_constraint_Ump (mem) | ||
234 | || GP_REGNUM_P (regno) != GP_REGNUM_P (regno2) | ||
235 | || (crtl->abi->id () == ARM_PCS_SIMD && FP_REGNUM_P (regno)) | ||
236 | - || maybe_ne ((offset2 - cfun->machine->frame.reg_offset[regno]), | ||
237 | + || maybe_ne ((offset2 - frame.reg_offset[regno]), | ||
238 | GET_MODE_SIZE (mode))) | ||
239 | { | ||
240 | insn = emit_insn (set); | ||
241 | @@ -9555,7 +9557,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
242 | /* REGNO2 can be saved/restored in a pair with REGNO. */ | ||
243 | rtx reg2 = gen_rtx_REG (mode, regno2); | ||
244 | if (frame_pointer_needed) | ||
245 | - offset2 -= cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
246 | + offset2 -= frame.below_hard_fp_saved_regs_size; | ||
247 | else | ||
248 | offset2 += crtl->outgoing_args_size; | ||
249 | rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); | ||
250 | @@ -9650,6 +9652,7 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
251 | bool frame_related_p, | ||
252 | bool final_adjustment_p) | ||
253 | { | ||
254 | + aarch64_frame &frame = cfun->machine->frame; | ||
255 | HOST_WIDE_INT guard_size | ||
256 | = 1 << param_stack_clash_protection_guard_size; | ||
257 | HOST_WIDE_INT guard_used_by_caller = STACK_CLASH_CALLER_GUARD; | ||
258 | @@ -9670,25 +9673,25 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
259 | register as a probe. We can't assume that LR was saved at position 0 | ||
260 | though, so treat any space below it as unprobed. */ | ||
261 | if (final_adjustment_p | ||
262 | - && known_eq (cfun->machine->frame.below_hard_fp_saved_regs_size, 0)) | ||
263 | + && known_eq (frame.below_hard_fp_saved_regs_size, 0)) | ||
264 | { | ||
265 | - poly_int64 lr_offset = cfun->machine->frame.reg_offset[LR_REGNUM]; | ||
266 | + poly_int64 lr_offset = frame.reg_offset[LR_REGNUM]; | ||
267 | if (known_ge (lr_offset, 0)) | ||
268 | min_probe_threshold -= lr_offset.to_constant (); | ||
269 | else | ||
270 | gcc_assert (!flag_stack_clash_protection || known_eq (poly_size, 0)); | ||
271 | } | ||
272 | |||
273 | - poly_int64 frame_size = cfun->machine->frame.frame_size; | ||
274 | + poly_int64 frame_size = frame.frame_size; | ||
275 | |||
276 | /* We should always have a positive probe threshold. */ | ||
277 | gcc_assert (min_probe_threshold > 0); | ||
278 | |||
279 | if (flag_stack_clash_protection && !final_adjustment_p) | ||
280 | { | ||
281 | - poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; | ||
282 | - poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; | ||
283 | - poly_int64 final_adjust = cfun->machine->frame.final_adjust; | ||
284 | + poly_int64 initial_adjust = frame.initial_adjust; | ||
285 | + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
286 | + poly_int64 final_adjust = frame.final_adjust; | ||
287 | |||
288 | if (known_eq (frame_size, 0)) | ||
289 | { | ||
290 | @@ -9977,17 +9980,18 @@ aarch64_epilogue_uses (int regno) | ||
291 | void | ||
292 | aarch64_expand_prologue (void) | ||
293 | { | ||
294 | - poly_int64 frame_size = cfun->machine->frame.frame_size; | ||
295 | - poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; | ||
296 | - HOST_WIDE_INT callee_adjust = cfun->machine->frame.callee_adjust; | ||
297 | - poly_int64 final_adjust = cfun->machine->frame.final_adjust; | ||
298 | - poly_int64 callee_offset = cfun->machine->frame.callee_offset; | ||
299 | - poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; | ||
300 | + aarch64_frame &frame = cfun->machine->frame; | ||
301 | + poly_int64 frame_size = frame.frame_size; | ||
302 | + poly_int64 initial_adjust = frame.initial_adjust; | ||
303 | + HOST_WIDE_INT callee_adjust = frame.callee_adjust; | ||
304 | + poly_int64 final_adjust = frame.final_adjust; | ||
305 | + poly_int64 callee_offset = frame.callee_offset; | ||
306 | + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
307 | poly_int64 below_hard_fp_saved_regs_size | ||
308 | - = cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
309 | - unsigned reg1 = cfun->machine->frame.wb_push_candidate1; | ||
310 | - unsigned reg2 = cfun->machine->frame.wb_push_candidate2; | ||
311 | - bool emit_frame_chain = cfun->machine->frame.emit_frame_chain; | ||
312 | + = frame.below_hard_fp_saved_regs_size; | ||
313 | + unsigned reg1 = frame.wb_push_candidate1; | ||
314 | + unsigned reg2 = frame.wb_push_candidate2; | ||
315 | + bool emit_frame_chain = frame.emit_frame_chain; | ||
316 | rtx_insn *insn; | ||
317 | |||
318 | if (flag_stack_clash_protection && known_eq (callee_adjust, 0)) | ||
319 | @@ -10018,7 +10022,7 @@ aarch64_expand_prologue (void) | ||
320 | } | ||
321 | |||
322 | /* Push return address to shadow call stack. */ | ||
323 | - if (cfun->machine->frame.is_scs_enabled) | ||
324 | + if (frame.is_scs_enabled) | ||
325 | emit_insn (gen_scs_push ()); | ||
326 | |||
327 | if (flag_stack_usage_info) | ||
328 | @@ -10057,7 +10061,7 @@ aarch64_expand_prologue (void) | ||
329 | |||
330 | /* The offset of the frame chain record (if any) from the current SP. */ | ||
331 | poly_int64 chain_offset = (initial_adjust + callee_adjust | ||
332 | - - cfun->machine->frame.hard_fp_offset); | ||
333 | + - frame.hard_fp_offset); | ||
334 | gcc_assert (known_ge (chain_offset, 0)); | ||
335 | |||
336 | /* The offset of the bottom of the save area from the current SP. */ | ||
337 | @@ -10160,16 +10164,17 @@ aarch64_use_return_insn_p (void) | ||
338 | void | ||
339 | aarch64_expand_epilogue (bool for_sibcall) | ||
340 | { | ||
341 | - poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; | ||
342 | - HOST_WIDE_INT callee_adjust = cfun->machine->frame.callee_adjust; | ||
343 | - poly_int64 final_adjust = cfun->machine->frame.final_adjust; | ||
344 | - poly_int64 callee_offset = cfun->machine->frame.callee_offset; | ||
345 | - poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; | ||
346 | + aarch64_frame &frame = cfun->machine->frame; | ||
347 | + poly_int64 initial_adjust = frame.initial_adjust; | ||
348 | + HOST_WIDE_INT callee_adjust = frame.callee_adjust; | ||
349 | + poly_int64 final_adjust = frame.final_adjust; | ||
350 | + poly_int64 callee_offset = frame.callee_offset; | ||
351 | + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
352 | poly_int64 below_hard_fp_saved_regs_size | ||
353 | - = cfun->machine->frame.below_hard_fp_saved_regs_size; | ||
354 | - unsigned reg1 = cfun->machine->frame.wb_pop_candidate1; | ||
355 | - unsigned reg2 = cfun->machine->frame.wb_pop_candidate2; | ||
356 | - unsigned int last_gpr = (cfun->machine->frame.is_scs_enabled | ||
357 | + = frame.below_hard_fp_saved_regs_size; | ||
358 | + unsigned reg1 = frame.wb_pop_candidate1; | ||
359 | + unsigned reg2 = frame.wb_pop_candidate2; | ||
360 | + unsigned int last_gpr = (frame.is_scs_enabled | ||
361 | ? R29_REGNUM : R30_REGNUM); | ||
362 | rtx cfi_ops = NULL; | ||
363 | rtx_insn *insn; | ||
364 | @@ -10203,7 +10208,7 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
365 | /* We need to add memory barrier to prevent read from deallocated stack. */ | ||
366 | bool need_barrier_p | ||
367 | = maybe_ne (get_frame_size () | ||
368 | - + cfun->machine->frame.saved_varargs_size, 0); | ||
369 | + + frame.saved_varargs_size, 0); | ||
370 | |||
371 | /* Emit a barrier to prevent loads from a deallocated stack. */ | ||
372 | if (maybe_gt (final_adjust, crtl->outgoing_args_size) | ||
373 | @@ -10284,7 +10289,7 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
374 | } | ||
375 | |||
376 | /* Pop return address from shadow call stack. */ | ||
377 | - if (cfun->machine->frame.is_scs_enabled) | ||
378 | + if (frame.is_scs_enabled) | ||
379 | { | ||
380 | machine_mode mode = aarch64_reg_save_mode (R30_REGNUM); | ||
381 | rtx reg = gen_rtx_REG (mode, R30_REGNUM); | ||
382 | @@ -12740,24 +12745,24 @@ aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) | ||
383 | poly_int64 | ||
384 | aarch64_initial_elimination_offset (unsigned from, unsigned to) | ||
385 | { | ||
386 | + aarch64_frame &frame = cfun->machine->frame; | ||
387 | + | ||
388 | if (to == HARD_FRAME_POINTER_REGNUM) | ||
389 | { | ||
390 | if (from == ARG_POINTER_REGNUM) | ||
391 | - return cfun->machine->frame.hard_fp_offset; | ||
392 | + return frame.hard_fp_offset; | ||
393 | |||
394 | if (from == FRAME_POINTER_REGNUM) | ||
395 | - return cfun->machine->frame.hard_fp_offset | ||
396 | - - cfun->machine->frame.locals_offset; | ||
397 | + return frame.hard_fp_offset - frame.locals_offset; | ||
398 | } | ||
399 | |||
400 | if (to == STACK_POINTER_REGNUM) | ||
401 | { | ||
402 | if (from == FRAME_POINTER_REGNUM) | ||
403 | - return cfun->machine->frame.frame_size | ||
404 | - - cfun->machine->frame.locals_offset; | ||
405 | + return frame.frame_size - frame.locals_offset; | ||
406 | } | ||
407 | |||
408 | - return cfun->machine->frame.frame_size; | ||
409 | + return frame.frame_size; | ||
410 | } | ||
411 | |||
412 | |||
413 | -- | ||
414 | 2.34.1 | ||
415 | |||
416 | |||
417 | From 89a9fa287706c5011f61926eaf65e7b996b963a3 Mon Sep 17 00:00:00 2001 | ||
418 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
419 | Date: Tue, 12 Sep 2023 16:07:12 +0100 | ||
420 | Subject: [PATCH 02/19] aarch64: Avoid a use of callee_offset | ||
421 | |||
422 | When we emit the frame chain, i.e. when we reach Here in this statement | ||
423 | of aarch64_expand_prologue: | ||
424 | |||
425 | if (emit_frame_chain) | ||
426 | { | ||
427 | // Here | ||
428 | ... | ||
429 | } | ||
430 | |||
431 | the stack is in one of two states: | ||
432 | |||
433 | - We've allocated up to the frame chain, but no more. | ||
434 | |||
435 | - We've allocated the whole frame, and the frame chain is within easy | ||
436 | reach of the new SP. | ||
437 | |||
438 | The offset of the frame chain from the current SP is available | ||
439 | in aarch64_frame as callee_offset. It is also available as the | ||
440 | chain_offset local variable, where the latter is calculated from other | ||
441 | data. (However, chain_offset is not always equal to callee_offset when | ||
442 | !emit_frame_chain, so chain_offset isn't redundant.) | ||
443 | |||
444 | In c600df9a4060da3c6121ff4d0b93f179eafd69d1 I switched to using | ||
445 | chain_offset for the initialisation of the hard frame pointer: | ||
446 | |||
447 | aarch64_add_offset (Pmode, hard_frame_pointer_rtx, | ||
448 | - stack_pointer_rtx, callee_offset, | ||
449 | + stack_pointer_rtx, chain_offset, | ||
450 | tmp1_rtx, tmp0_rtx, frame_pointer_needed); | ||
451 | |||
452 | But the later REG_CFA_ADJUST_CFA handling still used callee_offset. | ||
453 | |||
454 | I think the difference is harmless, but it's more logical for the | ||
455 | CFA note to be in sync, and it's more convenient for later patches | ||
456 | if it uses chain_offset. | ||
457 | |||
458 | gcc/ | ||
459 | * config/aarch64/aarch64.cc (aarch64_expand_prologue): Use | ||
460 | chain_offset rather than callee_offset. | ||
461 | --- | ||
462 | gcc/config/aarch64/aarch64.cc | 4 +--- | ||
463 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
464 | |||
465 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
466 | index 5d473d161d9..4f233c95140 100644 | ||
467 | --- a/gcc/config/aarch64/aarch64.cc | ||
468 | +++ b/gcc/config/aarch64/aarch64.cc | ||
469 | @@ -9985,7 +9985,6 @@ aarch64_expand_prologue (void) | ||
470 | poly_int64 initial_adjust = frame.initial_adjust; | ||
471 | HOST_WIDE_INT callee_adjust = frame.callee_adjust; | ||
472 | poly_int64 final_adjust = frame.final_adjust; | ||
473 | - poly_int64 callee_offset = frame.callee_offset; | ||
474 | poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
475 | poly_int64 below_hard_fp_saved_regs_size | ||
476 | = frame.below_hard_fp_saved_regs_size; | ||
477 | @@ -10098,8 +10097,7 @@ aarch64_expand_prologue (void) | ||
478 | implicit. */ | ||
479 | if (!find_reg_note (insn, REG_CFA_ADJUST_CFA, NULL_RTX)) | ||
480 | { | ||
481 | - rtx src = plus_constant (Pmode, stack_pointer_rtx, | ||
482 | - callee_offset); | ||
483 | + rtx src = plus_constant (Pmode, stack_pointer_rtx, chain_offset); | ||
484 | add_reg_note (insn, REG_CFA_ADJUST_CFA, | ||
485 | gen_rtx_SET (hard_frame_pointer_rtx, src)); | ||
486 | } | ||
487 | -- | ||
488 | 2.34.1 | ||
489 | |||
490 | |||
491 | From b36a2a78040722dab6124366c5d6baf8eaf80aef Mon Sep 17 00:00:00 2001 | ||
492 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
493 | Date: Tue, 12 Sep 2023 16:07:13 +0100 | ||
494 | Subject: [PATCH 03/19] aarch64: Explicitly handle frames with no saved | ||
495 | registers | ||
496 | |||
497 | If a frame has no saved registers, it can be allocated in one go. | ||
498 | There is no need to treat the areas below and above the saved | ||
499 | registers as separate. | ||
500 | |||
501 | And if we allocate the frame in one go, it should be allocated | ||
502 | as the initial_adjust rather than the final_adjust. This allows the | ||
503 | frame size to grow to guard_size - guard_used_by_caller before a stack | ||
504 | probe is needed. (A frame with no register saves is necessarily a | ||
505 | leaf frame.) | ||
506 | |||
507 | This is a no-op as thing stand, since a leaf function will have | ||
508 | no outgoing arguments, and so all the frame will be above where | ||
509 | the saved registers normally go. | ||
510 | |||
511 | gcc/ | ||
512 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Explicitly | ||
513 | allocate the frame in one go if there are no saved registers. | ||
514 | --- | ||
515 | gcc/config/aarch64/aarch64.cc | 8 +++++--- | ||
516 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
517 | |||
518 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
519 | index 4f233c95140..37643041ffb 100644 | ||
520 | --- a/gcc/config/aarch64/aarch64.cc | ||
521 | +++ b/gcc/config/aarch64/aarch64.cc | ||
522 | @@ -8639,9 +8639,11 @@ aarch64_layout_frame (void) | ||
523 | |||
524 | HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset; | ||
525 | HOST_WIDE_INT const_saved_regs_size; | ||
526 | - if (frame.frame_size.is_constant (&const_size) | ||
527 | - && const_size < max_push_offset | ||
528 | - && known_eq (frame.hard_fp_offset, const_size)) | ||
529 | + if (known_eq (frame.saved_regs_size, 0)) | ||
530 | + frame.initial_adjust = frame.frame_size; | ||
531 | + else if (frame.frame_size.is_constant (&const_size) | ||
532 | + && const_size < max_push_offset | ||
533 | + && known_eq (frame.hard_fp_offset, const_size)) | ||
534 | { | ||
535 | /* Simple, small frame with no outgoing arguments: | ||
536 | |||
537 | -- | ||
538 | 2.34.1 | ||
539 | |||
540 | |||
541 | From ada2ab0093596be707f23a3466ac82cff59fcffe Mon Sep 17 00:00:00 2001 | ||
542 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
543 | Date: Tue, 12 Sep 2023 16:07:13 +0100 | ||
544 | Subject: [PATCH 04/19] aarch64: Add bytes_below_saved_regs to frame info | ||
545 | |||
546 | The frame layout code currently hard-codes the assumption that | ||
547 | the number of bytes below the saved registers is equal to the | ||
548 | size of the outgoing arguments. This patch abstracts that | ||
549 | value into a new field of aarch64_frame. | ||
550 | |||
551 | gcc/ | ||
552 | * config/aarch64/aarch64.h (aarch64_frame::bytes_below_saved_regs): New | ||
553 | field. | ||
554 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize it, | ||
555 | and use it instead of crtl->outgoing_args_size. | ||
556 | (aarch64_get_separate_components): Use bytes_below_saved_regs instead | ||
557 | of outgoing_args_size. | ||
558 | (aarch64_process_components): Likewise. | ||
559 | --- | ||
560 | gcc/config/aarch64/aarch64.cc | 71 ++++++++++++++++++----------------- | ||
561 | gcc/config/aarch64/aarch64.h | 5 +++ | ||
562 | 2 files changed, 41 insertions(+), 35 deletions(-) | ||
563 | |||
564 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
565 | index 37643041ffb..dacc2b0e4dd 100644 | ||
566 | --- a/gcc/config/aarch64/aarch64.cc | ||
567 | +++ b/gcc/config/aarch64/aarch64.cc | ||
568 | @@ -8478,6 +8478,8 @@ aarch64_layout_frame (void) | ||
569 | gcc_assert (crtl->is_leaf | ||
570 | || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); | ||
571 | |||
572 | + frame.bytes_below_saved_regs = crtl->outgoing_args_size; | ||
573 | + | ||
574 | /* Now assign stack slots for the registers. Start with the predicate | ||
575 | registers, since predicate LDR and STR have a relatively small | ||
576 | offset range. These saves happen below the hard frame pointer. */ | ||
577 | @@ -8582,18 +8584,18 @@ aarch64_layout_frame (void) | ||
578 | |||
579 | poly_int64 varargs_and_saved_regs_size = offset + frame.saved_varargs_size; | ||
580 | |||
581 | - poly_int64 above_outgoing_args | ||
582 | + poly_int64 saved_regs_and_above | ||
583 | = aligned_upper_bound (varargs_and_saved_regs_size | ||
584 | + get_frame_size (), | ||
585 | STACK_BOUNDARY / BITS_PER_UNIT); | ||
586 | |||
587 | frame.hard_fp_offset | ||
588 | - = above_outgoing_args - frame.below_hard_fp_saved_regs_size; | ||
589 | + = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; | ||
590 | |||
591 | /* Both these values are already aligned. */ | ||
592 | - gcc_assert (multiple_p (crtl->outgoing_args_size, | ||
593 | + gcc_assert (multiple_p (frame.bytes_below_saved_regs, | ||
594 | STACK_BOUNDARY / BITS_PER_UNIT)); | ||
595 | - frame.frame_size = above_outgoing_args + crtl->outgoing_args_size; | ||
596 | + frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; | ||
597 | |||
598 | frame.locals_offset = frame.saved_varargs_size; | ||
599 | |||
600 | @@ -8637,7 +8639,7 @@ aarch64_layout_frame (void) | ||
601 | else if (frame.wb_pop_candidate1 != INVALID_REGNUM) | ||
602 | max_push_offset = 256; | ||
603 | |||
604 | - HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset; | ||
605 | + HOST_WIDE_INT const_size, const_below_saved_regs, const_fp_offset; | ||
606 | HOST_WIDE_INT const_saved_regs_size; | ||
607 | if (known_eq (frame.saved_regs_size, 0)) | ||
608 | frame.initial_adjust = frame.frame_size; | ||
609 | @@ -8645,31 +8647,31 @@ aarch64_layout_frame (void) | ||
610 | && const_size < max_push_offset | ||
611 | && known_eq (frame.hard_fp_offset, const_size)) | ||
612 | { | ||
613 | - /* Simple, small frame with no outgoing arguments: | ||
614 | + /* Simple, small frame with no data below the saved registers. | ||
615 | |||
616 | stp reg1, reg2, [sp, -frame_size]! | ||
617 | stp reg3, reg4, [sp, 16] */ | ||
618 | frame.callee_adjust = const_size; | ||
619 | } | ||
620 | - else if (crtl->outgoing_args_size.is_constant (&const_outgoing_args_size) | ||
621 | + else if (frame.bytes_below_saved_regs.is_constant (&const_below_saved_regs) | ||
622 | && frame.saved_regs_size.is_constant (&const_saved_regs_size) | ||
623 | - && const_outgoing_args_size + const_saved_regs_size < 512 | ||
624 | - /* We could handle this case even with outgoing args, provided | ||
625 | - that the number of args left us with valid offsets for all | ||
626 | - predicate and vector save slots. It's such a rare case that | ||
627 | - it hardly seems worth the effort though. */ | ||
628 | - && (!saves_below_hard_fp_p || const_outgoing_args_size == 0) | ||
629 | + && const_below_saved_regs + const_saved_regs_size < 512 | ||
630 | + /* We could handle this case even with data below the saved | ||
631 | + registers, provided that that data left us with valid offsets | ||
632 | + for all predicate and vector save slots. It's such a rare | ||
633 | + case that it hardly seems worth the effort though. */ | ||
634 | + && (!saves_below_hard_fp_p || const_below_saved_regs == 0) | ||
635 | && !(cfun->calls_alloca | ||
636 | && frame.hard_fp_offset.is_constant (&const_fp_offset) | ||
637 | && const_fp_offset < max_push_offset)) | ||
638 | { | ||
639 | - /* Frame with small outgoing arguments: | ||
640 | + /* Frame with small area below the saved registers: | ||
641 | |||
642 | sub sp, sp, frame_size | ||
643 | - stp reg1, reg2, [sp, outgoing_args_size] | ||
644 | - stp reg3, reg4, [sp, outgoing_args_size + 16] */ | ||
645 | + stp reg1, reg2, [sp, bytes_below_saved_regs] | ||
646 | + stp reg3, reg4, [sp, bytes_below_saved_regs + 16] */ | ||
647 | frame.initial_adjust = frame.frame_size; | ||
648 | - frame.callee_offset = const_outgoing_args_size; | ||
649 | + frame.callee_offset = const_below_saved_regs; | ||
650 | } | ||
651 | else if (saves_below_hard_fp_p | ||
652 | && known_eq (frame.saved_regs_size, | ||
653 | @@ -8679,30 +8681,29 @@ aarch64_layout_frame (void) | ||
654 | |||
655 | sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size | ||
656 | save SVE registers relative to SP | ||
657 | - sub sp, sp, outgoing_args_size */ | ||
658 | + sub sp, sp, bytes_below_saved_regs */ | ||
659 | frame.initial_adjust = (frame.hard_fp_offset | ||
660 | + frame.below_hard_fp_saved_regs_size); | ||
661 | - frame.final_adjust = crtl->outgoing_args_size; | ||
662 | + frame.final_adjust = frame.bytes_below_saved_regs; | ||
663 | } | ||
664 | else if (frame.hard_fp_offset.is_constant (&const_fp_offset) | ||
665 | && const_fp_offset < max_push_offset) | ||
666 | { | ||
667 | - /* Frame with large outgoing arguments or SVE saves, but with | ||
668 | - a small local area: | ||
669 | + /* Frame with large area below the saved registers, or with SVE saves, | ||
670 | + but with a small area above: | ||
671 | |||
672 | stp reg1, reg2, [sp, -hard_fp_offset]! | ||
673 | stp reg3, reg4, [sp, 16] | ||
674 | [sub sp, sp, below_hard_fp_saved_regs_size] | ||
675 | [save SVE registers relative to SP] | ||
676 | - sub sp, sp, outgoing_args_size */ | ||
677 | + sub sp, sp, bytes_below_saved_regs */ | ||
678 | frame.callee_adjust = const_fp_offset; | ||
679 | frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
680 | - frame.final_adjust = crtl->outgoing_args_size; | ||
681 | + frame.final_adjust = frame.bytes_below_saved_regs; | ||
682 | } | ||
683 | else | ||
684 | { | ||
685 | - /* Frame with large local area and outgoing arguments or SVE saves, | ||
686 | - using frame pointer: | ||
687 | + /* General case: | ||
688 | |||
689 | sub sp, sp, hard_fp_offset | ||
690 | stp x29, x30, [sp, 0] | ||
691 | @@ -8710,10 +8711,10 @@ aarch64_layout_frame (void) | ||
692 | stp reg3, reg4, [sp, 16] | ||
693 | [sub sp, sp, below_hard_fp_saved_regs_size] | ||
694 | [save SVE registers relative to SP] | ||
695 | - sub sp, sp, outgoing_args_size */ | ||
696 | + sub sp, sp, bytes_below_saved_regs */ | ||
697 | frame.initial_adjust = frame.hard_fp_offset; | ||
698 | frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
699 | - frame.final_adjust = crtl->outgoing_args_size; | ||
700 | + frame.final_adjust = frame.bytes_below_saved_regs; | ||
701 | } | ||
702 | |||
703 | /* Make sure the individual adjustments add up to the full frame size. */ | ||
704 | @@ -9358,7 +9359,7 @@ aarch64_get_separate_components (void) | ||
705 | if (frame_pointer_needed) | ||
706 | offset -= frame.below_hard_fp_saved_regs_size; | ||
707 | else | ||
708 | - offset += crtl->outgoing_args_size; | ||
709 | + offset += frame.bytes_below_saved_regs; | ||
710 | |||
711 | /* Check that we can access the stack slot of the register with one | ||
712 | direct load with no adjustments needed. */ | ||
713 | @@ -9507,7 +9508,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
714 | if (frame_pointer_needed) | ||
715 | offset -= frame.below_hard_fp_saved_regs_size; | ||
716 | else | ||
717 | - offset += crtl->outgoing_args_size; | ||
718 | + offset += frame.bytes_below_saved_regs; | ||
719 | |||
720 | rtx addr = plus_constant (Pmode, ptr_reg, offset); | ||
721 | rtx mem = gen_frame_mem (mode, addr); | ||
722 | @@ -9561,7 +9562,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
723 | if (frame_pointer_needed) | ||
724 | offset2 -= frame.below_hard_fp_saved_regs_size; | ||
725 | else | ||
726 | - offset2 += crtl->outgoing_args_size; | ||
727 | + offset2 += frame.bytes_below_saved_regs; | ||
728 | rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); | ||
729 | rtx mem2 = gen_frame_mem (mode, addr2); | ||
730 | rtx set2 = prologue_p ? gen_rtx_SET (mem2, reg2) | ||
731 | @@ -9635,10 +9636,10 @@ aarch64_stack_clash_protection_alloca_probe_range (void) | ||
732 | registers. If POLY_SIZE is not large enough to require a probe this function | ||
733 | will only adjust the stack. When allocating the stack space | ||
734 | FRAME_RELATED_P is then used to indicate if the allocation is frame related. | ||
735 | - FINAL_ADJUSTMENT_P indicates whether we are allocating the outgoing | ||
736 | - arguments. If we are then we ensure that any allocation larger than the ABI | ||
737 | - defined buffer needs a probe so that the invariant of having a 1KB buffer is | ||
738 | - maintained. | ||
739 | + FINAL_ADJUSTMENT_P indicates whether we are allocating the area below | ||
740 | + the saved registers. If we are then we ensure that any allocation | ||
741 | + larger than the ABI defined buffer needs a probe so that the | ||
742 | + invariant of having a 1KB buffer is maintained. | ||
743 | |||
744 | We emit barriers after each stack adjustment to prevent optimizations from | ||
745 | breaking the invariant that we never drop the stack more than a page. This | ||
746 | @@ -9847,7 +9848,7 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
747 | /* Handle any residuals. Residuals of at least MIN_PROBE_THRESHOLD have to | ||
748 | be probed. This maintains the requirement that each page is probed at | ||
749 | least once. For initial probing we probe only if the allocation is | ||
750 | - more than GUARD_SIZE - buffer, and for the outgoing arguments we probe | ||
751 | + more than GUARD_SIZE - buffer, and below the saved registers we probe | ||
752 | if the amount is larger than buffer. GUARD_SIZE - buffer + buffer == | ||
753 | GUARD_SIZE. This works that for any allocation that is large enough to | ||
754 | trigger a probe here, we'll have at least one, and if they're not large | ||
755 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
756 | index 73b09e20508..0b6faa3ddf1 100644 | ||
757 | --- a/gcc/config/aarch64/aarch64.h | ||
758 | +++ b/gcc/config/aarch64/aarch64.h | ||
759 | @@ -777,6 +777,11 @@ struct GTY (()) aarch64_frame | ||
760 | /* The size of the callee-save registers with a slot in REG_OFFSET. */ | ||
761 | poly_int64 saved_regs_size; | ||
762 | |||
763 | + /* The number of bytes between the bottom of the static frame (the bottom | ||
764 | + of the outgoing arguments) and the bottom of the register save area. | ||
765 | + This value is always a multiple of STACK_BOUNDARY. */ | ||
766 | + poly_int64 bytes_below_saved_regs; | ||
767 | + | ||
768 | /* The size of the callee-save registers with a slot in REG_OFFSET that | ||
769 | are saved below the hard frame pointer. */ | ||
770 | poly_int64 below_hard_fp_saved_regs_size; | ||
771 | -- | ||
772 | 2.34.1 | ||
773 | |||
774 | |||
775 | From 82f6b3e1b596ef0f4e3ac3bb9c6e88fb4458f402 Mon Sep 17 00:00:00 2001 | ||
776 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
777 | Date: Tue, 12 Sep 2023 16:07:14 +0100 | ||
778 | Subject: [PATCH 05/19] aarch64: Add bytes_below_hard_fp to frame info | ||
779 | |||
780 | Following on from the previous bytes_below_saved_regs patch, this one | ||
781 | records the number of bytes that are below the hard frame pointer. | ||
782 | This eventually replaces below_hard_fp_saved_regs_size. | ||
783 | |||
784 | If a frame pointer is not needed, the epilogue adds final_adjust | ||
785 | to the stack pointer before restoring registers: | ||
786 | |||
787 | aarch64_add_sp (tmp1_rtx, tmp0_rtx, final_adjust, true); | ||
788 | |||
789 | Therefore, if the epilogue needs to restore the stack pointer from | ||
790 | the hard frame pointer, the directly corresponding offset is: | ||
791 | |||
792 | -bytes_below_hard_fp + final_adjust | ||
793 | |||
794 | i.e. go from the hard frame pointer to the bottom of the frame, | ||
795 | then add the same amount as if we were using the stack pointer | ||
796 | from the outset. | ||
797 | |||
798 | gcc/ | ||
799 | * config/aarch64/aarch64.h (aarch64_frame::bytes_below_hard_fp): New | ||
800 | field. | ||
801 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize it. | ||
802 | (aarch64_expand_epilogue): Use it instead of | ||
803 | below_hard_fp_saved_regs_size. | ||
804 | --- | ||
805 | gcc/config/aarch64/aarch64.cc | 6 +++--- | ||
806 | gcc/config/aarch64/aarch64.h | 5 +++++ | ||
807 | 2 files changed, 8 insertions(+), 3 deletions(-) | ||
808 | |||
809 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
810 | index dacc2b0e4dd..a3f7aabcc59 100644 | ||
811 | --- a/gcc/config/aarch64/aarch64.cc | ||
812 | +++ b/gcc/config/aarch64/aarch64.cc | ||
813 | @@ -8530,6 +8530,7 @@ aarch64_layout_frame (void) | ||
814 | of the callee save area. */ | ||
815 | bool saves_below_hard_fp_p = maybe_ne (offset, 0); | ||
816 | frame.below_hard_fp_saved_regs_size = offset; | ||
817 | + frame.bytes_below_hard_fp = offset + frame.bytes_below_saved_regs; | ||
818 | if (frame.emit_frame_chain) | ||
819 | { | ||
820 | /* FP and LR are placed in the linkage record. */ | ||
821 | @@ -10171,8 +10172,7 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
822 | poly_int64 final_adjust = frame.final_adjust; | ||
823 | poly_int64 callee_offset = frame.callee_offset; | ||
824 | poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
825 | - poly_int64 below_hard_fp_saved_regs_size | ||
826 | - = frame.below_hard_fp_saved_regs_size; | ||
827 | + poly_int64 bytes_below_hard_fp = frame.bytes_below_hard_fp; | ||
828 | unsigned reg1 = frame.wb_pop_candidate1; | ||
829 | unsigned reg2 = frame.wb_pop_candidate2; | ||
830 | unsigned int last_gpr = (frame.is_scs_enabled | ||
831 | @@ -10230,7 +10230,7 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
832 | is restored on the instruction doing the writeback. */ | ||
833 | aarch64_add_offset (Pmode, stack_pointer_rtx, | ||
834 | hard_frame_pointer_rtx, | ||
835 | - -callee_offset - below_hard_fp_saved_regs_size, | ||
836 | + -bytes_below_hard_fp + final_adjust, | ||
837 | tmp1_rtx, tmp0_rtx, callee_adjust == 0); | ||
838 | else | ||
839 | /* The case where we need to re-use the register here is very rare, so | ||
840 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
841 | index 0b6faa3ddf1..4263d29d29d 100644 | ||
842 | --- a/gcc/config/aarch64/aarch64.h | ||
843 | +++ b/gcc/config/aarch64/aarch64.h | ||
844 | @@ -786,6 +786,11 @@ struct GTY (()) aarch64_frame | ||
845 | are saved below the hard frame pointer. */ | ||
846 | poly_int64 below_hard_fp_saved_regs_size; | ||
847 | |||
848 | + /* The number of bytes between the bottom of the static frame (the bottom | ||
849 | + of the outgoing arguments) and the hard frame pointer. This value is | ||
850 | + always a multiple of STACK_BOUNDARY. */ | ||
851 | + poly_int64 bytes_below_hard_fp; | ||
852 | + | ||
853 | /* Offset from the base of the frame (incomming SP) to the | ||
854 | top of the locals area. This value is always a multiple of | ||
855 | STACK_BOUNDARY. */ | ||
856 | -- | ||
857 | 2.34.1 | ||
858 | |||
859 | |||
860 | From 86fa43e9fe4a8bf954f2919f07cbe3646d1d1df3 Mon Sep 17 00:00:00 2001 | ||
861 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
862 | Date: Tue, 12 Sep 2023 16:07:14 +0100 | ||
863 | Subject: [PATCH 06/19] aarch64: Tweak aarch64_save/restore_callee_saves | ||
864 | |||
865 | aarch64_save_callee_saves and aarch64_restore_callee_saves took | ||
866 | a parameter called start_offset that gives the offset of the | ||
867 | bottom of the saved register area from the current stack pointer. | ||
868 | However, it's more convenient for later patches if we use the | ||
869 | bottom of the entire frame as the reference point, rather than | ||
870 | the bottom of the saved registers. | ||
871 | |||
872 | Doing that removes the need for the callee_offset field. | ||
873 | Other than that, this is not a win on its own. It only really | ||
874 | makes sense in combination with the follow-on patches. | ||
875 | |||
876 | gcc/ | ||
877 | * config/aarch64/aarch64.h (aarch64_frame::callee_offset): Delete. | ||
878 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Remove | ||
879 | callee_offset handling. | ||
880 | (aarch64_save_callee_saves): Replace the start_offset parameter | ||
881 | with a bytes_below_sp parameter. | ||
882 | (aarch64_restore_callee_saves): Likewise. | ||
883 | (aarch64_expand_prologue): Update accordingly. | ||
884 | (aarch64_expand_epilogue): Likewise. | ||
885 | --- | ||
886 | gcc/config/aarch64/aarch64.cc | 56 +++++++++++++++++------------------ | ||
887 | gcc/config/aarch64/aarch64.h | 4 --- | ||
888 | 2 files changed, 28 insertions(+), 32 deletions(-) | ||
889 | |||
890 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
891 | index a3f7aabcc59..46ae5cf7673 100644 | ||
892 | --- a/gcc/config/aarch64/aarch64.cc | ||
893 | +++ b/gcc/config/aarch64/aarch64.cc | ||
894 | @@ -8604,7 +8604,6 @@ aarch64_layout_frame (void) | ||
895 | frame.final_adjust = 0; | ||
896 | frame.callee_adjust = 0; | ||
897 | frame.sve_callee_adjust = 0; | ||
898 | - frame.callee_offset = 0; | ||
899 | |||
900 | frame.wb_pop_candidate1 = frame.wb_push_candidate1; | ||
901 | frame.wb_pop_candidate2 = frame.wb_push_candidate2; | ||
902 | @@ -8672,7 +8671,6 @@ aarch64_layout_frame (void) | ||
903 | stp reg1, reg2, [sp, bytes_below_saved_regs] | ||
904 | stp reg3, reg4, [sp, bytes_below_saved_regs + 16] */ | ||
905 | frame.initial_adjust = frame.frame_size; | ||
906 | - frame.callee_offset = const_below_saved_regs; | ||
907 | } | ||
908 | else if (saves_below_hard_fp_p | ||
909 | && known_eq (frame.saved_regs_size, | ||
910 | @@ -9073,12 +9071,13 @@ aarch64_add_cfa_expression (rtx_insn *insn, rtx reg, | ||
911 | } | ||
912 | |||
913 | /* Emit code to save the callee-saved registers from register number START | ||
914 | - to LIMIT to the stack at the location starting at offset START_OFFSET, | ||
915 | - skipping any write-back candidates if SKIP_WB is true. HARD_FP_VALID_P | ||
916 | - is true if the hard frame pointer has been set up. */ | ||
917 | + to LIMIT to the stack. The stack pointer is currently BYTES_BELOW_SP | ||
918 | + bytes above the bottom of the static frame. Skip any write-back | ||
919 | + candidates if SKIP_WB is true. HARD_FP_VALID_P is true if the hard | ||
920 | + frame pointer has been set up. */ | ||
921 | |||
922 | static void | ||
923 | -aarch64_save_callee_saves (poly_int64 start_offset, | ||
924 | +aarch64_save_callee_saves (poly_int64 bytes_below_sp, | ||
925 | unsigned start, unsigned limit, bool skip_wb, | ||
926 | bool hard_fp_valid_p) | ||
927 | { | ||
928 | @@ -9106,7 +9105,9 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
929 | |||
930 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
931 | reg = gen_rtx_REG (mode, regno); | ||
932 | - offset = start_offset + frame.reg_offset[regno]; | ||
933 | + offset = (frame.reg_offset[regno] | ||
934 | + + frame.bytes_below_saved_regs | ||
935 | + - bytes_below_sp); | ||
936 | rtx base_rtx = stack_pointer_rtx; | ||
937 | poly_int64 sp_offset = offset; | ||
938 | |||
939 | @@ -9117,9 +9118,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
940 | else if (GP_REGNUM_P (regno) | ||
941 | && (!offset.is_constant (&const_offset) || const_offset >= 512)) | ||
942 | { | ||
943 | - gcc_assert (known_eq (start_offset, 0)); | ||
944 | - poly_int64 fp_offset | ||
945 | - = frame.below_hard_fp_saved_regs_size; | ||
946 | + poly_int64 fp_offset = frame.bytes_below_hard_fp - bytes_below_sp; | ||
947 | if (hard_fp_valid_p) | ||
948 | base_rtx = hard_frame_pointer_rtx; | ||
949 | else | ||
950 | @@ -9183,12 +9182,13 @@ aarch64_save_callee_saves (poly_int64 start_offset, | ||
951 | } | ||
952 | |||
953 | /* Emit code to restore the callee registers from register number START | ||
954 | - up to and including LIMIT. Restore from the stack offset START_OFFSET, | ||
955 | - skipping any write-back candidates if SKIP_WB is true. Write the | ||
956 | - appropriate REG_CFA_RESTORE notes into CFI_OPS. */ | ||
957 | + up to and including LIMIT. The stack pointer is currently BYTES_BELOW_SP | ||
958 | + bytes above the bottom of the static frame. Skip any write-back | ||
959 | + candidates if SKIP_WB is true. Write the appropriate REG_CFA_RESTORE | ||
960 | + notes into CFI_OPS. */ | ||
961 | |||
962 | static void | ||
963 | -aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, | ||
964 | +aarch64_restore_callee_saves (poly_int64 bytes_below_sp, unsigned start, | ||
965 | unsigned limit, bool skip_wb, rtx *cfi_ops) | ||
966 | { | ||
967 | aarch64_frame &frame = cfun->machine->frame; | ||
968 | @@ -9214,7 +9214,9 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, | ||
969 | |||
970 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
971 | reg = gen_rtx_REG (mode, regno); | ||
972 | - offset = start_offset + frame.reg_offset[regno]; | ||
973 | + offset = (frame.reg_offset[regno] | ||
974 | + + frame.bytes_below_saved_regs | ||
975 | + - bytes_below_sp); | ||
976 | rtx base_rtx = stack_pointer_rtx; | ||
977 | if (mode == VNx2DImode && BYTES_BIG_ENDIAN) | ||
978 | aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, | ||
979 | @@ -9990,8 +9992,6 @@ aarch64_expand_prologue (void) | ||
980 | HOST_WIDE_INT callee_adjust = frame.callee_adjust; | ||
981 | poly_int64 final_adjust = frame.final_adjust; | ||
982 | poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
983 | - poly_int64 below_hard_fp_saved_regs_size | ||
984 | - = frame.below_hard_fp_saved_regs_size; | ||
985 | unsigned reg1 = frame.wb_push_candidate1; | ||
986 | unsigned reg2 = frame.wb_push_candidate2; | ||
987 | bool emit_frame_chain = frame.emit_frame_chain; | ||
988 | @@ -10067,8 +10067,8 @@ aarch64_expand_prologue (void) | ||
989 | - frame.hard_fp_offset); | ||
990 | gcc_assert (known_ge (chain_offset, 0)); | ||
991 | |||
992 | - /* The offset of the bottom of the save area from the current SP. */ | ||
993 | - poly_int64 saved_regs_offset = chain_offset - below_hard_fp_saved_regs_size; | ||
994 | + /* The offset of the current SP from the bottom of the static frame. */ | ||
995 | + poly_int64 bytes_below_sp = frame_size - initial_adjust - callee_adjust; | ||
996 | |||
997 | if (emit_frame_chain) | ||
998 | { | ||
999 | @@ -10076,7 +10076,7 @@ aarch64_expand_prologue (void) | ||
1000 | { | ||
1001 | reg1 = R29_REGNUM; | ||
1002 | reg2 = R30_REGNUM; | ||
1003 | - aarch64_save_callee_saves (saved_regs_offset, reg1, reg2, | ||
1004 | + aarch64_save_callee_saves (bytes_below_sp, reg1, reg2, | ||
1005 | false, false); | ||
1006 | } | ||
1007 | else | ||
1008 | @@ -10116,7 +10116,7 @@ aarch64_expand_prologue (void) | ||
1009 | emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx)); | ||
1010 | } | ||
1011 | |||
1012 | - aarch64_save_callee_saves (saved_regs_offset, R0_REGNUM, R30_REGNUM, | ||
1013 | + aarch64_save_callee_saves (bytes_below_sp, R0_REGNUM, R30_REGNUM, | ||
1014 | callee_adjust != 0 || emit_frame_chain, | ||
1015 | emit_frame_chain); | ||
1016 | if (maybe_ne (sve_callee_adjust, 0)) | ||
1017 | @@ -10126,16 +10126,17 @@ aarch64_expand_prologue (void) | ||
1018 | aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, | ||
1019 | sve_callee_adjust, | ||
1020 | !frame_pointer_needed, false); | ||
1021 | - saved_regs_offset += sve_callee_adjust; | ||
1022 | + bytes_below_sp -= sve_callee_adjust; | ||
1023 | } | ||
1024 | - aarch64_save_callee_saves (saved_regs_offset, P0_REGNUM, P15_REGNUM, | ||
1025 | + aarch64_save_callee_saves (bytes_below_sp, P0_REGNUM, P15_REGNUM, | ||
1026 | false, emit_frame_chain); | ||
1027 | - aarch64_save_callee_saves (saved_regs_offset, V0_REGNUM, V31_REGNUM, | ||
1028 | + aarch64_save_callee_saves (bytes_below_sp, V0_REGNUM, V31_REGNUM, | ||
1029 | callee_adjust != 0 || emit_frame_chain, | ||
1030 | emit_frame_chain); | ||
1031 | |||
1032 | /* We may need to probe the final adjustment if it is larger than the guard | ||
1033 | that is assumed by the called. */ | ||
1034 | + gcc_assert (known_eq (bytes_below_sp, final_adjust)); | ||
1035 | aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, final_adjust, | ||
1036 | !frame_pointer_needed, true); | ||
1037 | } | ||
1038 | @@ -10170,7 +10171,6 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
1039 | poly_int64 initial_adjust = frame.initial_adjust; | ||
1040 | HOST_WIDE_INT callee_adjust = frame.callee_adjust; | ||
1041 | poly_int64 final_adjust = frame.final_adjust; | ||
1042 | - poly_int64 callee_offset = frame.callee_offset; | ||
1043 | poly_int64 sve_callee_adjust = frame.sve_callee_adjust; | ||
1044 | poly_int64 bytes_below_hard_fp = frame.bytes_below_hard_fp; | ||
1045 | unsigned reg1 = frame.wb_pop_candidate1; | ||
1046 | @@ -10240,9 +10240,9 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
1047 | |||
1048 | /* Restore the vector registers before the predicate registers, | ||
1049 | so that we can use P4 as a temporary for big-endian SVE frames. */ | ||
1050 | - aarch64_restore_callee_saves (callee_offset, V0_REGNUM, V31_REGNUM, | ||
1051 | + aarch64_restore_callee_saves (final_adjust, V0_REGNUM, V31_REGNUM, | ||
1052 | callee_adjust != 0, &cfi_ops); | ||
1053 | - aarch64_restore_callee_saves (callee_offset, P0_REGNUM, P15_REGNUM, | ||
1054 | + aarch64_restore_callee_saves (final_adjust, P0_REGNUM, P15_REGNUM, | ||
1055 | false, &cfi_ops); | ||
1056 | if (maybe_ne (sve_callee_adjust, 0)) | ||
1057 | aarch64_add_sp (NULL_RTX, NULL_RTX, sve_callee_adjust, true); | ||
1058 | @@ -10250,7 +10250,7 @@ aarch64_expand_epilogue (bool for_sibcall) | ||
1059 | /* When shadow call stack is enabled, the scs_pop in the epilogue will | ||
1060 | restore x30, we don't need to restore x30 again in the traditional | ||
1061 | way. */ | ||
1062 | - aarch64_restore_callee_saves (callee_offset - sve_callee_adjust, | ||
1063 | + aarch64_restore_callee_saves (final_adjust + sve_callee_adjust, | ||
1064 | R0_REGNUM, last_gpr, | ||
1065 | callee_adjust != 0, &cfi_ops); | ||
1066 | |||
1067 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
1068 | index 4263d29d29d..fd820b1be4e 100644 | ||
1069 | --- a/gcc/config/aarch64/aarch64.h | ||
1070 | +++ b/gcc/config/aarch64/aarch64.h | ||
1071 | @@ -813,10 +813,6 @@ struct GTY (()) aarch64_frame | ||
1072 | It is zero when no push is used. */ | ||
1073 | HOST_WIDE_INT callee_adjust; | ||
1074 | |||
1075 | - /* The offset from SP to the callee-save registers after initial_adjust. | ||
1076 | - It may be non-zero if no push is used (ie. callee_adjust == 0). */ | ||
1077 | - poly_int64 callee_offset; | ||
1078 | - | ||
1079 | /* The size of the stack adjustment before saving or after restoring | ||
1080 | SVE registers. */ | ||
1081 | poly_int64 sve_callee_adjust; | ||
1082 | -- | ||
1083 | 2.34.1 | ||
1084 | |||
1085 | |||
1086 | From 8ae9181426f2700c2e5a2909487fa630e6fa406b Mon Sep 17 00:00:00 2001 | ||
1087 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1088 | Date: Tue, 12 Sep 2023 16:07:15 +0100 | ||
1089 | Subject: [PATCH 07/19] aarch64: Only calculate chain_offset if there is a | ||
1090 | chain | ||
1091 | |||
1092 | After previous patches, it is no longer necessary to calculate | ||
1093 | a chain_offset in cases where there is no chain record. | ||
1094 | |||
1095 | gcc/ | ||
1096 | * config/aarch64/aarch64.cc (aarch64_expand_prologue): Move the | ||
1097 | calculation of chain_offset into the emit_frame_chain block. | ||
1098 | --- | ||
1099 | gcc/config/aarch64/aarch64.cc | 10 +++++----- | ||
1100 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
1101 | |||
1102 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1103 | index 46ae5cf7673..0e9b9717c08 100644 | ||
1104 | --- a/gcc/config/aarch64/aarch64.cc | ||
1105 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1106 | @@ -10062,16 +10062,16 @@ aarch64_expand_prologue (void) | ||
1107 | if (callee_adjust != 0) | ||
1108 | aarch64_push_regs (reg1, reg2, callee_adjust); | ||
1109 | |||
1110 | - /* The offset of the frame chain record (if any) from the current SP. */ | ||
1111 | - poly_int64 chain_offset = (initial_adjust + callee_adjust | ||
1112 | - - frame.hard_fp_offset); | ||
1113 | - gcc_assert (known_ge (chain_offset, 0)); | ||
1114 | - | ||
1115 | /* The offset of the current SP from the bottom of the static frame. */ | ||
1116 | poly_int64 bytes_below_sp = frame_size - initial_adjust - callee_adjust; | ||
1117 | |||
1118 | if (emit_frame_chain) | ||
1119 | { | ||
1120 | + /* The offset of the frame chain record (if any) from the current SP. */ | ||
1121 | + poly_int64 chain_offset = (initial_adjust + callee_adjust | ||
1122 | + - frame.hard_fp_offset); | ||
1123 | + gcc_assert (known_ge (chain_offset, 0)); | ||
1124 | + | ||
1125 | if (callee_adjust == 0) | ||
1126 | { | ||
1127 | reg1 = R29_REGNUM; | ||
1128 | -- | ||
1129 | 2.34.1 | ||
1130 | |||
1131 | |||
1132 | From 375794feb614cee1f41b710b9cc1b6f25da6c1cb Mon Sep 17 00:00:00 2001 | ||
1133 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1134 | Date: Tue, 12 Sep 2023 16:07:15 +0100 | ||
1135 | Subject: [PATCH 08/19] aarch64: Rename locals_offset to bytes_above_locals | ||
1136 | MIME-Version: 1.0 | ||
1137 | Content-Type: text/plain; charset=UTF-8 | ||
1138 | Content-Transfer-Encoding: 8bit | ||
1139 | |||
1140 | locals_offset was described as: | ||
1141 | |||
1142 | /* Offset from the base of the frame (incomming SP) to the | ||
1143 | top of the locals area. This value is always a multiple of | ||
1144 | STACK_BOUNDARY. */ | ||
1145 | |||
1146 | This is implicitly an “upside down” view of the frame: the incoming | ||
1147 | SP is at offset 0, and anything N bytes below the incoming SP is at | ||
1148 | offset N (rather than -N). | ||
1149 | |||
1150 | However, reg_offset instead uses a “right way up” view; that is, | ||
1151 | it views offsets in address terms. Something above X is at a | ||
1152 | positive offset from X and something below X is at a negative | ||
1153 | offset from X. | ||
1154 | |||
1155 | Also, even on FRAME_GROWS_DOWNWARD targets like AArch64, | ||
1156 | target-independent code views offsets in address terms too: | ||
1157 | locals are allocated at negative offsets to virtual_stack_vars. | ||
1158 | |||
1159 | It seems confusing to have *_offset fields of the same structure | ||
1160 | using different polarities like this. This patch tries to avoid | ||
1161 | that by renaming locals_offset to bytes_above_locals. | ||
1162 | |||
1163 | gcc/ | ||
1164 | * config/aarch64/aarch64.h (aarch64_frame::locals_offset): Rename to... | ||
1165 | (aarch64_frame::bytes_above_locals): ...this. | ||
1166 | * config/aarch64/aarch64.cc (aarch64_layout_frame) | ||
1167 | (aarch64_initial_elimination_offset): Update accordingly. | ||
1168 | --- | ||
1169 | gcc/config/aarch64/aarch64.cc | 6 +++--- | ||
1170 | gcc/config/aarch64/aarch64.h | 6 +++--- | ||
1171 | 2 files changed, 6 insertions(+), 6 deletions(-) | ||
1172 | |||
1173 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1174 | index 0e9b9717c08..0a22f91520e 100644 | ||
1175 | --- a/gcc/config/aarch64/aarch64.cc | ||
1176 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1177 | @@ -8598,7 +8598,7 @@ aarch64_layout_frame (void) | ||
1178 | STACK_BOUNDARY / BITS_PER_UNIT)); | ||
1179 | frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; | ||
1180 | |||
1181 | - frame.locals_offset = frame.saved_varargs_size; | ||
1182 | + frame.bytes_above_locals = frame.saved_varargs_size; | ||
1183 | |||
1184 | frame.initial_adjust = 0; | ||
1185 | frame.final_adjust = 0; | ||
1186 | @@ -12754,13 +12754,13 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) | ||
1187 | return frame.hard_fp_offset; | ||
1188 | |||
1189 | if (from == FRAME_POINTER_REGNUM) | ||
1190 | - return frame.hard_fp_offset - frame.locals_offset; | ||
1191 | + return frame.hard_fp_offset - frame.bytes_above_locals; | ||
1192 | } | ||
1193 | |||
1194 | if (to == STACK_POINTER_REGNUM) | ||
1195 | { | ||
1196 | if (from == FRAME_POINTER_REGNUM) | ||
1197 | - return frame.frame_size - frame.locals_offset; | ||
1198 | + return frame.frame_size - frame.bytes_above_locals; | ||
1199 | } | ||
1200 | |||
1201 | return frame.frame_size; | ||
1202 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
1203 | index fd820b1be4e..7ae12d13e2b 100644 | ||
1204 | --- a/gcc/config/aarch64/aarch64.h | ||
1205 | +++ b/gcc/config/aarch64/aarch64.h | ||
1206 | @@ -791,10 +791,10 @@ struct GTY (()) aarch64_frame | ||
1207 | always a multiple of STACK_BOUNDARY. */ | ||
1208 | poly_int64 bytes_below_hard_fp; | ||
1209 | |||
1210 | - /* Offset from the base of the frame (incomming SP) to the | ||
1211 | - top of the locals area. This value is always a multiple of | ||
1212 | + /* The number of bytes between the top of the locals area and the top | ||
1213 | + of the frame (the incomming SP). This value is always a multiple of | ||
1214 | STACK_BOUNDARY. */ | ||
1215 | - poly_int64 locals_offset; | ||
1216 | + poly_int64 bytes_above_locals; | ||
1217 | |||
1218 | /* Offset from the base of the frame (incomming SP) to the | ||
1219 | hard_frame_pointer. This value is always a multiple of | ||
1220 | -- | ||
1221 | 2.34.1 | ||
1222 | |||
1223 | |||
1224 | From 1a9ea1c45c75615ffbfabe652b3598a1d7be2168 Mon Sep 17 00:00:00 2001 | ||
1225 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1226 | Date: Tue, 12 Sep 2023 16:07:16 +0100 | ||
1227 | Subject: [PATCH 09/19] aarch64: Rename hard_fp_offset to bytes_above_hard_fp | ||
1228 | MIME-Version: 1.0 | ||
1229 | Content-Type: text/plain; charset=UTF-8 | ||
1230 | Content-Transfer-Encoding: 8bit | ||
1231 | |||
1232 | Similarly to the previous locals_offset patch, hard_fp_offset | ||
1233 | was described as: | ||
1234 | |||
1235 | /* Offset from the base of the frame (incomming SP) to the | ||
1236 | hard_frame_pointer. This value is always a multiple of | ||
1237 | STACK_BOUNDARY. */ | ||
1238 | poly_int64 hard_fp_offset; | ||
1239 | |||
1240 | which again took an “upside-down” view: higher offsets meant lower | ||
1241 | addresses. This patch renames the field to bytes_above_hard_fp instead. | ||
1242 | |||
1243 | gcc/ | ||
1244 | * config/aarch64/aarch64.h (aarch64_frame::hard_fp_offset): Rename | ||
1245 | to... | ||
1246 | (aarch64_frame::bytes_above_hard_fp): ...this. | ||
1247 | * config/aarch64/aarch64.cc (aarch64_layout_frame) | ||
1248 | (aarch64_expand_prologue): Update accordingly. | ||
1249 | (aarch64_initial_elimination_offset): Likewise. | ||
1250 | --- | ||
1251 | gcc/config/aarch64/aarch64.cc | 26 +++++++++++++------------- | ||
1252 | gcc/config/aarch64/aarch64.h | 6 +++--- | ||
1253 | 2 files changed, 16 insertions(+), 16 deletions(-) | ||
1254 | |||
1255 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1256 | index 0a22f91520e..95499ae49ba 100644 | ||
1257 | --- a/gcc/config/aarch64/aarch64.cc | ||
1258 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1259 | @@ -8590,7 +8590,7 @@ aarch64_layout_frame (void) | ||
1260 | + get_frame_size (), | ||
1261 | STACK_BOUNDARY / BITS_PER_UNIT); | ||
1262 | |||
1263 | - frame.hard_fp_offset | ||
1264 | + frame.bytes_above_hard_fp | ||
1265 | = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; | ||
1266 | |||
1267 | /* Both these values are already aligned. */ | ||
1268 | @@ -8639,13 +8639,13 @@ aarch64_layout_frame (void) | ||
1269 | else if (frame.wb_pop_candidate1 != INVALID_REGNUM) | ||
1270 | max_push_offset = 256; | ||
1271 | |||
1272 | - HOST_WIDE_INT const_size, const_below_saved_regs, const_fp_offset; | ||
1273 | + HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; | ||
1274 | HOST_WIDE_INT const_saved_regs_size; | ||
1275 | if (known_eq (frame.saved_regs_size, 0)) | ||
1276 | frame.initial_adjust = frame.frame_size; | ||
1277 | else if (frame.frame_size.is_constant (&const_size) | ||
1278 | && const_size < max_push_offset | ||
1279 | - && known_eq (frame.hard_fp_offset, const_size)) | ||
1280 | + && known_eq (frame.bytes_above_hard_fp, const_size)) | ||
1281 | { | ||
1282 | /* Simple, small frame with no data below the saved registers. | ||
1283 | |||
1284 | @@ -8662,8 +8662,8 @@ aarch64_layout_frame (void) | ||
1285 | case that it hardly seems worth the effort though. */ | ||
1286 | && (!saves_below_hard_fp_p || const_below_saved_regs == 0) | ||
1287 | && !(cfun->calls_alloca | ||
1288 | - && frame.hard_fp_offset.is_constant (&const_fp_offset) | ||
1289 | - && const_fp_offset < max_push_offset)) | ||
1290 | + && frame.bytes_above_hard_fp.is_constant (&const_above_fp) | ||
1291 | + && const_above_fp < max_push_offset)) | ||
1292 | { | ||
1293 | /* Frame with small area below the saved registers: | ||
1294 | |||
1295 | @@ -8681,12 +8681,12 @@ aarch64_layout_frame (void) | ||
1296 | sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size | ||
1297 | save SVE registers relative to SP | ||
1298 | sub sp, sp, bytes_below_saved_regs */ | ||
1299 | - frame.initial_adjust = (frame.hard_fp_offset | ||
1300 | + frame.initial_adjust = (frame.bytes_above_hard_fp | ||
1301 | + frame.below_hard_fp_saved_regs_size); | ||
1302 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
1303 | } | ||
1304 | - else if (frame.hard_fp_offset.is_constant (&const_fp_offset) | ||
1305 | - && const_fp_offset < max_push_offset) | ||
1306 | + else if (frame.bytes_above_hard_fp.is_constant (&const_above_fp) | ||
1307 | + && const_above_fp < max_push_offset) | ||
1308 | { | ||
1309 | /* Frame with large area below the saved registers, or with SVE saves, | ||
1310 | but with a small area above: | ||
1311 | @@ -8696,7 +8696,7 @@ aarch64_layout_frame (void) | ||
1312 | [sub sp, sp, below_hard_fp_saved_regs_size] | ||
1313 | [save SVE registers relative to SP] | ||
1314 | sub sp, sp, bytes_below_saved_regs */ | ||
1315 | - frame.callee_adjust = const_fp_offset; | ||
1316 | + frame.callee_adjust = const_above_fp; | ||
1317 | frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
1318 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
1319 | } | ||
1320 | @@ -8711,7 +8711,7 @@ aarch64_layout_frame (void) | ||
1321 | [sub sp, sp, below_hard_fp_saved_regs_size] | ||
1322 | [save SVE registers relative to SP] | ||
1323 | sub sp, sp, bytes_below_saved_regs */ | ||
1324 | - frame.initial_adjust = frame.hard_fp_offset; | ||
1325 | + frame.initial_adjust = frame.bytes_above_hard_fp; | ||
1326 | frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
1327 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
1328 | } | ||
1329 | @@ -10069,7 +10069,7 @@ aarch64_expand_prologue (void) | ||
1330 | { | ||
1331 | /* The offset of the frame chain record (if any) from the current SP. */ | ||
1332 | poly_int64 chain_offset = (initial_adjust + callee_adjust | ||
1333 | - - frame.hard_fp_offset); | ||
1334 | + - frame.bytes_above_hard_fp); | ||
1335 | gcc_assert (known_ge (chain_offset, 0)); | ||
1336 | |||
1337 | if (callee_adjust == 0) | ||
1338 | @@ -12751,10 +12751,10 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) | ||
1339 | if (to == HARD_FRAME_POINTER_REGNUM) | ||
1340 | { | ||
1341 | if (from == ARG_POINTER_REGNUM) | ||
1342 | - return frame.hard_fp_offset; | ||
1343 | + return frame.bytes_above_hard_fp; | ||
1344 | |||
1345 | if (from == FRAME_POINTER_REGNUM) | ||
1346 | - return frame.hard_fp_offset - frame.bytes_above_locals; | ||
1347 | + return frame.bytes_above_hard_fp - frame.bytes_above_locals; | ||
1348 | } | ||
1349 | |||
1350 | if (to == STACK_POINTER_REGNUM) | ||
1351 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
1352 | index 7ae12d13e2b..3808f49e9ca 100644 | ||
1353 | --- a/gcc/config/aarch64/aarch64.h | ||
1354 | +++ b/gcc/config/aarch64/aarch64.h | ||
1355 | @@ -796,10 +796,10 @@ struct GTY (()) aarch64_frame | ||
1356 | STACK_BOUNDARY. */ | ||
1357 | poly_int64 bytes_above_locals; | ||
1358 | |||
1359 | - /* Offset from the base of the frame (incomming SP) to the | ||
1360 | - hard_frame_pointer. This value is always a multiple of | ||
1361 | + /* The number of bytes between the hard_frame_pointer and the top of | ||
1362 | + the frame (the incomming SP). This value is always a multiple of | ||
1363 | STACK_BOUNDARY. */ | ||
1364 | - poly_int64 hard_fp_offset; | ||
1365 | + poly_int64 bytes_above_hard_fp; | ||
1366 | |||
1367 | /* The size of the frame. This value is the offset from base of the | ||
1368 | frame (incomming SP) to the stack_pointer. This value is always | ||
1369 | -- | ||
1370 | 2.34.1 | ||
1371 | |||
1372 | |||
1373 | From d202ce1ecf60a36a3e1009917dd76109248ce9be Mon Sep 17 00:00:00 2001 | ||
1374 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1375 | Date: Tue, 12 Sep 2023 16:07:16 +0100 | ||
1376 | Subject: [PATCH 10/19] aarch64: Tweak frame_size comment | ||
1377 | MIME-Version: 1.0 | ||
1378 | Content-Type: text/plain; charset=UTF-8 | ||
1379 | Content-Transfer-Encoding: 8bit | ||
1380 | |||
1381 | This patch fixes another case in which a value was described with | ||
1382 | an “upside-down” view. | ||
1383 | |||
1384 | gcc/ | ||
1385 | * config/aarch64/aarch64.h (aarch64_frame::frame_size): Tweak comment. | ||
1386 | --- | ||
1387 | gcc/config/aarch64/aarch64.h | 4 ++-- | ||
1388 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
1389 | |||
1390 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
1391 | index 3808f49e9ca..108a5731b0d 100644 | ||
1392 | --- a/gcc/config/aarch64/aarch64.h | ||
1393 | +++ b/gcc/config/aarch64/aarch64.h | ||
1394 | @@ -801,8 +801,8 @@ struct GTY (()) aarch64_frame | ||
1395 | STACK_BOUNDARY. */ | ||
1396 | poly_int64 bytes_above_hard_fp; | ||
1397 | |||
1398 | - /* The size of the frame. This value is the offset from base of the | ||
1399 | - frame (incomming SP) to the stack_pointer. This value is always | ||
1400 | + /* The size of the frame, i.e. the number of bytes between the bottom | ||
1401 | + of the outgoing arguments and the incoming SP. This value is always | ||
1402 | a multiple of STACK_BOUNDARY. */ | ||
1403 | poly_int64 frame_size; | ||
1404 | |||
1405 | -- | ||
1406 | 2.34.1 | ||
1407 | |||
1408 | |||
1409 | From f2b585375205b0a1802d79c682ba33766ecd1f0f Mon Sep 17 00:00:00 2001 | ||
1410 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1411 | Date: Tue, 12 Sep 2023 16:07:17 +0100 | ||
1412 | Subject: [PATCH 11/19] aarch64: Measure reg_offset from the bottom of the | ||
1413 | frame | ||
1414 | |||
1415 | reg_offset was measured from the bottom of the saved register area. | ||
1416 | This made perfect sense with the original layout, since the bottom | ||
1417 | of the saved register area was also the hard frame pointer address. | ||
1418 | It became slightly less obvious with SVE, since we save SVE | ||
1419 | registers below the hard frame pointer, but it still made sense. | ||
1420 | |||
1421 | However, if we want to allow different frame layouts, it's more | ||
1422 | convenient and obvious to measure reg_offset from the bottom of | ||
1423 | the frame. After previous patches, it's also a slight simplification | ||
1424 | in its own right. | ||
1425 | |||
1426 | gcc/ | ||
1427 | * config/aarch64/aarch64.h (aarch64_frame): Add comment above | ||
1428 | reg_offset. | ||
1429 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Walk offsets | ||
1430 | from the bottom of the frame, rather than the bottom of the saved | ||
1431 | register area. Measure reg_offset from the bottom of the frame | ||
1432 | rather than the bottom of the saved register area. | ||
1433 | (aarch64_save_callee_saves): Update accordingly. | ||
1434 | (aarch64_restore_callee_saves): Likewise. | ||
1435 | (aarch64_get_separate_components): Likewise. | ||
1436 | (aarch64_process_components): Likewise. | ||
1437 | --- | ||
1438 | gcc/config/aarch64/aarch64.cc | 53 ++++++++++++++++------------------- | ||
1439 | gcc/config/aarch64/aarch64.h | 3 ++ | ||
1440 | 2 files changed, 27 insertions(+), 29 deletions(-) | ||
1441 | |||
1442 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1443 | index 95499ae49ba..af99807ef8a 100644 | ||
1444 | --- a/gcc/config/aarch64/aarch64.cc | ||
1445 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1446 | @@ -8400,7 +8400,6 @@ aarch64_needs_frame_chain (void) | ||
1447 | static void | ||
1448 | aarch64_layout_frame (void) | ||
1449 | { | ||
1450 | - poly_int64 offset = 0; | ||
1451 | int regno, last_fp_reg = INVALID_REGNUM; | ||
1452 | machine_mode vector_save_mode = aarch64_reg_save_mode (V8_REGNUM); | ||
1453 | poly_int64 vector_save_size = GET_MODE_SIZE (vector_save_mode); | ||
1454 | @@ -8478,7 +8477,9 @@ aarch64_layout_frame (void) | ||
1455 | gcc_assert (crtl->is_leaf | ||
1456 | || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); | ||
1457 | |||
1458 | - frame.bytes_below_saved_regs = crtl->outgoing_args_size; | ||
1459 | + poly_int64 offset = crtl->outgoing_args_size; | ||
1460 | + gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); | ||
1461 | + frame.bytes_below_saved_regs = offset; | ||
1462 | |||
1463 | /* Now assign stack slots for the registers. Start with the predicate | ||
1464 | registers, since predicate LDR and STR have a relatively small | ||
1465 | @@ -8490,7 +8491,8 @@ aarch64_layout_frame (void) | ||
1466 | offset += BYTES_PER_SVE_PRED; | ||
1467 | } | ||
1468 | |||
1469 | - if (maybe_ne (offset, 0)) | ||
1470 | + poly_int64 saved_prs_size = offset - frame.bytes_below_saved_regs; | ||
1471 | + if (maybe_ne (saved_prs_size, 0)) | ||
1472 | { | ||
1473 | /* If we have any vector registers to save above the predicate registers, | ||
1474 | the offset of the vector register save slots need to be a multiple | ||
1475 | @@ -8508,10 +8510,10 @@ aarch64_layout_frame (void) | ||
1476 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
1477 | else | ||
1478 | { | ||
1479 | - if (known_le (offset, vector_save_size)) | ||
1480 | - offset = vector_save_size; | ||
1481 | - else if (known_le (offset, vector_save_size * 2)) | ||
1482 | - offset = vector_save_size * 2; | ||
1483 | + if (known_le (saved_prs_size, vector_save_size)) | ||
1484 | + offset = frame.bytes_below_saved_regs + vector_save_size; | ||
1485 | + else if (known_le (saved_prs_size, vector_save_size * 2)) | ||
1486 | + offset = frame.bytes_below_saved_regs + vector_save_size * 2; | ||
1487 | else | ||
1488 | gcc_unreachable (); | ||
1489 | } | ||
1490 | @@ -8528,9 +8530,10 @@ aarch64_layout_frame (void) | ||
1491 | |||
1492 | /* OFFSET is now the offset of the hard frame pointer from the bottom | ||
1493 | of the callee save area. */ | ||
1494 | - bool saves_below_hard_fp_p = maybe_ne (offset, 0); | ||
1495 | - frame.below_hard_fp_saved_regs_size = offset; | ||
1496 | - frame.bytes_below_hard_fp = offset + frame.bytes_below_saved_regs; | ||
1497 | + frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
1498 | + bool saves_below_hard_fp_p | ||
1499 | + = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); | ||
1500 | + frame.bytes_below_hard_fp = offset; | ||
1501 | if (frame.emit_frame_chain) | ||
1502 | { | ||
1503 | /* FP and LR are placed in the linkage record. */ | ||
1504 | @@ -8581,9 +8584,10 @@ aarch64_layout_frame (void) | ||
1505 | |||
1506 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
1507 | |||
1508 | - frame.saved_regs_size = offset; | ||
1509 | + frame.saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
1510 | |||
1511 | - poly_int64 varargs_and_saved_regs_size = offset + frame.saved_varargs_size; | ||
1512 | + poly_int64 varargs_and_saved_regs_size | ||
1513 | + = frame.saved_regs_size + frame.saved_varargs_size; | ||
1514 | |||
1515 | poly_int64 saved_regs_and_above | ||
1516 | = aligned_upper_bound (varargs_and_saved_regs_size | ||
1517 | @@ -9105,9 +9109,7 @@ aarch64_save_callee_saves (poly_int64 bytes_below_sp, | ||
1518 | |||
1519 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
1520 | reg = gen_rtx_REG (mode, regno); | ||
1521 | - offset = (frame.reg_offset[regno] | ||
1522 | - + frame.bytes_below_saved_regs | ||
1523 | - - bytes_below_sp); | ||
1524 | + offset = frame.reg_offset[regno] - bytes_below_sp; | ||
1525 | rtx base_rtx = stack_pointer_rtx; | ||
1526 | poly_int64 sp_offset = offset; | ||
1527 | |||
1528 | @@ -9214,9 +9216,7 @@ aarch64_restore_callee_saves (poly_int64 bytes_below_sp, unsigned start, | ||
1529 | |||
1530 | machine_mode mode = aarch64_reg_save_mode (regno); | ||
1531 | reg = gen_rtx_REG (mode, regno); | ||
1532 | - offset = (frame.reg_offset[regno] | ||
1533 | - + frame.bytes_below_saved_regs | ||
1534 | - - bytes_below_sp); | ||
1535 | + offset = frame.reg_offset[regno] - bytes_below_sp; | ||
1536 | rtx base_rtx = stack_pointer_rtx; | ||
1537 | if (mode == VNx2DImode && BYTES_BIG_ENDIAN) | ||
1538 | aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, | ||
1539 | @@ -9355,14 +9355,12 @@ aarch64_get_separate_components (void) | ||
1540 | it as a stack probe for -fstack-clash-protection. */ | ||
1541 | if (flag_stack_clash_protection | ||
1542 | && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) | ||
1543 | - && known_eq (offset, 0)) | ||
1544 | + && known_eq (offset, frame.bytes_below_saved_regs)) | ||
1545 | continue; | ||
1546 | |||
1547 | /* Get the offset relative to the register we'll use. */ | ||
1548 | if (frame_pointer_needed) | ||
1549 | - offset -= frame.below_hard_fp_saved_regs_size; | ||
1550 | - else | ||
1551 | - offset += frame.bytes_below_saved_regs; | ||
1552 | + offset -= frame.bytes_below_hard_fp; | ||
1553 | |||
1554 | /* Check that we can access the stack slot of the register with one | ||
1555 | direct load with no adjustments needed. */ | ||
1556 | @@ -9509,9 +9507,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
1557 | rtx reg = gen_rtx_REG (mode, regno); | ||
1558 | poly_int64 offset = frame.reg_offset[regno]; | ||
1559 | if (frame_pointer_needed) | ||
1560 | - offset -= frame.below_hard_fp_saved_regs_size; | ||
1561 | - else | ||
1562 | - offset += frame.bytes_below_saved_regs; | ||
1563 | + offset -= frame.bytes_below_hard_fp; | ||
1564 | |||
1565 | rtx addr = plus_constant (Pmode, ptr_reg, offset); | ||
1566 | rtx mem = gen_frame_mem (mode, addr); | ||
1567 | @@ -9563,9 +9559,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) | ||
1568 | /* REGNO2 can be saved/restored in a pair with REGNO. */ | ||
1569 | rtx reg2 = gen_rtx_REG (mode, regno2); | ||
1570 | if (frame_pointer_needed) | ||
1571 | - offset2 -= frame.below_hard_fp_saved_regs_size; | ||
1572 | - else | ||
1573 | - offset2 += frame.bytes_below_saved_regs; | ||
1574 | + offset2 -= frame.bytes_below_hard_fp; | ||
1575 | rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); | ||
1576 | rtx mem2 = gen_frame_mem (mode, addr2); | ||
1577 | rtx set2 = prologue_p ? gen_rtx_SET (mem2, reg2) | ||
1578 | @@ -9681,7 +9675,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
1579 | if (final_adjustment_p | ||
1580 | && known_eq (frame.below_hard_fp_saved_regs_size, 0)) | ||
1581 | { | ||
1582 | - poly_int64 lr_offset = frame.reg_offset[LR_REGNUM]; | ||
1583 | + poly_int64 lr_offset = (frame.reg_offset[LR_REGNUM] | ||
1584 | + - frame.bytes_below_saved_regs); | ||
1585 | if (known_ge (lr_offset, 0)) | ||
1586 | min_probe_threshold -= lr_offset.to_constant (); | ||
1587 | else | ||
1588 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
1589 | index 108a5731b0d..c8becb098c8 100644 | ||
1590 | --- a/gcc/config/aarch64/aarch64.h | ||
1591 | +++ b/gcc/config/aarch64/aarch64.h | ||
1592 | @@ -766,6 +766,9 @@ extern enum aarch64_processor aarch64_tune; | ||
1593 | #ifdef HAVE_POLY_INT_H | ||
1594 | struct GTY (()) aarch64_frame | ||
1595 | { | ||
1596 | + /* The offset from the bottom of the static frame (the bottom of the | ||
1597 | + outgoing arguments) of each register save slot, or -2 if no save is | ||
1598 | + needed. */ | ||
1599 | poly_int64 reg_offset[LAST_SAVED_REGNUM + 1]; | ||
1600 | |||
1601 | /* The number of extra stack bytes taken up by register varargs. | ||
1602 | -- | ||
1603 | 2.34.1 | ||
1604 | |||
1605 | |||
1606 | From 79faabda181d0d9fd29a3cf5726ba65bdee945b5 Mon Sep 17 00:00:00 2001 | ||
1607 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1608 | Date: Tue, 12 Sep 2023 16:07:17 +0100 | ||
1609 | Subject: [PATCH 12/19] aarch64: Simplify top of frame allocation | ||
1610 | |||
1611 | After previous patches, it no longer really makes sense to allocate | ||
1612 | the top of the frame in terms of varargs_and_saved_regs_size and | ||
1613 | saved_regs_and_above. | ||
1614 | |||
1615 | gcc/ | ||
1616 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Simplify | ||
1617 | the allocation of the top of the frame. | ||
1618 | --- | ||
1619 | gcc/config/aarch64/aarch64.cc | 23 ++++++++--------------- | ||
1620 | 1 file changed, 8 insertions(+), 15 deletions(-) | ||
1621 | |||
1622 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1623 | index af99807ef8a..31b00094c2a 100644 | ||
1624 | --- a/gcc/config/aarch64/aarch64.cc | ||
1625 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1626 | @@ -8586,23 +8586,16 @@ aarch64_layout_frame (void) | ||
1627 | |||
1628 | frame.saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
1629 | |||
1630 | - poly_int64 varargs_and_saved_regs_size | ||
1631 | - = frame.saved_regs_size + frame.saved_varargs_size; | ||
1632 | - | ||
1633 | - poly_int64 saved_regs_and_above | ||
1634 | - = aligned_upper_bound (varargs_and_saved_regs_size | ||
1635 | - + get_frame_size (), | ||
1636 | - STACK_BOUNDARY / BITS_PER_UNIT); | ||
1637 | - | ||
1638 | - frame.bytes_above_hard_fp | ||
1639 | - = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; | ||
1640 | + offset += get_frame_size (); | ||
1641 | + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
1642 | + auto top_of_locals = offset; | ||
1643 | |||
1644 | - /* Both these values are already aligned. */ | ||
1645 | - gcc_assert (multiple_p (frame.bytes_below_saved_regs, | ||
1646 | - STACK_BOUNDARY / BITS_PER_UNIT)); | ||
1647 | - frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; | ||
1648 | + offset += frame.saved_varargs_size; | ||
1649 | + gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); | ||
1650 | + frame.frame_size = offset; | ||
1651 | |||
1652 | - frame.bytes_above_locals = frame.saved_varargs_size; | ||
1653 | + frame.bytes_above_hard_fp = frame.frame_size - frame.bytes_below_hard_fp; | ||
1654 | + frame.bytes_above_locals = frame.frame_size - top_of_locals; | ||
1655 | |||
1656 | frame.initial_adjust = 0; | ||
1657 | frame.final_adjust = 0; | ||
1658 | -- | ||
1659 | 2.34.1 | ||
1660 | |||
1661 | |||
1662 | From 4e62049e403b141e6f916176160dac8cbd65fe47 Mon Sep 17 00:00:00 2001 | ||
1663 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1664 | Date: Tue, 12 Sep 2023 16:07:18 +0100 | ||
1665 | Subject: [PATCH 13/19] aarch64: Minor initial adjustment tweak | ||
1666 | |||
1667 | This patch just changes a calculation of initial_adjust | ||
1668 | to one that makes it slightly more obvious that the total | ||
1669 | adjustment is frame.frame_size. | ||
1670 | |||
1671 | gcc/ | ||
1672 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Tweak | ||
1673 | calculation of initial_adjust for frames in which all saves | ||
1674 | are SVE saves. | ||
1675 | --- | ||
1676 | gcc/config/aarch64/aarch64.cc | 5 ++--- | ||
1677 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
1678 | |||
1679 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1680 | index 31b00094c2a..1aa79da0673 100644 | ||
1681 | --- a/gcc/config/aarch64/aarch64.cc | ||
1682 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1683 | @@ -8675,11 +8675,10 @@ aarch64_layout_frame (void) | ||
1684 | { | ||
1685 | /* Frame in which all saves are SVE saves: | ||
1686 | |||
1687 | - sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size | ||
1688 | + sub sp, sp, frame_size - bytes_below_saved_regs | ||
1689 | save SVE registers relative to SP | ||
1690 | sub sp, sp, bytes_below_saved_regs */ | ||
1691 | - frame.initial_adjust = (frame.bytes_above_hard_fp | ||
1692 | - + frame.below_hard_fp_saved_regs_size); | ||
1693 | + frame.initial_adjust = frame.frame_size - frame.bytes_below_saved_regs; | ||
1694 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
1695 | } | ||
1696 | else if (frame.bytes_above_hard_fp.is_constant (&const_above_fp) | ||
1697 | -- | ||
1698 | 2.34.1 | ||
1699 | |||
1700 | |||
1701 | From aaa1a0a5912d9e5d571e5f1c6f09ceac99544ab5 Mon Sep 17 00:00:00 2001 | ||
1702 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1703 | Date: Tue, 12 Sep 2023 16:07:18 +0100 | ||
1704 | Subject: [PATCH 14/19] aarch64: Tweak stack clash boundary condition | ||
1705 | |||
1706 | The AArch64 ABI says that, when stack clash protection is used, | ||
1707 | there can be a maximum of 1KiB of unprobed space at sp on entry | ||
1708 | to a function. Therefore, we need to probe when allocating | ||
1709 | >= guard_size - 1KiB of data (>= rather than >). This is what | ||
1710 | GCC does. | ||
1711 | |||
1712 | If an allocation is exactly guard_size bytes, it is enough to allocate | ||
1713 | those bytes and probe once at offset 1024. It isn't possible to use a | ||
1714 | single probe at any other offset: higher would conmplicate later code, | ||
1715 | by leaving more unprobed space than usual, while lower would risk | ||
1716 | leaving an entire page unprobed. For simplicity, the code probes all | ||
1717 | allocations at offset 1024. | ||
1718 | |||
1719 | Some register saves also act as probes. If we need to allocate | ||
1720 | more space below the last such register save probe, we need to | ||
1721 | probe the allocation if it is > 1KiB. Again, this allocation is | ||
1722 | then sometimes (but not always) probed at offset 1024. This sort of | ||
1723 | allocation is currently only used for outgoing arguments, which are | ||
1724 | rarely this big. | ||
1725 | |||
1726 | However, the code also probed if this final outgoing-arguments | ||
1727 | allocation was == 1KiB, rather than just > 1KiB. This isn't | ||
1728 | necessary, since the register save then probes at offset 1024 | ||
1729 | as required. Continuing to probe allocations of exactly 1KiB | ||
1730 | would complicate later patches. | ||
1731 | |||
1732 | gcc/ | ||
1733 | * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): | ||
1734 | Don't probe final allocations that are exactly 1KiB in size (after | ||
1735 | unprobed space above the final allocation has been deducted). | ||
1736 | |||
1737 | gcc/testsuite/ | ||
1738 | * gcc.target/aarch64/stack-check-prologue-17.c: New test. | ||
1739 | --- | ||
1740 | gcc/config/aarch64/aarch64.cc | 4 +- | ||
1741 | .../aarch64/stack-check-prologue-17.c | 55 +++++++++++++++++++ | ||
1742 | 2 files changed, 58 insertions(+), 1 deletion(-) | ||
1743 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
1744 | |||
1745 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1746 | index 1aa79da0673..5cad847977a 100644 | ||
1747 | --- a/gcc/config/aarch64/aarch64.cc | ||
1748 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1749 | @@ -9648,9 +9648,11 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
1750 | HOST_WIDE_INT guard_size | ||
1751 | = 1 << param_stack_clash_protection_guard_size; | ||
1752 | HOST_WIDE_INT guard_used_by_caller = STACK_CLASH_CALLER_GUARD; | ||
1753 | + HOST_WIDE_INT byte_sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT; | ||
1754 | + gcc_assert (multiple_p (poly_size, byte_sp_alignment)); | ||
1755 | HOST_WIDE_INT min_probe_threshold | ||
1756 | = (final_adjustment_p | ||
1757 | - ? guard_used_by_caller | ||
1758 | + ? guard_used_by_caller + byte_sp_alignment | ||
1759 | : guard_size - guard_used_by_caller); | ||
1760 | /* When doing the final adjustment for the outgoing arguments, take into | ||
1761 | account any unprobed space there is above the current SP. There are | ||
1762 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
1763 | new file mode 100644 | ||
1764 | index 00000000000..0d8a25d73a2 | ||
1765 | --- /dev/null | ||
1766 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
1767 | @@ -0,0 +1,55 @@ | ||
1768 | +/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */ | ||
1769 | +/* { dg-final { check-function-bodies "**" "" } } */ | ||
1770 | + | ||
1771 | +void f(int, ...); | ||
1772 | +void g(); | ||
1773 | + | ||
1774 | +/* | ||
1775 | +** test1: | ||
1776 | +** ... | ||
1777 | +** str x30, \[sp\] | ||
1778 | +** sub sp, sp, #1024 | ||
1779 | +** cbnz w0, .* | ||
1780 | +** bl g | ||
1781 | +** ... | ||
1782 | +*/ | ||
1783 | +int test1(int z) { | ||
1784 | + __uint128_t x = 0; | ||
1785 | + int y[0x400]; | ||
1786 | + if (z) | ||
1787 | + { | ||
1788 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
1789 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1790 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1791 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1792 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); | ||
1793 | + } | ||
1794 | + g(); | ||
1795 | + return 1; | ||
1796 | +} | ||
1797 | + | ||
1798 | +/* | ||
1799 | +** test2: | ||
1800 | +** ... | ||
1801 | +** str x30, \[sp\] | ||
1802 | +** sub sp, sp, #1040 | ||
1803 | +** str xzr, \[sp\] | ||
1804 | +** cbnz w0, .* | ||
1805 | +** bl g | ||
1806 | +** ... | ||
1807 | +*/ | ||
1808 | +int test2(int z) { | ||
1809 | + __uint128_t x = 0; | ||
1810 | + int y[0x400]; | ||
1811 | + if (z) | ||
1812 | + { | ||
1813 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
1814 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1815 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1816 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1817 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
1818 | + x); | ||
1819 | + } | ||
1820 | + g(); | ||
1821 | + return 1; | ||
1822 | +} | ||
1823 | -- | ||
1824 | 2.34.1 | ||
1825 | |||
1826 | |||
1827 | From 8433953434a7b58c0923140d39eb3c5988c1d097 Mon Sep 17 00:00:00 2001 | ||
1828 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
1829 | Date: Tue, 12 Sep 2023 16:07:19 +0100 | ||
1830 | Subject: [PATCH 15/19] aarch64: Put LR save probe in first 16 bytes | ||
1831 | |||
1832 | -fstack-clash-protection uses the save of LR as a probe for the next | ||
1833 | allocation. The next allocation could be: | ||
1834 | |||
1835 | * another part of the static frame, e.g. when allocating SVE save slots | ||
1836 | or outgoing arguments | ||
1837 | |||
1838 | * an alloca in the same function | ||
1839 | |||
1840 | * an allocation made by a callee function | ||
1841 | |||
1842 | However, when -fomit-frame-pointer is used, the LR save slot is placed | ||
1843 | above the other GPR save slots. It could therefore be up to 80 bytes | ||
1844 | above the base of the GPR save area (which is also the hard fp address). | ||
1845 | |||
1846 | aarch64_allocate_and_probe_stack_space took this into account when | ||
1847 | deciding how much subsequent space could be allocated without needing | ||
1848 | a probe. However, it interacted badly with: | ||
1849 | |||
1850 | /* If doing a small final adjustment, we always probe at offset 0. | ||
1851 | This is done to avoid issues when LR is not at position 0 or when | ||
1852 | the final adjustment is smaller than the probing offset. */ | ||
1853 | else if (final_adjustment_p && rounded_size == 0) | ||
1854 | residual_probe_offset = 0; | ||
1855 | |||
1856 | which forces any allocation that is smaller than the guard page size | ||
1857 | to be probed at offset 0 rather than the usual offset 1024. It was | ||
1858 | therefore possible to construct cases in which we had: | ||
1859 | |||
1860 | * a probe using LR at SP + 80 bytes (or some other value >= 16) | ||
1861 | * an allocation of the guard page size - 16 bytes | ||
1862 | * a probe at SP + 0 | ||
1863 | |||
1864 | which allocates guard page size + 64 consecutive unprobed bytes. | ||
1865 | |||
1866 | This patch requires the LR probe to be in the first 16 bytes of the | ||
1867 | save area when stack clash protection is active. Doing it | ||
1868 | unconditionally would cause code-quality regressions. | ||
1869 | |||
1870 | Putting LR before other registers prevents push/pop allocation | ||
1871 | when shadow call stacks are enabled, since LR is restored | ||
1872 | separately from the other callee-saved registers. | ||
1873 | |||
1874 | The new comment doesn't say that the probe register is required | ||
1875 | to be LR, since a later patch removes that restriction. | ||
1876 | |||
1877 | gcc/ | ||
1878 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Ensure that | ||
1879 | the LR save slot is in the first 16 bytes of the register save area. | ||
1880 | Only form STP/LDP push/pop candidates if both registers are valid. | ||
1881 | (aarch64_allocate_and_probe_stack_space): Remove workaround for | ||
1882 | when LR was not in the first 16 bytes. | ||
1883 | |||
1884 | gcc/testsuite/ | ||
1885 | * gcc.target/aarch64/stack-check-prologue-18.c: New test. | ||
1886 | * gcc.target/aarch64/stack-check-prologue-19.c: Likewise. | ||
1887 | * gcc.target/aarch64/stack-check-prologue-20.c: Likewise. | ||
1888 | --- | ||
1889 | gcc/config/aarch64/aarch64.cc | 72 ++++++------- | ||
1890 | .../aarch64/stack-check-prologue-18.c | 100 ++++++++++++++++++ | ||
1891 | .../aarch64/stack-check-prologue-19.c | 100 ++++++++++++++++++ | ||
1892 | .../aarch64/stack-check-prologue-20.c | 3 + | ||
1893 | 4 files changed, 233 insertions(+), 42 deletions(-) | ||
1894 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
1895 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
1896 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c | ||
1897 | |||
1898 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
1899 | index 5cad847977a..a765f92329d 100644 | ||
1900 | --- a/gcc/config/aarch64/aarch64.cc | ||
1901 | +++ b/gcc/config/aarch64/aarch64.cc | ||
1902 | @@ -8534,26 +8534,34 @@ aarch64_layout_frame (void) | ||
1903 | bool saves_below_hard_fp_p | ||
1904 | = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); | ||
1905 | frame.bytes_below_hard_fp = offset; | ||
1906 | + | ||
1907 | + auto allocate_gpr_slot = [&](unsigned int regno) | ||
1908 | + { | ||
1909 | + frame.reg_offset[regno] = offset; | ||
1910 | + if (frame.wb_push_candidate1 == INVALID_REGNUM) | ||
1911 | + frame.wb_push_candidate1 = regno; | ||
1912 | + else if (frame.wb_push_candidate2 == INVALID_REGNUM) | ||
1913 | + frame.wb_push_candidate2 = regno; | ||
1914 | + offset += UNITS_PER_WORD; | ||
1915 | + }; | ||
1916 | + | ||
1917 | if (frame.emit_frame_chain) | ||
1918 | { | ||
1919 | /* FP and LR are placed in the linkage record. */ | ||
1920 | - frame.reg_offset[R29_REGNUM] = offset; | ||
1921 | - frame.wb_push_candidate1 = R29_REGNUM; | ||
1922 | - frame.reg_offset[R30_REGNUM] = offset + UNITS_PER_WORD; | ||
1923 | - frame.wb_push_candidate2 = R30_REGNUM; | ||
1924 | - offset += 2 * UNITS_PER_WORD; | ||
1925 | + allocate_gpr_slot (R29_REGNUM); | ||
1926 | + allocate_gpr_slot (R30_REGNUM); | ||
1927 | } | ||
1928 | + else if (flag_stack_clash_protection | ||
1929 | + && known_eq (frame.reg_offset[R30_REGNUM], SLOT_REQUIRED)) | ||
1930 | + /* Put the LR save slot first, since it makes a good choice of probe | ||
1931 | + for stack clash purposes. The idea is that the link register usually | ||
1932 | + has to be saved before a call anyway, and so we lose little by | ||
1933 | + stopping it from being individually shrink-wrapped. */ | ||
1934 | + allocate_gpr_slot (R30_REGNUM); | ||
1935 | |||
1936 | for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) | ||
1937 | if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) | ||
1938 | - { | ||
1939 | - frame.reg_offset[regno] = offset; | ||
1940 | - if (frame.wb_push_candidate1 == INVALID_REGNUM) | ||
1941 | - frame.wb_push_candidate1 = regno; | ||
1942 | - else if (frame.wb_push_candidate2 == INVALID_REGNUM) | ||
1943 | - frame.wb_push_candidate2 = regno; | ||
1944 | - offset += UNITS_PER_WORD; | ||
1945 | - } | ||
1946 | + allocate_gpr_slot (regno); | ||
1947 | |||
1948 | poly_int64 max_int_offset = offset; | ||
1949 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
1950 | @@ -8631,10 +8639,13 @@ aarch64_layout_frame (void) | ||
1951 | max_push_offset to 0, because no registers are popped at this time, | ||
1952 | so callee_adjust cannot be adjusted. */ | ||
1953 | HOST_WIDE_INT max_push_offset = 0; | ||
1954 | - if (frame.wb_pop_candidate2 != INVALID_REGNUM) | ||
1955 | - max_push_offset = 512; | ||
1956 | - else if (frame.wb_pop_candidate1 != INVALID_REGNUM) | ||
1957 | - max_push_offset = 256; | ||
1958 | + if (frame.wb_pop_candidate1 != INVALID_REGNUM) | ||
1959 | + { | ||
1960 | + if (frame.wb_pop_candidate2 != INVALID_REGNUM) | ||
1961 | + max_push_offset = 512; | ||
1962 | + else | ||
1963 | + max_push_offset = 256; | ||
1964 | + } | ||
1965 | |||
1966 | HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; | ||
1967 | HOST_WIDE_INT const_saved_regs_size; | ||
1968 | @@ -9654,29 +9665,6 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
1969 | = (final_adjustment_p | ||
1970 | ? guard_used_by_caller + byte_sp_alignment | ||
1971 | : guard_size - guard_used_by_caller); | ||
1972 | - /* When doing the final adjustment for the outgoing arguments, take into | ||
1973 | - account any unprobed space there is above the current SP. There are | ||
1974 | - two cases: | ||
1975 | - | ||
1976 | - - When saving SVE registers below the hard frame pointer, we force | ||
1977 | - the lowest save to take place in the prologue before doing the final | ||
1978 | - adjustment (i.e. we don't allow the save to be shrink-wrapped). | ||
1979 | - This acts as a probe at SP, so there is no unprobed space. | ||
1980 | - | ||
1981 | - - When there are no SVE register saves, we use the store of the link | ||
1982 | - register as a probe. We can't assume that LR was saved at position 0 | ||
1983 | - though, so treat any space below it as unprobed. */ | ||
1984 | - if (final_adjustment_p | ||
1985 | - && known_eq (frame.below_hard_fp_saved_regs_size, 0)) | ||
1986 | - { | ||
1987 | - poly_int64 lr_offset = (frame.reg_offset[LR_REGNUM] | ||
1988 | - - frame.bytes_below_saved_regs); | ||
1989 | - if (known_ge (lr_offset, 0)) | ||
1990 | - min_probe_threshold -= lr_offset.to_constant (); | ||
1991 | - else | ||
1992 | - gcc_assert (!flag_stack_clash_protection || known_eq (poly_size, 0)); | ||
1993 | - } | ||
1994 | - | ||
1995 | poly_int64 frame_size = frame.frame_size; | ||
1996 | |||
1997 | /* We should always have a positive probe threshold. */ | ||
1998 | @@ -9856,8 +9844,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
1999 | if (final_adjustment_p && rounded_size != 0) | ||
2000 | min_probe_threshold = 0; | ||
2001 | /* If doing a small final adjustment, we always probe at offset 0. | ||
2002 | - This is done to avoid issues when LR is not at position 0 or when | ||
2003 | - the final adjustment is smaller than the probing offset. */ | ||
2004 | + This is done to avoid issues when the final adjustment is smaller | ||
2005 | + than the probing offset. */ | ||
2006 | else if (final_adjustment_p && rounded_size == 0) | ||
2007 | residual_probe_offset = 0; | ||
2008 | |||
2009 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
2010 | new file mode 100644 | ||
2011 | index 00000000000..82447d20fff | ||
2012 | --- /dev/null | ||
2013 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
2014 | @@ -0,0 +1,100 @@ | ||
2015 | +/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */ | ||
2016 | +/* { dg-final { check-function-bodies "**" "" } } */ | ||
2017 | + | ||
2018 | +void f(int, ...); | ||
2019 | +void g(); | ||
2020 | + | ||
2021 | +/* | ||
2022 | +** test1: | ||
2023 | +** ... | ||
2024 | +** str x30, \[sp\] | ||
2025 | +** sub sp, sp, #4064 | ||
2026 | +** str xzr, \[sp\] | ||
2027 | +** cbnz w0, .* | ||
2028 | +** bl g | ||
2029 | +** ... | ||
2030 | +** str x26, \[sp, #?4128\] | ||
2031 | +** ... | ||
2032 | +*/ | ||
2033 | +int test1(int z) { | ||
2034 | + __uint128_t x = 0; | ||
2035 | + int y[0x400]; | ||
2036 | + if (z) | ||
2037 | + { | ||
2038 | + asm volatile ("" ::: | ||
2039 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2040 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2041 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2042 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2043 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2044 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2045 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2046 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2047 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2048 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2049 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2050 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2051 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2052 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2053 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2054 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2055 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2056 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x); | ||
2057 | + } | ||
2058 | + g(); | ||
2059 | + return 1; | ||
2060 | +} | ||
2061 | + | ||
2062 | +/* | ||
2063 | +** test2: | ||
2064 | +** ... | ||
2065 | +** str x30, \[sp\] | ||
2066 | +** sub sp, sp, #1040 | ||
2067 | +** str xzr, \[sp\] | ||
2068 | +** cbnz w0, .* | ||
2069 | +** bl g | ||
2070 | +** ... | ||
2071 | +*/ | ||
2072 | +int test2(int z) { | ||
2073 | + __uint128_t x = 0; | ||
2074 | + int y[0x400]; | ||
2075 | + if (z) | ||
2076 | + { | ||
2077 | + asm volatile ("" ::: | ||
2078 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2079 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2080 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2081 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2082 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2083 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2084 | + x); | ||
2085 | + } | ||
2086 | + g(); | ||
2087 | + return 1; | ||
2088 | +} | ||
2089 | + | ||
2090 | +/* | ||
2091 | +** test3: | ||
2092 | +** ... | ||
2093 | +** str x30, \[sp\] | ||
2094 | +** sub sp, sp, #1024 | ||
2095 | +** cbnz w0, .* | ||
2096 | +** bl g | ||
2097 | +** ... | ||
2098 | +*/ | ||
2099 | +int test3(int z) { | ||
2100 | + __uint128_t x = 0; | ||
2101 | + int y[0x400]; | ||
2102 | + if (z) | ||
2103 | + { | ||
2104 | + asm volatile ("" ::: | ||
2105 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2106 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2107 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2108 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2109 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2110 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); | ||
2111 | + } | ||
2112 | + g(); | ||
2113 | + return 1; | ||
2114 | +} | ||
2115 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
2116 | new file mode 100644 | ||
2117 | index 00000000000..73ac3e4e4eb | ||
2118 | --- /dev/null | ||
2119 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
2120 | @@ -0,0 +1,100 @@ | ||
2121 | +/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fsanitize=shadow-call-stack -ffixed-x18" } */ | ||
2122 | +/* { dg-final { check-function-bodies "**" "" } } */ | ||
2123 | + | ||
2124 | +void f(int, ...); | ||
2125 | +void g(); | ||
2126 | + | ||
2127 | +/* | ||
2128 | +** test1: | ||
2129 | +** ... | ||
2130 | +** str x30, \[sp\] | ||
2131 | +** sub sp, sp, #4064 | ||
2132 | +** str xzr, \[sp\] | ||
2133 | +** cbnz w0, .* | ||
2134 | +** bl g | ||
2135 | +** ... | ||
2136 | +** str x26, \[sp, #?4128\] | ||
2137 | +** ... | ||
2138 | +*/ | ||
2139 | +int test1(int z) { | ||
2140 | + __uint128_t x = 0; | ||
2141 | + int y[0x400]; | ||
2142 | + if (z) | ||
2143 | + { | ||
2144 | + asm volatile ("" ::: | ||
2145 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2146 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2147 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2148 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2149 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2150 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2151 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2152 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2153 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2154 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2155 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2156 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2157 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2158 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2159 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2160 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2161 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2162 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x); | ||
2163 | + } | ||
2164 | + g(); | ||
2165 | + return 1; | ||
2166 | +} | ||
2167 | + | ||
2168 | +/* | ||
2169 | +** test2: | ||
2170 | +** ... | ||
2171 | +** str x30, \[sp\] | ||
2172 | +** sub sp, sp, #1040 | ||
2173 | +** str xzr, \[sp\] | ||
2174 | +** cbnz w0, .* | ||
2175 | +** bl g | ||
2176 | +** ... | ||
2177 | +*/ | ||
2178 | +int test2(int z) { | ||
2179 | + __uint128_t x = 0; | ||
2180 | + int y[0x400]; | ||
2181 | + if (z) | ||
2182 | + { | ||
2183 | + asm volatile ("" ::: | ||
2184 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2185 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2186 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2187 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2188 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2189 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2190 | + x); | ||
2191 | + } | ||
2192 | + g(); | ||
2193 | + return 1; | ||
2194 | +} | ||
2195 | + | ||
2196 | +/* | ||
2197 | +** test3: | ||
2198 | +** ... | ||
2199 | +** str x30, \[sp\] | ||
2200 | +** sub sp, sp, #1024 | ||
2201 | +** cbnz w0, .* | ||
2202 | +** bl g | ||
2203 | +** ... | ||
2204 | +*/ | ||
2205 | +int test3(int z) { | ||
2206 | + __uint128_t x = 0; | ||
2207 | + int y[0x400]; | ||
2208 | + if (z) | ||
2209 | + { | ||
2210 | + asm volatile ("" ::: | ||
2211 | + "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); | ||
2212 | + f(0, 0, 0, 0, 0, 0, 0, &y, | ||
2213 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2214 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2215 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, | ||
2216 | + x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); | ||
2217 | + } | ||
2218 | + g(); | ||
2219 | + return 1; | ||
2220 | +} | ||
2221 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c | ||
2222 | new file mode 100644 | ||
2223 | index 00000000000..690aae8dfd5 | ||
2224 | --- /dev/null | ||
2225 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c | ||
2226 | @@ -0,0 +1,3 @@ | ||
2227 | +/* { dg-options "-O2 -fstack-protector-all -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fsanitize=shadow-call-stack -ffixed-x18" } */ | ||
2228 | + | ||
2229 | +#include "stack-check-prologue-19.c" | ||
2230 | -- | ||
2231 | 2.34.1 | ||
2232 | |||
2233 | |||
2234 | From eea1759073e09dd1aefbc9a881601ab1eebfdd18 Mon Sep 17 00:00:00 2001 | ||
2235 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
2236 | Date: Tue, 12 Sep 2023 16:07:19 +0100 | ||
2237 | Subject: [PATCH 16/19] aarch64: Simplify probe of final frame allocation | ||
2238 | |||
2239 | Previous patches ensured that the final frame allocation only needs | ||
2240 | a probe when the size is strictly greater than 1KiB. It's therefore | ||
2241 | safe to use the normal 1024 probe offset in all cases. | ||
2242 | |||
2243 | The main motivation for doing this is to simplify the code and | ||
2244 | remove the number of special cases. | ||
2245 | |||
2246 | gcc/ | ||
2247 | * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): | ||
2248 | Always probe the residual allocation at offset 1024, asserting | ||
2249 | that that is in range. | ||
2250 | |||
2251 | gcc/testsuite/ | ||
2252 | * gcc.target/aarch64/stack-check-prologue-17.c: Expect the probe | ||
2253 | to be at offset 1024 rather than offset 0. | ||
2254 | * gcc.target/aarch64/stack-check-prologue-18.c: Likewise. | ||
2255 | * gcc.target/aarch64/stack-check-prologue-19.c: Likewise. | ||
2256 | --- | ||
2257 | gcc/config/aarch64/aarch64.cc | 12 ++++-------- | ||
2258 | .../gcc.target/aarch64/stack-check-prologue-17.c | 2 +- | ||
2259 | .../gcc.target/aarch64/stack-check-prologue-18.c | 4 ++-- | ||
2260 | .../gcc.target/aarch64/stack-check-prologue-19.c | 4 ++-- | ||
2261 | 4 files changed, 9 insertions(+), 13 deletions(-) | ||
2262 | |||
2263 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
2264 | index a765f92329d..37809a306f7 100644 | ||
2265 | --- a/gcc/config/aarch64/aarch64.cc | ||
2266 | +++ b/gcc/config/aarch64/aarch64.cc | ||
2267 | @@ -9838,16 +9838,12 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
2268 | are still safe. */ | ||
2269 | if (residual) | ||
2270 | { | ||
2271 | - HOST_WIDE_INT residual_probe_offset = guard_used_by_caller; | ||
2272 | + gcc_assert (guard_used_by_caller + byte_sp_alignment <= size); | ||
2273 | + | ||
2274 | /* If we're doing final adjustments, and we've done any full page | ||
2275 | allocations then any residual needs to be probed. */ | ||
2276 | if (final_adjustment_p && rounded_size != 0) | ||
2277 | min_probe_threshold = 0; | ||
2278 | - /* If doing a small final adjustment, we always probe at offset 0. | ||
2279 | - This is done to avoid issues when the final adjustment is smaller | ||
2280 | - than the probing offset. */ | ||
2281 | - else if (final_adjustment_p && rounded_size == 0) | ||
2282 | - residual_probe_offset = 0; | ||
2283 | |||
2284 | aarch64_sub_sp (temp1, temp2, residual, frame_related_p); | ||
2285 | if (residual >= min_probe_threshold) | ||
2286 | @@ -9858,8 +9854,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, | ||
2287 | HOST_WIDE_INT_PRINT_DEC " bytes, probing will be required." | ||
2288 | "\n", residual); | ||
2289 | |||
2290 | - emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx, | ||
2291 | - residual_probe_offset)); | ||
2292 | + emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx, | ||
2293 | + guard_used_by_caller)); | ||
2294 | emit_insn (gen_blockage ()); | ||
2295 | } | ||
2296 | } | ||
2297 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
2298 | index 0d8a25d73a2..f0ec1389771 100644 | ||
2299 | --- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
2300 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | ||
2301 | @@ -33,7 +33,7 @@ int test1(int z) { | ||
2302 | ** ... | ||
2303 | ** str x30, \[sp\] | ||
2304 | ** sub sp, sp, #1040 | ||
2305 | -** str xzr, \[sp\] | ||
2306 | +** str xzr, \[sp, #?1024\] | ||
2307 | ** cbnz w0, .* | ||
2308 | ** bl g | ||
2309 | ** ... | ||
2310 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
2311 | index 82447d20fff..6383bec5ebc 100644 | ||
2312 | --- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
2313 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | ||
2314 | @@ -9,7 +9,7 @@ void g(); | ||
2315 | ** ... | ||
2316 | ** str x30, \[sp\] | ||
2317 | ** sub sp, sp, #4064 | ||
2318 | -** str xzr, \[sp\] | ||
2319 | +** str xzr, \[sp, #?1024\] | ||
2320 | ** cbnz w0, .* | ||
2321 | ** bl g | ||
2322 | ** ... | ||
2323 | @@ -50,7 +50,7 @@ int test1(int z) { | ||
2324 | ** ... | ||
2325 | ** str x30, \[sp\] | ||
2326 | ** sub sp, sp, #1040 | ||
2327 | -** str xzr, \[sp\] | ||
2328 | +** str xzr, \[sp, #?1024\] | ||
2329 | ** cbnz w0, .* | ||
2330 | ** bl g | ||
2331 | ** ... | ||
2332 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
2333 | index 73ac3e4e4eb..562039b5e9b 100644 | ||
2334 | --- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
2335 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c | ||
2336 | @@ -9,7 +9,7 @@ void g(); | ||
2337 | ** ... | ||
2338 | ** str x30, \[sp\] | ||
2339 | ** sub sp, sp, #4064 | ||
2340 | -** str xzr, \[sp\] | ||
2341 | +** str xzr, \[sp, #?1024\] | ||
2342 | ** cbnz w0, .* | ||
2343 | ** bl g | ||
2344 | ** ... | ||
2345 | @@ -50,7 +50,7 @@ int test1(int z) { | ||
2346 | ** ... | ||
2347 | ** str x30, \[sp\] | ||
2348 | ** sub sp, sp, #1040 | ||
2349 | -** str xzr, \[sp\] | ||
2350 | +** str xzr, \[sp, #?1024\] | ||
2351 | ** cbnz w0, .* | ||
2352 | ** bl g | ||
2353 | ** ... | ||
2354 | -- | ||
2355 | 2.34.1 | ||
2356 | |||
2357 | |||
2358 | From 96d85187c3b9c9a7efc2fd698c3d452e80d8aa47 Mon Sep 17 00:00:00 2001 | ||
2359 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
2360 | Date: Tue, 12 Sep 2023 16:07:20 +0100 | ||
2361 | Subject: [PATCH 17/19] aarch64: Explicitly record probe registers in frame | ||
2362 | info | ||
2363 | |||
2364 | The stack frame is currently divided into three areas: | ||
2365 | |||
2366 | A: the area above the hard frame pointer | ||
2367 | B: the SVE saves below the hard frame pointer | ||
2368 | C: the outgoing arguments | ||
2369 | |||
2370 | If the stack frame is allocated in one chunk, the allocation needs a | ||
2371 | probe if the frame size is >= guard_size - 1KiB. In addition, if the | ||
2372 | function is not a leaf function, it must probe an address no more than | ||
2373 | 1KiB above the outgoing SP. We ensured the second condition by | ||
2374 | |||
2375 | (1) using single-chunk allocations for non-leaf functions only if | ||
2376 | the link register save slot is within 512 bytes of the bottom | ||
2377 | of the frame; and | ||
2378 | |||
2379 | (2) using the link register save as a probe (meaning, for instance, | ||
2380 | that it can't be individually shrink wrapped) | ||
2381 | |||
2382 | If instead the stack is allocated in multiple chunks, then: | ||
2383 | |||
2384 | * an allocation involving only the outgoing arguments (C above) requires | ||
2385 | a probe if the allocation size is > 1KiB | ||
2386 | |||
2387 | * any other allocation requires a probe if the allocation size | ||
2388 | is >= guard_size - 1KiB | ||
2389 | |||
2390 | * second and subsequent allocations require the previous allocation | ||
2391 | to probe at the bottom of the allocated area, regardless of the size | ||
2392 | of that previous allocation | ||
2393 | |||
2394 | The final point means that, unlike for single allocations, | ||
2395 | it can be necessary to have both a non-SVE register probe and | ||
2396 | an SVE register probe. For example: | ||
2397 | |||
2398 | * allocate A, probe using a non-SVE register save | ||
2399 | * allocate B, probe using an SVE register save | ||
2400 | * allocate C | ||
2401 | |||
2402 | The non-SVE register used in this case was again the link register. | ||
2403 | It was previously used even if the link register save slot was some | ||
2404 | bytes above the bottom of the non-SVE register saves, but an earlier | ||
2405 | patch avoided that by putting the link register save slot first. | ||
2406 | |||
2407 | As a belt-and-braces fix, this patch explicitly records which | ||
2408 | probe registers we're using and allows the non-SVE probe to be | ||
2409 | whichever register comes first (as for SVE). | ||
2410 | |||
2411 | The patch also avoids unnecessary probes in sve/pcs/stack_clash_3.c. | ||
2412 | |||
2413 | gcc/ | ||
2414 | * config/aarch64/aarch64.h (aarch64_frame::sve_save_and_probe) | ||
2415 | (aarch64_frame::hard_fp_save_and_probe): New fields. | ||
2416 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize them. | ||
2417 | Rather than asserting that a leaf function saves LR, instead assert | ||
2418 | that a leaf function saves something. | ||
2419 | (aarch64_get_separate_components): Prevent the chosen probe | ||
2420 | registers from being individually shrink-wrapped. | ||
2421 | (aarch64_allocate_and_probe_stack_space): Remove workaround for | ||
2422 | probe registers that aren't at the bottom of the previous allocation. | ||
2423 | |||
2424 | gcc/testsuite/ | ||
2425 | * gcc.target/aarch64/sve/pcs/stack_clash_3.c: Avoid redundant probes. | ||
2426 | --- | ||
2427 | gcc/config/aarch64/aarch64.cc | 68 +++++++++++++++---- | ||
2428 | gcc/config/aarch64/aarch64.h | 8 +++ | ||
2429 | .../aarch64/sve/pcs/stack_clash_3.c | 6 +- | ||
2430 | 3 files changed, 64 insertions(+), 18 deletions(-) | ||
2431 | |||
2432 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
2433 | index 37809a306f7..6c59c39a639 100644 | ||
2434 | --- a/gcc/config/aarch64/aarch64.cc | ||
2435 | +++ b/gcc/config/aarch64/aarch64.cc | ||
2436 | @@ -8471,15 +8471,11 @@ aarch64_layout_frame (void) | ||
2437 | && !crtl->abi->clobbers_full_reg_p (regno)) | ||
2438 | frame.reg_offset[regno] = SLOT_REQUIRED; | ||
2439 | |||
2440 | - /* With stack-clash, LR must be saved in non-leaf functions. The saving of | ||
2441 | - LR counts as an implicit probe which allows us to maintain the invariant | ||
2442 | - described in the comment at expand_prologue. */ | ||
2443 | - gcc_assert (crtl->is_leaf | ||
2444 | - || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); | ||
2445 | |||
2446 | poly_int64 offset = crtl->outgoing_args_size; | ||
2447 | gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); | ||
2448 | frame.bytes_below_saved_regs = offset; | ||
2449 | + frame.sve_save_and_probe = INVALID_REGNUM; | ||
2450 | |||
2451 | /* Now assign stack slots for the registers. Start with the predicate | ||
2452 | registers, since predicate LDR and STR have a relatively small | ||
2453 | @@ -8487,6 +8483,8 @@ aarch64_layout_frame (void) | ||
2454 | for (regno = P0_REGNUM; regno <= P15_REGNUM; regno++) | ||
2455 | if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) | ||
2456 | { | ||
2457 | + if (frame.sve_save_and_probe == INVALID_REGNUM) | ||
2458 | + frame.sve_save_and_probe = regno; | ||
2459 | frame.reg_offset[regno] = offset; | ||
2460 | offset += BYTES_PER_SVE_PRED; | ||
2461 | } | ||
2462 | @@ -8524,6 +8522,8 @@ aarch64_layout_frame (void) | ||
2463 | for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) | ||
2464 | if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) | ||
2465 | { | ||
2466 | + if (frame.sve_save_and_probe == INVALID_REGNUM) | ||
2467 | + frame.sve_save_and_probe = regno; | ||
2468 | frame.reg_offset[regno] = offset; | ||
2469 | offset += vector_save_size; | ||
2470 | } | ||
2471 | @@ -8533,10 +8533,18 @@ aarch64_layout_frame (void) | ||
2472 | frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2473 | bool saves_below_hard_fp_p | ||
2474 | = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); | ||
2475 | + gcc_assert (!saves_below_hard_fp_p | ||
2476 | + || (frame.sve_save_and_probe != INVALID_REGNUM | ||
2477 | + && known_eq (frame.reg_offset[frame.sve_save_and_probe], | ||
2478 | + frame.bytes_below_saved_regs))); | ||
2479 | + | ||
2480 | frame.bytes_below_hard_fp = offset; | ||
2481 | + frame.hard_fp_save_and_probe = INVALID_REGNUM; | ||
2482 | |||
2483 | auto allocate_gpr_slot = [&](unsigned int regno) | ||
2484 | { | ||
2485 | + if (frame.hard_fp_save_and_probe == INVALID_REGNUM) | ||
2486 | + frame.hard_fp_save_and_probe = regno; | ||
2487 | frame.reg_offset[regno] = offset; | ||
2488 | if (frame.wb_push_candidate1 == INVALID_REGNUM) | ||
2489 | frame.wb_push_candidate1 = regno; | ||
2490 | @@ -8570,6 +8578,8 @@ aarch64_layout_frame (void) | ||
2491 | for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) | ||
2492 | if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) | ||
2493 | { | ||
2494 | + if (frame.hard_fp_save_and_probe == INVALID_REGNUM) | ||
2495 | + frame.hard_fp_save_and_probe = regno; | ||
2496 | /* If there is an alignment gap between integer and fp callee-saves, | ||
2497 | allocate the last fp register to it if possible. */ | ||
2498 | if (regno == last_fp_reg | ||
2499 | @@ -8593,6 +8603,17 @@ aarch64_layout_frame (void) | ||
2500 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2501 | |||
2502 | frame.saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2503 | + gcc_assert (known_eq (frame.saved_regs_size, | ||
2504 | + frame.below_hard_fp_saved_regs_size) | ||
2505 | + || (frame.hard_fp_save_and_probe != INVALID_REGNUM | ||
2506 | + && known_eq (frame.reg_offset[frame.hard_fp_save_and_probe], | ||
2507 | + frame.bytes_below_hard_fp))); | ||
2508 | + | ||
2509 | + /* With stack-clash, a register must be saved in non-leaf functions. | ||
2510 | + The saving of the bottommost register counts as an implicit probe, | ||
2511 | + which allows us to maintain the invariant described in the comment | ||
2512 | + at expand_prologue. */ | ||
2513 | + gcc_assert (crtl->is_leaf || maybe_ne (frame.saved_regs_size, 0)); | ||
2514 | |||
2515 | offset += get_frame_size (); | ||
2516 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2517 | @@ -8723,6 +8744,25 @@ aarch64_layout_frame (void) | ||
2518 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
2519 | } | ||
2520 | |||
2521 | + /* The frame is allocated in pieces, with each non-final piece | ||
2522 | + including a register save at offset 0 that acts as a probe for | ||
2523 | + the following piece. In addition, the save of the bottommost register | ||
2524 | + acts as a probe for callees and allocas. Roll back any probes that | ||
2525 | + aren't needed. | ||
2526 | + | ||
2527 | + A probe isn't needed if it is associated with the final allocation | ||
2528 | + (including callees and allocas) that happens before the epilogue is | ||
2529 | + executed. */ | ||
2530 | + if (crtl->is_leaf | ||
2531 | + && !cfun->calls_alloca | ||
2532 | + && known_eq (frame.final_adjust, 0)) | ||
2533 | + { | ||
2534 | + if (maybe_ne (frame.sve_callee_adjust, 0)) | ||
2535 | + frame.sve_save_and_probe = INVALID_REGNUM; | ||
2536 | + else | ||
2537 | + frame.hard_fp_save_and_probe = INVALID_REGNUM; | ||
2538 | + } | ||
2539 | + | ||
2540 | /* Make sure the individual adjustments add up to the full frame size. */ | ||
2541 | gcc_assert (known_eq (frame.initial_adjust | ||
2542 | + frame.callee_adjust | ||
2543 | @@ -9354,13 +9394,6 @@ aarch64_get_separate_components (void) | ||
2544 | |||
2545 | poly_int64 offset = frame.reg_offset[regno]; | ||
2546 | |||
2547 | - /* If the register is saved in the first SVE save slot, we use | ||
2548 | - it as a stack probe for -fstack-clash-protection. */ | ||
2549 | - if (flag_stack_clash_protection | ||
2550 | - && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) | ||
2551 | - && known_eq (offset, frame.bytes_below_saved_regs)) | ||
2552 | - continue; | ||
2553 | - | ||
2554 | /* Get the offset relative to the register we'll use. */ | ||
2555 | if (frame_pointer_needed) | ||
2556 | offset -= frame.bytes_below_hard_fp; | ||
2557 | @@ -9395,6 +9428,13 @@ aarch64_get_separate_components (void) | ||
2558 | |||
2559 | bitmap_clear_bit (components, LR_REGNUM); | ||
2560 | bitmap_clear_bit (components, SP_REGNUM); | ||
2561 | + if (flag_stack_clash_protection) | ||
2562 | + { | ||
2563 | + if (frame.sve_save_and_probe != INVALID_REGNUM) | ||
2564 | + bitmap_clear_bit (components, frame.sve_save_and_probe); | ||
2565 | + if (frame.hard_fp_save_and_probe != INVALID_REGNUM) | ||
2566 | + bitmap_clear_bit (components, frame.hard_fp_save_and_probe); | ||
2567 | + } | ||
2568 | |||
2569 | return components; | ||
2570 | } | ||
2571 | @@ -9931,8 +9971,8 @@ aarch64_epilogue_uses (int regno) | ||
2572 | When probing is needed, we emit a probe at the start of the prologue | ||
2573 | and every PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE bytes thereafter. | ||
2574 | |||
2575 | - We have to track how much space has been allocated and the only stores | ||
2576 | - to the stack we track as implicit probes are the FP/LR stores. | ||
2577 | + We can also use register saves as probes. These are stored in | ||
2578 | + sve_save_and_probe and hard_fp_save_and_probe. | ||
2579 | |||
2580 | For outgoing arguments we probe if the size is larger than 1KB, such that | ||
2581 | the ABI specified buffer is maintained for the next callee. | ||
2582 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
2583 | index c8becb098c8..fbfb73545ba 100644 | ||
2584 | --- a/gcc/config/aarch64/aarch64.h | ||
2585 | +++ b/gcc/config/aarch64/aarch64.h | ||
2586 | @@ -863,6 +863,14 @@ struct GTY (()) aarch64_frame | ||
2587 | This is the register they should use. */ | ||
2588 | unsigned spare_pred_reg; | ||
2589 | |||
2590 | + /* An SVE register that is saved below the hard frame pointer and that acts | ||
2591 | + as a probe for later allocations, or INVALID_REGNUM if none. */ | ||
2592 | + unsigned sve_save_and_probe; | ||
2593 | + | ||
2594 | + /* A register that is saved at the hard frame pointer and that acts | ||
2595 | + as a probe for later allocations, or INVALID_REGNUM if none. */ | ||
2596 | + unsigned hard_fp_save_and_probe; | ||
2597 | + | ||
2598 | bool laid_out; | ||
2599 | |||
2600 | /* True if shadow call stack should be enabled for the current function. */ | ||
2601 | diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c | ||
2602 | index 3e01ec36c3a..3530a0d504b 100644 | ||
2603 | --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c | ||
2604 | +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c | ||
2605 | @@ -11,11 +11,10 @@ | ||
2606 | ** mov x11, sp | ||
2607 | ** ... | ||
2608 | ** sub sp, sp, x13 | ||
2609 | -** str p4, \[sp\] | ||
2610 | ** cbz w0, [^\n]* | ||
2611 | +** str p4, \[sp\] | ||
2612 | ** ... | ||
2613 | ** ptrue p0\.b, all | ||
2614 | -** ldr p4, \[sp\] | ||
2615 | ** addvl sp, sp, #1 | ||
2616 | ** ldr x24, \[sp\], 32 | ||
2617 | ** ret | ||
2618 | @@ -39,13 +38,12 @@ test_1 (int n) | ||
2619 | ** mov x11, sp | ||
2620 | ** ... | ||
2621 | ** sub sp, sp, x13 | ||
2622 | -** str p4, \[sp\] | ||
2623 | ** cbz w0, [^\n]* | ||
2624 | +** str p4, \[sp\] | ||
2625 | ** str p5, \[sp, #1, mul vl\] | ||
2626 | ** str p6, \[sp, #2, mul vl\] | ||
2627 | ** ... | ||
2628 | ** ptrue p0\.b, all | ||
2629 | -** ldr p4, \[sp\] | ||
2630 | ** addvl sp, sp, #1 | ||
2631 | ** ldr x24, \[sp\], 32 | ||
2632 | ** ret | ||
2633 | -- | ||
2634 | 2.34.1 | ||
2635 | |||
2636 | |||
2637 | From 56df065080950bb30dda9c260f71be54269bdda5 Mon Sep 17 00:00:00 2001 | ||
2638 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
2639 | Date: Tue, 12 Sep 2023 16:07:20 +0100 | ||
2640 | Subject: [PATCH 18/19] aarch64: Remove below_hard_fp_saved_regs_size | ||
2641 | |||
2642 | After previous patches, it's no longer necessary to store | ||
2643 | saved_regs_size and below_hard_fp_saved_regs_size in the frame info. | ||
2644 | All measurements instead use the top or bottom of the frame as | ||
2645 | reference points. | ||
2646 | |||
2647 | gcc/ | ||
2648 | * config/aarch64/aarch64.h (aarch64_frame::saved_regs_size) | ||
2649 | (aarch64_frame::below_hard_fp_saved_regs_size): Delete. | ||
2650 | * config/aarch64/aarch64.cc (aarch64_layout_frame): Update accordingly. | ||
2651 | --- | ||
2652 | gcc/config/aarch64/aarch64.cc | 45 ++++++++++++++++------------------- | ||
2653 | gcc/config/aarch64/aarch64.h | 7 ------ | ||
2654 | 2 files changed, 21 insertions(+), 31 deletions(-) | ||
2655 | |||
2656 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
2657 | index 6c59c39a639..b95e805a8cc 100644 | ||
2658 | --- a/gcc/config/aarch64/aarch64.cc | ||
2659 | +++ b/gcc/config/aarch64/aarch64.cc | ||
2660 | @@ -8530,9 +8530,8 @@ aarch64_layout_frame (void) | ||
2661 | |||
2662 | /* OFFSET is now the offset of the hard frame pointer from the bottom | ||
2663 | of the callee save area. */ | ||
2664 | - frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2665 | - bool saves_below_hard_fp_p | ||
2666 | - = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); | ||
2667 | + auto below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2668 | + bool saves_below_hard_fp_p = maybe_ne (below_hard_fp_saved_regs_size, 0); | ||
2669 | gcc_assert (!saves_below_hard_fp_p | ||
2670 | || (frame.sve_save_and_probe != INVALID_REGNUM | ||
2671 | && known_eq (frame.reg_offset[frame.sve_save_and_probe], | ||
2672 | @@ -8602,9 +8601,8 @@ aarch64_layout_frame (void) | ||
2673 | |||
2674 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2675 | |||
2676 | - frame.saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2677 | - gcc_assert (known_eq (frame.saved_regs_size, | ||
2678 | - frame.below_hard_fp_saved_regs_size) | ||
2679 | + auto saved_regs_size = offset - frame.bytes_below_saved_regs; | ||
2680 | + gcc_assert (known_eq (saved_regs_size, below_hard_fp_saved_regs_size) | ||
2681 | || (frame.hard_fp_save_and_probe != INVALID_REGNUM | ||
2682 | && known_eq (frame.reg_offset[frame.hard_fp_save_and_probe], | ||
2683 | frame.bytes_below_hard_fp))); | ||
2684 | @@ -8613,7 +8611,7 @@ aarch64_layout_frame (void) | ||
2685 | The saving of the bottommost register counts as an implicit probe, | ||
2686 | which allows us to maintain the invariant described in the comment | ||
2687 | at expand_prologue. */ | ||
2688 | - gcc_assert (crtl->is_leaf || maybe_ne (frame.saved_regs_size, 0)); | ||
2689 | + gcc_assert (crtl->is_leaf || maybe_ne (saved_regs_size, 0)); | ||
2690 | |||
2691 | offset += get_frame_size (); | ||
2692 | offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2693 | @@ -8670,7 +8668,7 @@ aarch64_layout_frame (void) | ||
2694 | |||
2695 | HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; | ||
2696 | HOST_WIDE_INT const_saved_regs_size; | ||
2697 | - if (known_eq (frame.saved_regs_size, 0)) | ||
2698 | + if (known_eq (saved_regs_size, 0)) | ||
2699 | frame.initial_adjust = frame.frame_size; | ||
2700 | else if (frame.frame_size.is_constant (&const_size) | ||
2701 | && const_size < max_push_offset | ||
2702 | @@ -8683,7 +8681,7 @@ aarch64_layout_frame (void) | ||
2703 | frame.callee_adjust = const_size; | ||
2704 | } | ||
2705 | else if (frame.bytes_below_saved_regs.is_constant (&const_below_saved_regs) | ||
2706 | - && frame.saved_regs_size.is_constant (&const_saved_regs_size) | ||
2707 | + && saved_regs_size.is_constant (&const_saved_regs_size) | ||
2708 | && const_below_saved_regs + const_saved_regs_size < 512 | ||
2709 | /* We could handle this case even with data below the saved | ||
2710 | registers, provided that that data left us with valid offsets | ||
2711 | @@ -8702,8 +8700,7 @@ aarch64_layout_frame (void) | ||
2712 | frame.initial_adjust = frame.frame_size; | ||
2713 | } | ||
2714 | else if (saves_below_hard_fp_p | ||
2715 | - && known_eq (frame.saved_regs_size, | ||
2716 | - frame.below_hard_fp_saved_regs_size)) | ||
2717 | + && known_eq (saved_regs_size, below_hard_fp_saved_regs_size)) | ||
2718 | { | ||
2719 | /* Frame in which all saves are SVE saves: | ||
2720 | |||
2721 | @@ -8725,7 +8722,7 @@ aarch64_layout_frame (void) | ||
2722 | [save SVE registers relative to SP] | ||
2723 | sub sp, sp, bytes_below_saved_regs */ | ||
2724 | frame.callee_adjust = const_above_fp; | ||
2725 | - frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
2726 | + frame.sve_callee_adjust = below_hard_fp_saved_regs_size; | ||
2727 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
2728 | } | ||
2729 | else | ||
2730 | @@ -8740,7 +8737,7 @@ aarch64_layout_frame (void) | ||
2731 | [save SVE registers relative to SP] | ||
2732 | sub sp, sp, bytes_below_saved_regs */ | ||
2733 | frame.initial_adjust = frame.bytes_above_hard_fp; | ||
2734 | - frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; | ||
2735 | + frame.sve_callee_adjust = below_hard_fp_saved_regs_size; | ||
2736 | frame.final_adjust = frame.bytes_below_saved_regs; | ||
2737 | } | ||
2738 | |||
2739 | @@ -9936,17 +9933,17 @@ aarch64_epilogue_uses (int regno) | ||
2740 | | local variables | <-- frame_pointer_rtx | ||
2741 | | | | ||
2742 | +-------------------------------+ | ||
2743 | - | padding | \ | ||
2744 | - +-------------------------------+ | | ||
2745 | - | callee-saved registers | | frame.saved_regs_size | ||
2746 | - +-------------------------------+ | | ||
2747 | - | LR' | | | ||
2748 | - +-------------------------------+ | | ||
2749 | - | FP' | | | ||
2750 | - +-------------------------------+ |<- hard_frame_pointer_rtx (aligned) | ||
2751 | - | SVE vector registers | | \ | ||
2752 | - +-------------------------------+ | | below_hard_fp_saved_regs_size | ||
2753 | - | SVE predicate registers | / / | ||
2754 | + | padding | | ||
2755 | + +-------------------------------+ | ||
2756 | + | callee-saved registers | | ||
2757 | + +-------------------------------+ | ||
2758 | + | LR' | | ||
2759 | + +-------------------------------+ | ||
2760 | + | FP' | | ||
2761 | + +-------------------------------+ <-- hard_frame_pointer_rtx (aligned) | ||
2762 | + | SVE vector registers | | ||
2763 | + +-------------------------------+ | ||
2764 | + | SVE predicate registers | | ||
2765 | +-------------------------------+ | ||
2766 | | dynamic allocation | | ||
2767 | +-------------------------------+ | ||
2768 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h | ||
2769 | index fbfb73545ba..cfeaf4657ab 100644 | ||
2770 | --- a/gcc/config/aarch64/aarch64.h | ||
2771 | +++ b/gcc/config/aarch64/aarch64.h | ||
2772 | @@ -777,18 +777,11 @@ struct GTY (()) aarch64_frame | ||
2773 | STACK_BOUNDARY. */ | ||
2774 | HOST_WIDE_INT saved_varargs_size; | ||
2775 | |||
2776 | - /* The size of the callee-save registers with a slot in REG_OFFSET. */ | ||
2777 | - poly_int64 saved_regs_size; | ||
2778 | - | ||
2779 | /* The number of bytes between the bottom of the static frame (the bottom | ||
2780 | of the outgoing arguments) and the bottom of the register save area. | ||
2781 | This value is always a multiple of STACK_BOUNDARY. */ | ||
2782 | poly_int64 bytes_below_saved_regs; | ||
2783 | |||
2784 | - /* The size of the callee-save registers with a slot in REG_OFFSET that | ||
2785 | - are saved below the hard frame pointer. */ | ||
2786 | - poly_int64 below_hard_fp_saved_regs_size; | ||
2787 | - | ||
2788 | /* The number of bytes between the bottom of the static frame (the bottom | ||
2789 | of the outgoing arguments) and the hard frame pointer. This value is | ||
2790 | always a multiple of STACK_BOUNDARY. */ | ||
2791 | -- | ||
2792 | 2.34.1 | ||
2793 | |||
2794 | |||
2795 | From b96e66fd4ef3e36983969fb8cdd1956f551a074b Mon Sep 17 00:00:00 2001 | ||
2796 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
2797 | Date: Tue, 12 Sep 2023 16:07:21 +0100 | ||
2798 | Subject: [PATCH 19/19] aarch64: Make stack smash canary protect saved | ||
2799 | registers | ||
2800 | |||
2801 | AArch64 normally puts the saved registers near the bottom of the frame, | ||
2802 | immediately above any dynamic allocations. But this means that a | ||
2803 | stack-smash attack on those dynamic allocations could overwrite the | ||
2804 | saved registers without needing to reach as far as the stack smash | ||
2805 | canary. | ||
2806 | |||
2807 | The same thing could also happen for variable-sized arguments that are | ||
2808 | passed by value, since those are allocated before a call and popped on | ||
2809 | return. | ||
2810 | |||
2811 | This patch avoids that by putting the locals (and thus the canary) below | ||
2812 | the saved registers when stack smash protection is active. | ||
2813 | |||
2814 | The patch fixes CVE-2023-4039. | ||
2815 | |||
2816 | gcc/ | ||
2817 | * config/aarch64/aarch64.cc (aarch64_save_regs_above_locals_p): | ||
2818 | New function. | ||
2819 | (aarch64_layout_frame): Use it to decide whether locals should | ||
2820 | go above or below the saved registers. | ||
2821 | (aarch64_expand_prologue): Update stack layout comment. | ||
2822 | Emit a stack tie after the final adjustment. | ||
2823 | |||
2824 | gcc/testsuite/ | ||
2825 | * gcc.target/aarch64/stack-protector-8.c: New test. | ||
2826 | * gcc.target/aarch64/stack-protector-9.c: Likewise. | ||
2827 | --- | ||
2828 | gcc/config/aarch64/aarch64.cc | 46 +++++++-- | ||
2829 | .../gcc.target/aarch64/stack-protector-8.c | 95 +++++++++++++++++++ | ||
2830 | .../gcc.target/aarch64/stack-protector-9.c | 33 +++++++ | ||
2831 | 3 files changed, 168 insertions(+), 6 deletions(-) | ||
2832 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-8.c | ||
2833 | create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-9.c | ||
2834 | |||
2835 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
2836 | index b95e805a8cc..389c0e29353 100644 | ||
2837 | --- a/gcc/config/aarch64/aarch64.cc | ||
2838 | +++ b/gcc/config/aarch64/aarch64.cc | ||
2839 | @@ -8394,6 +8394,20 @@ aarch64_needs_frame_chain (void) | ||
2840 | return aarch64_use_frame_pointer; | ||
2841 | } | ||
2842 | |||
2843 | +/* Return true if the current function should save registers above | ||
2844 | + the locals area, rather than below it. */ | ||
2845 | + | ||
2846 | +static bool | ||
2847 | +aarch64_save_regs_above_locals_p () | ||
2848 | +{ | ||
2849 | + /* When using stack smash protection, make sure that the canary slot | ||
2850 | + comes between the locals and the saved registers. Otherwise, | ||
2851 | + it would be possible for a carefully sized smash attack to change | ||
2852 | + the saved registers (particularly LR and FP) without reaching the | ||
2853 | + canary. */ | ||
2854 | + return crtl->stack_protect_guard; | ||
2855 | +} | ||
2856 | + | ||
2857 | /* Mark the registers that need to be saved by the callee and calculate | ||
2858 | the size of the callee-saved registers area and frame record (both FP | ||
2859 | and LR may be omitted). */ | ||
2860 | @@ -8405,6 +8419,7 @@ aarch64_layout_frame (void) | ||
2861 | poly_int64 vector_save_size = GET_MODE_SIZE (vector_save_mode); | ||
2862 | bool frame_related_fp_reg_p = false; | ||
2863 | aarch64_frame &frame = cfun->machine->frame; | ||
2864 | + poly_int64 top_of_locals = -1; | ||
2865 | |||
2866 | frame.emit_frame_chain = aarch64_needs_frame_chain (); | ||
2867 | |||
2868 | @@ -8471,9 +8486,16 @@ aarch64_layout_frame (void) | ||
2869 | && !crtl->abi->clobbers_full_reg_p (regno)) | ||
2870 | frame.reg_offset[regno] = SLOT_REQUIRED; | ||
2871 | |||
2872 | + bool regs_at_top_p = aarch64_save_regs_above_locals_p (); | ||
2873 | |||
2874 | poly_int64 offset = crtl->outgoing_args_size; | ||
2875 | gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); | ||
2876 | + if (regs_at_top_p) | ||
2877 | + { | ||
2878 | + offset += get_frame_size (); | ||
2879 | + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2880 | + top_of_locals = offset; | ||
2881 | + } | ||
2882 | frame.bytes_below_saved_regs = offset; | ||
2883 | frame.sve_save_and_probe = INVALID_REGNUM; | ||
2884 | |||
2885 | @@ -8613,15 +8635,18 @@ aarch64_layout_frame (void) | ||
2886 | at expand_prologue. */ | ||
2887 | gcc_assert (crtl->is_leaf || maybe_ne (saved_regs_size, 0)); | ||
2888 | |||
2889 | - offset += get_frame_size (); | ||
2890 | - offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2891 | - auto top_of_locals = offset; | ||
2892 | - | ||
2893 | + if (!regs_at_top_p) | ||
2894 | + { | ||
2895 | + offset += get_frame_size (); | ||
2896 | + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); | ||
2897 | + top_of_locals = offset; | ||
2898 | + } | ||
2899 | offset += frame.saved_varargs_size; | ||
2900 | gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); | ||
2901 | frame.frame_size = offset; | ||
2902 | |||
2903 | frame.bytes_above_hard_fp = frame.frame_size - frame.bytes_below_hard_fp; | ||
2904 | + gcc_assert (known_ge (top_of_locals, 0)); | ||
2905 | frame.bytes_above_locals = frame.frame_size - top_of_locals; | ||
2906 | |||
2907 | frame.initial_adjust = 0; | ||
2908 | @@ -9930,10 +9955,10 @@ aarch64_epilogue_uses (int regno) | ||
2909 | | for register varargs | | ||
2910 | | | | ||
2911 | +-------------------------------+ | ||
2912 | - | local variables | <-- frame_pointer_rtx | ||
2913 | + | local variables (1) | <-- frame_pointer_rtx | ||
2914 | | | | ||
2915 | +-------------------------------+ | ||
2916 | - | padding | | ||
2917 | + | padding (1) | | ||
2918 | +-------------------------------+ | ||
2919 | | callee-saved registers | | ||
2920 | +-------------------------------+ | ||
2921 | @@ -9945,6 +9970,10 @@ aarch64_epilogue_uses (int regno) | ||
2922 | +-------------------------------+ | ||
2923 | | SVE predicate registers | | ||
2924 | +-------------------------------+ | ||
2925 | + | local variables (2) | | ||
2926 | + +-------------------------------+ | ||
2927 | + | padding (2) | | ||
2928 | + +-------------------------------+ | ||
2929 | | dynamic allocation | | ||
2930 | +-------------------------------+ | ||
2931 | | padding | | ||
2932 | @@ -9954,6 +9983,9 @@ aarch64_epilogue_uses (int regno) | ||
2933 | +-------------------------------+ | ||
2934 | | | <-- stack_pointer_rtx (aligned) | ||
2935 | |||
2936 | + The regions marked (1) and (2) are mutually exclusive. (2) is used | ||
2937 | + when aarch64_save_regs_above_locals_p is true. | ||
2938 | + | ||
2939 | Dynamic stack allocations via alloca() decrease stack_pointer_rtx | ||
2940 | but leave frame_pointer_rtx and hard_frame_pointer_rtx | ||
2941 | unchanged. | ||
2942 | @@ -10149,6 +10181,8 @@ aarch64_expand_prologue (void) | ||
2943 | gcc_assert (known_eq (bytes_below_sp, final_adjust)); | ||
2944 | aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, final_adjust, | ||
2945 | !frame_pointer_needed, true); | ||
2946 | + if (emit_frame_chain && maybe_ne (final_adjust, 0)) | ||
2947 | + emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx)); | ||
2948 | } | ||
2949 | |||
2950 | /* Return TRUE if we can use a simple_return insn. | ||
2951 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c | ||
2952 | new file mode 100644 | ||
2953 | index 00000000000..e71d820e365 | ||
2954 | --- /dev/null | ||
2955 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c | ||
2956 | @@ -0,0 +1,95 @@ | ||
2957 | +/* { dg-options " -O -fstack-protector-strong -mstack-protector-guard=sysreg -mstack-protector-guard-reg=tpidr2_el0 -mstack-protector-guard-offset=16" } */ | ||
2958 | +/* { dg-final { check-function-bodies "**" "" } } */ | ||
2959 | + | ||
2960 | +void g(void *); | ||
2961 | +__SVBool_t *h(void *); | ||
2962 | + | ||
2963 | +/* | ||
2964 | +** test1: | ||
2965 | +** sub sp, sp, #288 | ||
2966 | +** stp x29, x30, \[sp, #?272\] | ||
2967 | +** add x29, sp, #?272 | ||
2968 | +** mrs (x[0-9]+), tpidr2_el0 | ||
2969 | +** ldr (x[0-9]+), \[\1, #?16\] | ||
2970 | +** str \2, \[sp, #?264\] | ||
2971 | +** mov \2, #?0 | ||
2972 | +** add x0, sp, #?8 | ||
2973 | +** bl g | ||
2974 | +** ... | ||
2975 | +** mrs .* | ||
2976 | +** ... | ||
2977 | +** bne .* | ||
2978 | +** ... | ||
2979 | +** ldp x29, x30, \[sp, #?272\] | ||
2980 | +** add sp, sp, #?288 | ||
2981 | +** ret | ||
2982 | +** bl __stack_chk_fail | ||
2983 | +*/ | ||
2984 | +int test1() { | ||
2985 | + int y[0x40]; | ||
2986 | + g(y); | ||
2987 | + return 1; | ||
2988 | +} | ||
2989 | + | ||
2990 | +/* | ||
2991 | +** test2: | ||
2992 | +** stp x29, x30, \[sp, #?-16\]! | ||
2993 | +** mov x29, sp | ||
2994 | +** sub sp, sp, #1040 | ||
2995 | +** mrs (x[0-9]+), tpidr2_el0 | ||
2996 | +** ldr (x[0-9]+), \[\1, #?16\] | ||
2997 | +** str \2, \[sp, #?1032\] | ||
2998 | +** mov \2, #?0 | ||
2999 | +** add x0, sp, #?8 | ||
3000 | +** bl g | ||
3001 | +** ... | ||
3002 | +** mrs .* | ||
3003 | +** ... | ||
3004 | +** bne .* | ||
3005 | +** ... | ||
3006 | +** add sp, sp, #?1040 | ||
3007 | +** ldp x29, x30, \[sp\], #?16 | ||
3008 | +** ret | ||
3009 | +** bl __stack_chk_fail | ||
3010 | +*/ | ||
3011 | +int test2() { | ||
3012 | + int y[0x100]; | ||
3013 | + g(y); | ||
3014 | + return 1; | ||
3015 | +} | ||
3016 | + | ||
3017 | +#pragma GCC target "+sve" | ||
3018 | + | ||
3019 | +/* | ||
3020 | +** test3: | ||
3021 | +** stp x29, x30, \[sp, #?-16\]! | ||
3022 | +** mov x29, sp | ||
3023 | +** addvl sp, sp, #-18 | ||
3024 | +** ... | ||
3025 | +** str p4, \[sp\] | ||
3026 | +** ... | ||
3027 | +** sub sp, sp, #272 | ||
3028 | +** mrs (x[0-9]+), tpidr2_el0 | ||
3029 | +** ldr (x[0-9]+), \[\1, #?16\] | ||
3030 | +** str \2, \[sp, #?264\] | ||
3031 | +** mov \2, #?0 | ||
3032 | +** add x0, sp, #?8 | ||
3033 | +** bl h | ||
3034 | +** ... | ||
3035 | +** mrs .* | ||
3036 | +** ... | ||
3037 | +** bne .* | ||
3038 | +** ... | ||
3039 | +** add sp, sp, #?272 | ||
3040 | +** ... | ||
3041 | +** ldr p4, \[sp\] | ||
3042 | +** ... | ||
3043 | +** addvl sp, sp, #18 | ||
3044 | +** ldp x29, x30, \[sp\], #?16 | ||
3045 | +** ret | ||
3046 | +** bl __stack_chk_fail | ||
3047 | +*/ | ||
3048 | +__SVBool_t test3() { | ||
3049 | + int y[0x40]; | ||
3050 | + return *h(y); | ||
3051 | +} | ||
3052 | diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c | ||
3053 | new file mode 100644 | ||
3054 | index 00000000000..58f322aa480 | ||
3055 | --- /dev/null | ||
3056 | +++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c | ||
3057 | @@ -0,0 +1,33 @@ | ||
3058 | +/* { dg-options "-O2 -mcpu=neoverse-v1 -fstack-protector-all" } */ | ||
3059 | +/* { dg-final { check-function-bodies "**" "" } } */ | ||
3060 | + | ||
3061 | +/* | ||
3062 | +** main: | ||
3063 | +** ... | ||
3064 | +** stp x29, x30, \[sp, #?-[0-9]+\]! | ||
3065 | +** ... | ||
3066 | +** sub sp, sp, #[0-9]+ | ||
3067 | +** ... | ||
3068 | +** str x[0-9]+, \[x29, #?-8\] | ||
3069 | +** ... | ||
3070 | +*/ | ||
3071 | +int f(const char *); | ||
3072 | +void g(void *); | ||
3073 | +int main(int argc, char* argv[]) | ||
3074 | +{ | ||
3075 | + int a; | ||
3076 | + int b; | ||
3077 | + char c[2+f(argv[1])]; | ||
3078 | + int d[0x100]; | ||
3079 | + char y; | ||
3080 | + | ||
3081 | + y=42; a=4; b=10; | ||
3082 | + c[0] = 'h'; c[1] = '\0'; | ||
3083 | + | ||
3084 | + c[f(argv[2])] = '\0'; | ||
3085 | + | ||
3086 | + __builtin_printf("%d %d\n%s\n", a, b, c); | ||
3087 | + g(d); | ||
3088 | + | ||
3089 | + return 0; | ||
3090 | +} | ||
3091 | -- | ||
3092 | 2.34.1 | ||
3093 | |||
diff --git a/meta/recipes-devtools/gcc/gcc_13.2.bb b/meta/recipes-devtools/gcc/gcc_13.3.bb index 255fe552bd..255fe552bd 100644 --- a/meta/recipes-devtools/gcc/gcc_13.2.bb +++ b/meta/recipes-devtools/gcc/gcc_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/libgcc-initial_13.2.bb b/meta/recipes-devtools/gcc/libgcc-initial_13.3.bb index a259082b47..a259082b47 100644 --- a/meta/recipes-devtools/gcc/libgcc-initial_13.2.bb +++ b/meta/recipes-devtools/gcc/libgcc-initial_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/libgcc_13.2.bb b/meta/recipes-devtools/gcc/libgcc_13.3.bb index fdcd6cc0da..fdcd6cc0da 100644 --- a/meta/recipes-devtools/gcc/libgcc_13.2.bb +++ b/meta/recipes-devtools/gcc/libgcc_13.3.bb | |||
diff --git a/meta/recipes-devtools/gcc/libgfortran_13.2.bb b/meta/recipes-devtools/gcc/libgfortran_13.3.bb index 71dd8b4bdc..71dd8b4bdc 100644 --- a/meta/recipes-devtools/gcc/libgfortran_13.2.bb +++ b/meta/recipes-devtools/gcc/libgfortran_13.3.bb | |||
diff --git a/meta/recipes-devtools/git/git_2.44.0.bb b/meta/recipes-devtools/git/git_2.44.1.bb index 90e555eba7..53d67eb40a 100644 --- a/meta/recipes-devtools/git/git_2.44.0.bb +++ b/meta/recipes-devtools/git/git_2.44.1.bb | |||
@@ -40,6 +40,7 @@ EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \ | |||
40 | --without-iconv \ | 40 | --without-iconv \ |
41 | " | 41 | " |
42 | EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig " | 42 | EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig " |
43 | EXTRA_OECONF:append:class-native = " --with-gitconfig=/etc/gitconfig " | ||
43 | 44 | ||
44 | # Needs brokensep as this doesn't use automake | 45 | # Needs brokensep as this doesn't use automake |
45 | inherit autotools-brokensep perlnative bash-completion manpages | 46 | inherit autotools-brokensep perlnative bash-completion manpages |
@@ -163,4 +164,4 @@ EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \ | |||
163 | " | 164 | " |
164 | EXTRA_OEMAKE += "NO_GETTEXT=1" | 165 | EXTRA_OEMAKE += "NO_GETTEXT=1" |
165 | 166 | ||
166 | SRC_URI[tarball.sha256sum] = "f9e36f085458fe9688fbbe7846b8c4770b13d161fcd8953655f36b2b85f06b76" | 167 | SRC_URI[tarball.sha256sum] = "118214bb8d7ba971a62741416e757562b8f5451cefc087a407e91857897c92cc" |
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc index 3f1e795dd9..413cf6d33f 100644 --- a/meta/recipes-devtools/go/go-runtime.inc +++ b/meta/recipes-devtools/go/go-runtime.inc | |||
@@ -15,7 +15,7 @@ export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-pr | |||
15 | export GOCACHE = "${B}/.cache" | 15 | export GOCACHE = "${B}/.cache" |
16 | 16 | ||
17 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" | 17 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" |
18 | GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags '${GO_EXTLDFLAGS}'"' | 18 | GO_SHLIB_LDFLAGS ?= '-ldflags="-extldflags '${GO_EXTLDFLAGS}'"' |
19 | 19 | ||
20 | do_configure() { | 20 | do_configure() { |
21 | : | 21 | : |
diff --git a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch index 48af6fc283..a5c53b6657 100644 --- a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch +++ b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 86940d87026432683fb6741cd8a34d3b9b18e40d Mon Sep 17 00:00:00 2001 | 1 | From 3b30a9bda88374e8f03bf96e972aee5bd214b98b Mon Sep 17 00:00:00 2001 |
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
3 | Date: Fri, 27 Nov 2020 10:11:08 +0000 | 3 | Date: Fri, 27 Nov 2020 10:11:08 +0000 |
4 | Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well | 4 | Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well |
@@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | |||
14 | 1 file changed, 4 insertions(+), 1 deletion(-) | 14 | 1 file changed, 4 insertions(+), 1 deletion(-) |
15 | 15 | ||
16 | diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp | 16 | diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp |
17 | index ccf0959389b..1f801e83b7d 100644 | 17 | index 73724e662f9e..1ca9c73415db 100644 |
18 | --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp | 18 | --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp |
19 | +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp | 19 | +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp |
20 | @@ -359,7 +359,10 @@ public: | 20 | @@ -361,7 +361,10 @@ public: |
21 | // name of a class shouldn't be significant. However, some of the backends | 21 | // name of a class shouldn't be significant. However, some of the backends |
22 | // accidentally rely on this behaviour, so it will have to stay like this | 22 | // accidentally rely on this behaviour, so it will have to stay like this |
23 | // until they are fixed. | 23 | // until they are fixed. |
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_18.1.5.bb index c4fd73f2d7..4b6763e580 100644 --- a/meta/recipes-devtools/llvm/llvm_git.bb +++ b/meta/recipes-devtools/llvm/llvm_18.1.5.bb | |||
@@ -13,27 +13,26 @@ DEPENDS = "libffi libxml2 zlib zstd libedit ninja-native llvm-native" | |||
13 | RDEPENDS:${PN}:append:class-target = " ncurses-terminfo" | 13 | RDEPENDS:${PN}:append:class-target = " ncurses-terminfo" |
14 | 14 | ||
15 | inherit cmake pkgconfig | 15 | inherit cmake pkgconfig |
16 | |||
17 | # could be 'rcX' or 'git' or empty ( for release ) | 16 | # could be 'rcX' or 'git' or empty ( for release ) |
18 | VER_SUFFIX = "" | 17 | VER_SUFFIX = "" |
19 | 18 | ||
20 | PV = "18.1.3${VER_SUFFIX}" | 19 | PV .= "${VER_SUFFIX}" |
21 | 20 | ||
22 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" | 21 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" |
23 | 22 | ||
24 | LLVM_RELEASE = "${PV}" | 23 | LLVM_RELEASE = "${PV}" |
25 | 24 | ||
26 | BRANCH = "release/${MAJOR_VERSION}.x" | 25 | SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ |
27 | SRCREV = "c13b7485b87909fcf739f62cfa382b55407433c0" | ||
28 | SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH};protocol=https \ | ||
29 | file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ | 26 | file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ |
30 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ | 27 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ |
31 | file://llvm-config \ | 28 | file://llvm-config \ |
32 | " | 29 | " |
30 | SRC_URI[sha256sum] = "3591a52761a7d390ede51af01ea73abfecc4b1d16445f9d019b67a57edd7de56" | ||
33 | 31 | ||
34 | UPSTREAM_CHECK_GITTAGREGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" | 32 | UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project" |
33 | UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" | ||
35 | 34 | ||
36 | S = "${WORKDIR}/git/llvm" | 35 | S = "${WORKDIR}/llvm-project-${PV}.src/llvm" |
37 | 36 | ||
38 | LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install" | 37 | LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install" |
39 | 38 | ||
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service index b6b81d5c1a..1ce19abcaf 100644 --- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service +++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service | |||
@@ -7,7 +7,7 @@ Before=sysinit.target | |||
7 | [Service] | 7 | [Service] |
8 | Type=oneshot | 8 | Type=oneshot |
9 | ExecStart=#SBINDIR#/run-postinsts | 9 | ExecStart=#SBINDIR#/run-postinsts |
10 | ExecStartPost=#BASE_BINDIR#/systemctl --no-reload disable run-postinsts.service | 10 | ExecStartPost=#BASE_BINDIR#/systemctl disable run-postinsts.service |
11 | RemainAfterExit=yes | 11 | RemainAfterExit=yes |
12 | TimeoutSec=0 | 12 | TimeoutSec=0 |
13 | 13 | ||
diff --git a/meta/recipes-extended/bash/bash/build-tests.patch b/meta/recipes-extended/bash/bash/build-tests.patch index ea38bace9b..c1b9b8261f 100644 --- a/meta/recipes-extended/bash/bash/build-tests.patch +++ b/meta/recipes-extended/bash/bash/build-tests.patch | |||
@@ -4,7 +4,7 @@ Date: Wed, 19 Dec 2012 17:18:31 +0100 | |||
4 | Subject: [PATCH] Add 'ptest' target to Makefile, to run tests without checking | 4 | Subject: [PATCH] Add 'ptest' target to Makefile, to run tests without checking |
5 | dependencies. | 5 | dependencies. |
6 | 6 | ||
7 | Upstream-Status: Pending | 7 | Upstream-Status: Inappropriate [ptest specific] |
8 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> | 8 | Signed-off-by: Anders Roxell <anders.roxell@enea.com> |
9 | 9 | ||
10 | Rebase to 5.0 | 10 | Rebase to 5.0 |
diff --git a/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch b/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch new file mode 100644 index 0000000000..60f1852316 --- /dev/null +++ b/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 59ddfda14e3c9aa6286bb4c4c0748f7c1324a65a Mon Sep 17 00:00:00 2001 | ||
2 | From: Chet Ramey <chet.ramey@case.edu> | ||
3 | Date: Fri, 7 Apr 2023 00:28:46 -0700 | ||
4 | Subject: [PATCH] $(<nosuchfile) is no longer a fatal error with errexit | ||
5 | enabled | ||
6 | |||
7 | This is a trimmed-down version of a commit in the bash 'devel' branch | ||
8 | [1] that contains this fix as well as other unrelated ones. | ||
9 | |||
10 | [1] https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=ec9447ce9392a0f93d96789c3741285fede8a150 | ||
11 | |||
12 | Upstream-Status: Backport | ||
13 | |||
14 | Signed-off-by: Zev Weiss <zev@bewilderbeest.net> | ||
15 | --- | ||
16 | builtins/evalstring.c | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/builtins/evalstring.c b/builtins/evalstring.c | ||
20 | index df3dd68e2a7e..6612081cd646 100644 | ||
21 | --- a/builtins/evalstring.c | ||
22 | +++ b/builtins/evalstring.c | ||
23 | @@ -753,7 +753,7 @@ open_redir_file (r, fnp) | ||
24 | fd = open(fn, O_RDONLY); | ||
25 | if (fd < 0) | ||
26 | { | ||
27 | - file_error (fn); | ||
28 | + internal_error ("%s: %s", fn, strerror (errno)); | ||
29 | free (fn); | ||
30 | if (fnp) | ||
31 | *fnp = 0; | ||
32 | -- | ||
33 | 2.40.0 | ||
34 | |||
diff --git a/meta/recipes-extended/bash/bash_5.2.21.bb b/meta/recipes-extended/bash/bash_5.2.21.bb index 46d921bbe6..532adf4c1a 100644 --- a/meta/recipes-extended/bash/bash_5.2.21.bb +++ b/meta/recipes-extended/bash/bash_5.2.21.bb | |||
@@ -13,6 +13,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ | |||
13 | file://fix-run-builtins.patch \ | 13 | file://fix-run-builtins.patch \ |
14 | file://use_aclocal.patch \ | 14 | file://use_aclocal.patch \ |
15 | file://0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch \ | 15 | file://0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch \ |
16 | file://fix-filesubst-errexit.patch \ | ||
16 | " | 17 | " |
17 | 18 | ||
18 | SRC_URI[tarball.sha256sum] = "c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8" | 19 | SRC_URI[tarball.sha256sum] = "c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8" |
diff --git a/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch b/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch index 20572b55c4..35229ae890 100644 --- a/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch +++ b/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch | |||
@@ -303,7 +303,7 @@ index 9396e1d..d0bb181 100644 | |||
303 | + PWDICT tmp_pwp; | 303 | + PWDICT tmp_pwp; |
304 | + | 304 | + |
305 | + memcpy(&tmp_pwp, pwp, sizeof(PWDICT)); | 305 | + memcpy(&tmp_pwp, pwp, sizeof(PWDICT)); |
306 | + HwmsHostToBigEndian(tmp_pwp.hwms, sizeof(tmp_pwp.hwms), en_is32); | 306 | + HwmsHostToBigEndian((char *)tmp_pwp.hwms, sizeof(tmp_pwp.hwms), en_is32); |
307 | + fwrite(tmp_pwp.hwms, 1, sizeof(tmp_pwp.hwms), pwp->wfp); | 307 | + fwrite(tmp_pwp.hwms, 1, sizeof(tmp_pwp.hwms), pwp->wfp); |
308 | } | 308 | } |
309 | } | 309 | } |
diff --git a/meta/recipes-extended/cronie/cronie_1.7.1.bb b/meta/recipes-extended/cronie/cronie_1.7.2.bb index 854b68163c..abdaff644d 100644 --- a/meta/recipes-extended/cronie/cronie_1.7.1.bb +++ b/meta/recipes-extended/cronie/cronie_1.7.2.bb | |||
@@ -25,7 +25,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/cronie-${PV}/cronie-${PV}.tar.gz \ | |||
25 | PAM_SRC_URI = "file://crond_pam_config.patch" | 25 | PAM_SRC_URI = "file://crond_pam_config.patch" |
26 | PAM_DEPS = "libpam libpam-runtime pam-plugin-access pam-plugin-loginuid" | 26 | PAM_DEPS = "libpam libpam-runtime pam-plugin-access pam-plugin-loginuid" |
27 | 27 | ||
28 | SRC_URI[sha256sum] = "78033100c24413f0c40f93e6138774d6a4f55bc31050567b90db45a2f9f1b954" | 28 | SRC_URI[sha256sum] = "f1da374a15ba7605cf378347f96bc8b678d3d7c0765269c8242cfe5b0789c571" |
29 | 29 | ||
30 | inherit autotools update-rc.d useradd systemd github-releases | 30 | inherit autotools update-rc.d useradd systemd github-releases |
31 | UPSTREAM_CHECK_REGEX = "releases/tag/cronie-(?P<pver>\d+(\.\d+)+)" | 31 | UPSTREAM_CHECK_REGEX = "releases/tag/cronie-(?P<pver>\d+(\.\d+)+)" |
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-29510.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-29510.patch new file mode 100644 index 0000000000..692d35157f --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-29510.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From 3b1735085ecef20b29e8db3416ab36de93e86d1f Mon Sep 17 00:00:00 2001 | ||
2 | From: Ken Sharp <Ken.Sharp@artifex.com> | ||
3 | Date: Thu, 21 Mar 2024 09:01:15 +0000 | ||
4 | Subject: [PATCH 5/5] Uniprint device - prevent string configuration changes | ||
5 | when SAFER | ||
6 | |||
7 | Bug #707662 | ||
8 | |||
9 | We cannot sanitise the string arguments used by the Uniprint device | ||
10 | because they can potentially include anything. | ||
11 | |||
12 | This commit ensures that these strings are locked and cannot be | ||
13 | changed by PostScript once SAFER is activated. Full configuration from | ||
14 | the command line is still possible (see the *.upp files in lib). | ||
15 | |||
16 | This addresses CVE-2024-29510 | ||
17 | |||
18 | CVE: CVE-2024-29510 | ||
19 | |||
20 | Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=3b1735085ecef20b29e] | ||
21 | |||
22 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
23 | --- | ||
24 | devices/gdevupd.c | 31 +++++++++++++++++++++++++++++++ | ||
25 | 1 file changed, 31 insertions(+) | ||
26 | |||
27 | diff --git a/devices/gdevupd.c b/devices/gdevupd.c | ||
28 | index 740dae0..a50571a 100644 | ||
29 | --- a/devices/gdevupd.c | ||
30 | +++ b/devices/gdevupd.c | ||
31 | @@ -1887,6 +1887,16 @@ out on this copies. | ||
32 | if(!upd_strings[i]) continue; | ||
33 | UPD_PARAM_READ(param_read_string,upd_strings[i],value,udev->memory); | ||
34 | if(0 == code) { | ||
35 | + if (gs_is_path_control_active(udev->memory)) { | ||
36 | + if (strings[i].size != value.size) | ||
37 | + error = gs_error_invalidaccess; | ||
38 | + else { | ||
39 | + if (strings[i].data && memcmp(strings[i].data, value.data, strings[i].size) != 0) | ||
40 | + error = gs_error_invalidaccess; | ||
41 | + } | ||
42 | + if (error < 0) | ||
43 | + goto exit; | ||
44 | + } | ||
45 | if(0 <= error) error |= UPD_PUT_STRINGS; | ||
46 | UPD_MM_DEL_PARAM(udev->memory, strings[i]); | ||
47 | if(!value.size) { | ||
48 | @@ -1904,6 +1914,26 @@ out on this copies. | ||
49 | if(!upd_string_a[i]) continue; | ||
50 | UPD_PARAM_READ(param_read_string_array,upd_string_a[i],value,udev->memory); | ||
51 | if(0 == code) { | ||
52 | + if (gs_is_path_control_active(udev->memory)) { | ||
53 | + if (string_a[i].size != value.size) | ||
54 | + error = gs_error_invalidaccess; | ||
55 | + else { | ||
56 | + int loop; | ||
57 | + for (loop = 0;loop < string_a[i].size;loop++) { | ||
58 | + gs_param_string *tmp1 = (gs_param_string *)&(string_a[i].data[loop]); | ||
59 | + gs_param_string *tmp2 = (gs_param_string *)&value.data[loop]; | ||
60 | + | ||
61 | + if (tmp1->size != tmp2->size) | ||
62 | + error = gs_error_invalidaccess; | ||
63 | + else { | ||
64 | + if (tmp1->data && memcmp(tmp1->data, tmp2->data, tmp1->size) != 0) | ||
65 | + error = gs_error_invalidaccess; | ||
66 | + } | ||
67 | + } | ||
68 | + } | ||
69 | + if (error < 0) | ||
70 | + goto exit; | ||
71 | + } | ||
72 | if(0 <= error) error |= UPD_PUT_STRING_A; | ||
73 | UPD_MM_DEL_APARAM(udev->memory, string_a[i]); | ||
74 | if(!value.size) { | ||
75 | @@ -2098,6 +2128,7 @@ transferred into the device-structure. In the case of "uniprint", this may | ||
76 | if(0 > code) error = code; | ||
77 | } | ||
78 | |||
79 | +exit: | ||
80 | if(0 < error) { /* Actually something loaded without error */ | ||
81 | |||
82 | if(!(upd = udev->upd)) { | ||
83 | -- | ||
84 | 2.40.0 | ||
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0001.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0001.patch new file mode 100644 index 0000000000..2f20c66ea3 --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0001.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 5ae2e320d69a7d0973011796bd388cd5befa1a43 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ken Sharp <Ken.Sharp@artifex.com> | ||
3 | Date: Tue, 26 Mar 2024 12:02:57 +0000 | ||
4 | Subject: [PATCH 2/5] Bug #707691 | ||
5 | |||
6 | Part 1; when stripping a potential Current Working Dirctory specifier | ||
7 | from a path, make certain it really is a CWD, and not simply large | ||
8 | ebough to be a CWD. | ||
9 | |||
10 | Reasons are in the bug thread, this is not (IMO) serious. | ||
11 | |||
12 | This is part of the fix for CVE-2024-33869 | ||
13 | |||
14 | CVE: CVE-2024-33869 | ||
15 | |||
16 | Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=5ae2e320d69a7d0973] | ||
17 | |||
18 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
19 | --- | ||
20 | base/gpmisc.c | 4 ++-- | ||
21 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/base/gpmisc.c b/base/gpmisc.c | ||
24 | index c4a69b0..1d4d5d8 100644 | ||
25 | --- a/base/gpmisc.c | ||
26 | +++ b/base/gpmisc.c | ||
27 | @@ -1164,8 +1164,8 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
28 | |||
29 | continue; | ||
30 | } | ||
31 | - else if (code < 0 && cdirstrl > 0 && prefix_len == 0 && buffer == bufferfull) { | ||
32 | - buffer = bufferfull + cdirstrl + dirsepstrl; | ||
33 | + else if (code < 0 && cdirstrl > 0 && prefix_len == 0 && buffer == bufferfull | ||
34 | + && memcmp(buffer, cdirstr, cdirstrl) && !memcmp(buffer + cdirstrl, dirsepstr, dirsepstrl)) { | ||
35 | continue; | ||
36 | } | ||
37 | break; | ||
38 | -- | ||
39 | 2.40.0 | ||
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0002.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0002.patch new file mode 100644 index 0000000000..5dcbcca998 --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33869-0002.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From f5336e5b4154f515ac83bc5b9eba94302e6618d4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ken Sharp <Ken.Sharp@artifex.com> | ||
3 | Date: Tue, 26 Mar 2024 12:07:18 +0000 | ||
4 | Subject: [PATCH 3/5] Bug 707691 part 2 | ||
5 | |||
6 | See bug thread for details | ||
7 | |||
8 | This is the second part of the fix for CVE-2024-33869 | ||
9 | |||
10 | CVE: CVE-2024-33869 | ||
11 | |||
12 | Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=f5336e5b4154f515ac83] | ||
13 | |||
14 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
15 | --- | ||
16 | base/gpmisc.c | 21 +++++++++++++++++++++ | ||
17 | 1 file changed, 21 insertions(+) | ||
18 | |||
19 | diff --git a/base/gpmisc.c b/base/gpmisc.c | ||
20 | index 1d4d5d8..b0d5c71 100644 | ||
21 | --- a/base/gpmisc.c | ||
22 | +++ b/base/gpmisc.c | ||
23 | @@ -1090,6 +1090,27 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
24 | rlen = len; | ||
25 | } | ||
26 | else { | ||
27 | + char *test = (char *)path, *test1; | ||
28 | + uint tlen = len, slen; | ||
29 | + | ||
30 | + /* Look for any pipe (%pipe% or '|' specifications between path separators | ||
31 | + * Reject any path spec which has a %pipe% or '|' anywhere except at the start. | ||
32 | + */ | ||
33 | + while (tlen > 0) { | ||
34 | + if (test[0] == '|' || (tlen > 5 && memcmp(test, "%pipe", 5) == 0)) { | ||
35 | + code = gs_note_error(gs_error_invalidfileaccess); | ||
36 | + goto exit; | ||
37 | + } | ||
38 | + test1 = test; | ||
39 | + slen = search_separator((const char **)&test, path + len, test1, 1); | ||
40 | + if(slen == 0) | ||
41 | + break; | ||
42 | + test += slen; | ||
43 | + tlen -= test - test1; | ||
44 | + if (test >= path + len) | ||
45 | + break; | ||
46 | + } | ||
47 | + | ||
48 | rlen = len+1; | ||
49 | bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path"); | ||
50 | if (bufferfull == NULL) | ||
51 | -- | ||
52 | 2.40.0 | ||
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33870.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33870.patch new file mode 100644 index 0000000000..9c2b9dcfa2 --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33870.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From 79aef19c685984dc3da2dc090450407d9fbcff80 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ken Sharp <Ken.Sharp@artifex.com> | ||
3 | Date: Tue, 26 Mar 2024 12:00:14 +0000 | ||
4 | Subject: [PATCH 1/5] Bug #707686 | ||
5 | |||
6 | See bug thread for details | ||
7 | |||
8 | In addition to the noted bug; an error path (return from | ||
9 | gp_file_name_reduce not successful) could elad to a memory leak as we | ||
10 | did not free 'bufferfull'. Fix that too. | ||
11 | |||
12 | This addresses CVE-2024-33870 | ||
13 | |||
14 | CVE: CVE-2024-33870 | ||
15 | |||
16 | Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=79aef19c685984dc] | ||
17 | |||
18 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
19 | --- | ||
20 | base/gpmisc.c | 36 ++++++++++++++++++++++++++++++++---- | ||
21 | 1 file changed, 32 insertions(+), 4 deletions(-) | ||
22 | |||
23 | diff --git a/base/gpmisc.c b/base/gpmisc.c | ||
24 | index 2b0064b..c4a69b0 100644 | ||
25 | --- a/base/gpmisc.c | ||
26 | +++ b/base/gpmisc.c | ||
27 | @@ -1,4 +1,4 @@ | ||
28 | -/* Copyright (C) 2001-2023 Artifex Software, Inc. | ||
29 | +/* Copyright (C) 2001-2024 Artifex Software, Inc. | ||
30 | All Rights Reserved. | ||
31 | |||
32 | This software is provided AS-IS with no warranty, either express or | ||
33 | @@ -1042,7 +1042,7 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
34 | const uint len, | ||
35 | const char *mode) | ||
36 | { | ||
37 | - char *buffer, *bufferfull; | ||
38 | + char *buffer, *bufferfull = NULL; | ||
39 | uint rlen; | ||
40 | int code = 0; | ||
41 | const char *cdirstr = gp_file_name_current(); | ||
42 | @@ -1096,8 +1096,10 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
43 | return gs_error_VMerror; | ||
44 | |||
45 | buffer = bufferfull + prefix_len; | ||
46 | - if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) | ||
47 | - return gs_error_invalidfileaccess; | ||
48 | + if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) { | ||
49 | + code = gs_note_error(gs_error_invalidfileaccess); | ||
50 | + goto exit; | ||
51 | + } | ||
52 | buffer[rlen] = 0; | ||
53 | } | ||
54 | while (1) { | ||
55 | @@ -1132,9 +1134,34 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
56 | code = gs_note_error(gs_error_invalidfileaccess); | ||
57 | } | ||
58 | if (code < 0 && prefix_len > 0 && buffer > bufferfull) { | ||
59 | + uint newlen = rlen + cdirstrl + dirsepstrl; | ||
60 | + char *newbuffer; | ||
61 | + int code; | ||
62 | + | ||
63 | buffer = bufferfull; | ||
64 | memcpy(buffer, cdirstr, cdirstrl); | ||
65 | memcpy(buffer + cdirstrl, dirsepstr, dirsepstrl); | ||
66 | + | ||
67 | + /* We've prepended a './' or similar for the current working directory. We need | ||
68 | + * to execute file_name_reduce on that, to eliminate any '../' or similar from | ||
69 | + * the (new) full path. | ||
70 | + */ | ||
71 | + newbuffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, newlen + 1, "gp_validate_path"); | ||
72 | + if (newbuffer == NULL) { | ||
73 | + code = gs_note_error(gs_error_VMerror); | ||
74 | + goto exit; | ||
75 | + } | ||
76 | + | ||
77 | + memcpy(newbuffer, buffer, rlen + cdirstrl + dirsepstrl); | ||
78 | + newbuffer[newlen] = 0x00; | ||
79 | + | ||
80 | + code = gp_file_name_reduce(newbuffer, (uint)newlen, buffer, &newlen); | ||
81 | + gs_free_object(mem->thread_safe_memory, newbuffer, "gp_validate_path"); | ||
82 | + if (code != gp_combine_success) { | ||
83 | + code = gs_note_error(gs_error_invalidfileaccess); | ||
84 | + goto exit; | ||
85 | + } | ||
86 | + | ||
87 | continue; | ||
88 | } | ||
89 | else if (code < 0 && cdirstrl > 0 && prefix_len == 0 && buffer == bufferfull) { | ||
90 | @@ -1153,6 +1180,7 @@ gp_validate_path_len(const gs_memory_t *mem, | ||
91 | gs_path_control_flag_is_scratch_file); | ||
92 | } | ||
93 | |||
94 | +exit: | ||
95 | gs_free_object(mem->thread_safe_memory, bufferfull, "gp_validate_path"); | ||
96 | #ifdef EACCES | ||
97 | if (code == gs_error_invalidfileaccess) | ||
98 | -- | ||
99 | 2.40.0 | ||
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33871.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33871.patch new file mode 100644 index 0000000000..abe6384997 --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2024-33871.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From 7145885041bb52cc23964f0aa2aec1b1c82b5908 Mon Sep 17 00:00:00 2001 | ||
2 | From: Zdenek Hutyra <zhutyra@centrum.cz> | ||
3 | Date: Mon, 22 Apr 2024 13:33:47 +0100 | ||
4 | Subject: [PATCH 4/5] OPVP device - prevent unsafe parameter change with SAFER | ||
5 | |||
6 | Bug #707754 "OPVP device - Arbitrary code execution via custom Driver library" | ||
7 | |||
8 | The "Driver" parameter for the "opvp"/"oprp" device specifies the name | ||
9 | of a dynamic library and allows any library to be loaded. | ||
10 | |||
11 | The patch does not allow changing this parameter after activating path | ||
12 | control. | ||
13 | |||
14 | This addresses CVE-2024-33871 | ||
15 | |||
16 | CVE: CVE-2024-33871 | ||
17 | |||
18 | Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=7145885041bb52cc2396] | ||
19 | |||
20 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
21 | --- | ||
22 | contrib/opvp/gdevopvp.c | 6 ++++++ | ||
23 | 1 file changed, 6 insertions(+) | ||
24 | |||
25 | diff --git a/contrib/opvp/gdevopvp.c b/contrib/opvp/gdevopvp.c | ||
26 | index 74200cf..80eb23b 100644 | ||
27 | --- a/contrib/opvp/gdevopvp.c | ||
28 | +++ b/contrib/opvp/gdevopvp.c | ||
29 | @@ -3456,6 +3456,12 @@ _put_params(gx_device *dev, gs_param_list *plist) | ||
30 | code = param_read_string(plist, pname, &vdps); | ||
31 | switch (code) { | ||
32 | case 0: | ||
33 | + if (gs_is_path_control_active(dev->memory) | ||
34 | + && (!opdev->globals.vectorDriver || strlen(opdev->globals.vectorDriver) != vdps.size | ||
35 | + || memcmp(opdev->globals.vectorDriver, vdps.data, vdps.size) != 0)) { | ||
36 | + param_signal_error(plist, pname, gs_error_invalidaccess); | ||
37 | + return_error(gs_error_invalidaccess); | ||
38 | + } | ||
39 | buff = realloc(buff, vdps.size + 1); | ||
40 | memcpy(buff, vdps.data, vdps.size); | ||
41 | buff[vdps.size] = 0; | ||
42 | -- | ||
43 | 2.40.0 | ||
diff --git a/meta/recipes-extended/ghostscript/ghostscript_10.02.1.bb b/meta/recipes-extended/ghostscript/ghostscript_10.02.1.bb index 3dff16eec2..db9481816a 100644 --- a/meta/recipes-extended/ghostscript/ghostscript_10.02.1.bb +++ b/meta/recipes-extended/ghostscript/ghostscript_10.02.1.bb | |||
@@ -26,6 +26,11 @@ SRC_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/downlo | |||
26 | file://ghostscript-9.16-Werror-return-type.patch \ | 26 | file://ghostscript-9.16-Werror-return-type.patch \ |
27 | file://avoid-host-contamination.patch \ | 27 | file://avoid-host-contamination.patch \ |
28 | file://configure.ac-add-option-to-explicitly-disable-neon.patch \ | 28 | file://configure.ac-add-option-to-explicitly-disable-neon.patch \ |
29 | file://CVE-2024-33870.patch \ | ||
30 | file://CVE-2024-33869-0001.patch \ | ||
31 | file://CVE-2024-33869-0002.patch \ | ||
32 | file://CVE-2024-33871.patch \ | ||
33 | file://CVE-2024-29510.patch \ | ||
29 | " | 34 | " |
30 | 35 | ||
31 | SRC_URI[sha256sum] = "e429e4f5b01615a4f0f93a4128e8a1a4d932dff983b1774174c79c0630717ad9" | 36 | SRC_URI[sha256sum] = "e429e4f5b01615a4f0f93a4128e8a1a4d932dff983b1774174c79c0630717ad9" |
diff --git a/meta/recipes-extended/iputils/iputils_20240117.bb b/meta/recipes-extended/iputils/iputils_20240117.bb index 5a5e15528e..3880689742 100644 --- a/meta/recipes-extended/iputils/iputils_20240117.bb +++ b/meta/recipes-extended/iputils/iputils_20240117.bb | |||
@@ -35,7 +35,11 @@ ALTERNATIVE_PRIORITY = "100" | |||
35 | ALTERNATIVE:${PN}-ping = "ping" | 35 | ALTERNATIVE:${PN}-ping = "ping" |
36 | ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping" | 36 | ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping" |
37 | 37 | ||
38 | SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff" | 38 | ALTERNATIVE:${PN}-ping6 = "ping6" |
39 | ALTERNATIVE_LINK_NAME[ping6] = "${base_bindir}/ping6" | ||
40 | |||
41 | SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff \ | ||
42 | ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-ping6', '', d)}" | ||
39 | PACKAGES += "${SPLITPKGS}" | 43 | PACKAGES += "${SPLITPKGS}" |
40 | 44 | ||
41 | ALLOW_EMPTY:${PN} = "1" | 45 | ALLOW_EMPTY:${PN} = "1" |
@@ -43,6 +47,13 @@ RDEPENDS:${PN} += "${SPLITPKGS}" | |||
43 | 47 | ||
44 | FILES:${PN} = "" | 48 | FILES:${PN} = "" |
45 | FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" | 49 | FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" |
50 | FILES:${PN}-ping6 = "${base_bindir}/ping6.${BPN}" | ||
46 | FILES:${PN}-arping = "${base_bindir}/arping" | 51 | FILES:${PN}-arping = "${base_bindir}/arping" |
47 | FILES:${PN}-tracepath = "${base_bindir}/tracepath" | 52 | FILES:${PN}-tracepath = "${base_bindir}/tracepath" |
48 | FILES:${PN}-clockdiff = "${base_bindir}/clockdiff" | 53 | FILES:${PN}-clockdiff = "${base_bindir}/clockdiff" |
54 | |||
55 | do_install:append() { | ||
56 | if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'true', 'false', d)}; then | ||
57 | ln -sf ping ${D}/${base_bindir}/ping6 | ||
58 | fi | ||
59 | } | ||
diff --git a/meta/recipes-extended/libarchive/libarchive/configurehack.patch b/meta/recipes-extended/libarchive/libarchive/configurehack.patch index f3989d99eb..44720fdd53 100644 --- a/meta/recipes-extended/libarchive/libarchive/configurehack.patch +++ b/meta/recipes-extended/libarchive/libarchive/configurehack.patch | |||
@@ -2,12 +2,15 @@ To work with autoconf 2.73, tweak the macro ordering in configure.in. | |||
2 | 2 | ||
3 | Upstream-Status: Pending | 3 | Upstream-Status: Pending |
4 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | 4 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> |
5 | --- | ||
6 | configure.ac | 26 +++++++++++++------------- | ||
7 | 1 file changed, 13 insertions(+), 13 deletions(-) | ||
5 | 8 | ||
6 | Index: libarchive-3.6.2/configure.ac | 9 | diff --git a/configure.ac b/configure.ac |
7 | =================================================================== | 10 | index 5668d41..7e65e49 100644 |
8 | --- libarchive-3.6.2.orig/configure.ac | 11 | --- a/configure.ac |
9 | +++ libarchive-3.6.2/configure.ac | 12 | +++ b/configure.ac |
10 | @@ -357,6 +357,19 @@ if test "x$with_bz2lib" != "xno"; then | 13 | @@ -414,6 +414,19 @@ if test "x$with_bz2lib" != "xno"; then |
11 | esac | 14 | esac |
12 | fi | 15 | fi |
13 | 16 | ||
@@ -27,9 +30,9 @@ Index: libarchive-3.6.2/configure.ac | |||
27 | AC_ARG_WITH([libb2], | 30 | AC_ARG_WITH([libb2], |
28 | AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2])) | 31 | AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2])) |
29 | 32 | ||
30 | @@ -558,19 +571,6 @@ LDFLAGS=$save_LDFLAGS | 33 | @@ -678,19 +691,6 @@ fi |
31 | 34 | ||
32 | AC_SUBST(GC_SECTIONS) | 35 | AC_SUBST(DEAD_CODE_REMOVAL) |
33 | 36 | ||
34 | -# Checks for typedefs, structures, and compiler characteristics. | 37 | -# Checks for typedefs, structures, and compiler characteristics. |
35 | -AC_C_CONST | 38 | -AC_C_CONST |
@@ -47,3 +50,5 @@ Index: libarchive-3.6.2/configure.ac | |||
47 | # Check for tm_gmtoff in struct tm | 50 | # Check for tm_gmtoff in struct tm |
48 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, | 51 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, |
49 | [ | 52 | [ |
53 | -- | ||
54 | 2.40.0 | ||
diff --git a/meta/recipes-extended/libarchive/libarchive_3.7.2.bb b/meta/recipes-extended/libarchive/libarchive_3.7.4.bb index 91f521fa4d..da85764116 100644 --- a/meta/recipes-extended/libarchive/libarchive_3.7.2.bb +++ b/meta/recipes-extended/libarchive/libarchive_3.7.4.bb | |||
@@ -33,7 +33,7 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz" | |||
33 | SRC_URI += "file://configurehack.patch" | 33 | SRC_URI += "file://configurehack.patch" |
34 | UPSTREAM_CHECK_URI = "http://libarchive.org/" | 34 | UPSTREAM_CHECK_URI = "http://libarchive.org/" |
35 | 35 | ||
36 | SRC_URI[sha256sum] = "df404eb7222cf30b4f8f93828677890a2986b66ff8bf39dac32a804e96ddf104" | 36 | SRC_URI[sha256sum] = "7875d49596286055b52439ed42f044bd8ad426aa4cc5aabd96bfe7abb971d5e8" |
37 | 37 | ||
38 | CVE_STATUS[CVE-2023-30571] = "upstream-wontfix: upstream has documented that reported function is not thread-safe" | 38 | CVE_STATUS[CVE-2023-30571] = "upstream-wontfix: upstream has documented that reported function is not thread-safe" |
39 | 39 | ||
diff --git a/meta/recipes-extended/ltp/ltp_20240129.bb b/meta/recipes-extended/ltp/ltp_20240129.bb index 3e896957d1..e88e931a68 100644 --- a/meta/recipes-extended/ltp/ltp_20240129.bb +++ b/meta/recipes-extended/ltp/ltp_20240129.bb | |||
@@ -98,6 +98,7 @@ RDEPENDS:${PN} = "\ | |||
98 | gdb \ | 98 | gdb \ |
99 | gzip \ | 99 | gzip \ |
100 | iproute2 \ | 100 | iproute2 \ |
101 | ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'iputils-ping6', '', d)} \ | ||
101 | ldd \ | 102 | ldd \ |
102 | libaio \ | 103 | libaio \ |
103 | logrotate \ | 104 | logrotate \ |
diff --git a/meta/recipes-extended/procps/procps/pidfd.patch b/meta/recipes-extended/procps/procps/pidfd.patch new file mode 100644 index 0000000000..23d1a3cd3e --- /dev/null +++ b/meta/recipes-extended/procps/procps/pidfd.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From c8f625e085b8249cc009e8b19c3a19100217eb35 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross.burton@arm.com> | ||
3 | Date: Thu, 25 Apr 2024 13:33:15 +0000 | ||
4 | Subject: [PATCH] Fix pidfd_open detection | ||
5 | |||
6 | This check for pidfd_open uses AC_CHECK_FUNC which just runs the specified code, but | ||
7 | src/pgrep.c checks HAVE_PIDFD_OPEN which will only be defined by AC_CHECK_FUNCS. | ||
8 | |||
9 | Also pidfd_open is defined in sys/pidfd.h so that needs including. | ||
10 | |||
11 | Upstream-Status: Submitted [https://gitlab.com/procps-ng/procps/-/merge_requests/229] | ||
12 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
13 | --- | ||
14 | |||
15 | diff --git a/configure.ac b/configure.ac | ||
16 | index fec27e3f..024731c7 100644 | ||
17 | --- a/configure.ac | ||
18 | +++ b/configure.ac | ||
19 | @@ -170,7 +170,7 @@ AC_TRY_COMPILE([#include <errno.h>], | ||
20 | AC_MSG_RESULT(yes), | ||
21 | AC_MSG_RESULT(no)) | ||
22 | |||
23 | -AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [ | ||
24 | +AC_CHECK_FUNCS([pidfd_open], [enable_pidwait=yes], [ | ||
25 | AC_MSG_CHECKING([for __NR_pidfd_open]) | ||
26 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | ||
27 | #include <sys/syscall.h> | ||
28 | diff --git a/src/pgrep.c b/src/pgrep.c | ||
29 | index d8e57dff..c5211aec 100644 | ||
30 | --- a/src/pgrep.c | ||
31 | +++ b/src/pgrep.c | ||
32 | @@ -44,7 +44,9 @@ | ||
33 | |||
34 | #ifdef ENABLE_PIDWAIT | ||
35 | #include <sys/epoll.h> | ||
36 | -#ifndef HAVE_PIDFD_OPEN | ||
37 | +#ifdef HAVE_PIDFD_OPEN | ||
38 | +#include <sys/pidfd.h> | ||
39 | +#else | ||
40 | #include <sys/syscall.h> | ||
41 | #endif /* !HAVE_PIDFD_OPEN */ | ||
42 | #endif | ||
diff --git a/meta/recipes-extended/procps/procps_4.0.4.bb b/meta/recipes-extended/procps/procps_4.0.4.bb index 800384f22f..ec8c4b0261 100644 --- a/meta/recipes-extended/procps/procps_4.0.4.bb +++ b/meta/recipes-extended/procps/procps_4.0.4.bb | |||
@@ -14,6 +14,7 @@ inherit autotools gettext pkgconfig update-alternatives | |||
14 | 14 | ||
15 | SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master \ | 15 | SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master \ |
16 | file://sysctl.conf \ | 16 | file://sysctl.conf \ |
17 | file://pidfd.patch \ | ||
17 | " | 18 | " |
18 | SRCREV = "4ddcef2fd843170c8e2d59a83042978f41037a2b" | 19 | SRCREV = "4ddcef2fd843170c8e2d59a83042978f41037a2b" |
19 | 20 | ||
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch index 7250fa3f62..24edda8102 100644 --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 9d3b374e75692da3d1d05344a1693c85a3098f47 Mon Sep 17 00:00:00 2001 | 1 | From 325a4cde99a00b84116ab7111d27e6973f3c5026 Mon Sep 17 00:00:00 2001 |
2 | From: Alexander Kanavin <alex@linutronix.de> | 2 | From: Alexander Kanavin <alex@linutronix.de> |
3 | Date: Thu, 26 Jan 2023 20:29:46 +0100 | 3 | Date: Thu, 26 Jan 2023 20:29:46 +0100 |
4 | Subject: [PATCH] meson.build: allow (a subset of) tests in cross compile | 4 | Subject: [PATCH] meson.build: allow (a subset of) tests in cross compile |
@@ -19,10 +19,10 @@ Signed-off-by: Alexander Kanavin <alex@linutronix.de> | |||
19 | 2 files changed, 9 insertions(+), 7 deletions(-) | 19 | 2 files changed, 9 insertions(+), 7 deletions(-) |
20 | 20 | ||
21 | diff --git a/meson.build b/meson.build | 21 | diff --git a/meson.build b/meson.build |
22 | index 8a16c8f..7c8b20f 100644 | 22 | index 3eb3fcc..dc7e790 100644 |
23 | --- a/meson.build | 23 | --- a/meson.build |
24 | +++ b/meson.build | 24 | +++ b/meson.build |
25 | @@ -369,10 +369,10 @@ subdir('gdk-pixbuf') | 25 | @@ -390,10 +390,10 @@ subdir('gdk-pixbuf') |
26 | # i18n | 26 | # i18n |
27 | subdir('po') | 27 | subdir('po') |
28 | 28 | ||
@@ -37,7 +37,7 @@ index 8a16c8f..7c8b20f 100644 | |||
37 | endif | 37 | endif |
38 | 38 | ||
39 | diff --git a/tests/meson.build b/tests/meson.build | 39 | diff --git a/tests/meson.build b/tests/meson.build |
40 | index 28c2525..c45e765 100644 | 40 | index 3781066..911b5fb 100644 |
41 | --- a/tests/meson.build | 41 | --- a/tests/meson.build |
42 | +++ b/tests/meson.build | 42 | +++ b/tests/meson.build |
43 | @@ -4,7 +4,7 @@ | 43 | @@ -4,7 +4,7 @@ |
@@ -49,7 +49,7 @@ index 28c2525..c45e765 100644 | |||
49 | # Resources; we cannot use gnome.compile_resources() here, because we need to | 49 | # Resources; we cannot use gnome.compile_resources() here, because we need to |
50 | # override the environment in order to use the utilities we just built instead | 50 | # override the environment in order to use the utilities we just built instead |
51 | # of the system ones | 51 | # of the system ones |
52 | @@ -166,9 +166,11 @@ endif | 52 | @@ -164,9 +164,11 @@ endif |
53 | test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep, ] | 53 | test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep, ] |
54 | test_args = [ '-k' ] | 54 | test_args = [ '-k' ] |
55 | test_env = environment() | 55 | test_env = environment() |
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/fatal-loader.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/fatal-loader.patch index 23c68a0923..3b4bf62861 100644 --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/fatal-loader.patch +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/fatal-loader.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From b511bd1efb43ffc49c753e309717a242ec686ef1 Mon Sep 17 00:00:00 2001 | 1 | From f78ab4edaee5f62663a9a4bcfa56e5c524da4474 Mon Sep 17 00:00:00 2001 |
2 | From: Ross Burton <ross.burton@intel.com> | 2 | From: Ross Burton <ross.burton@intel.com> |
3 | Date: Tue, 1 Apr 2014 17:23:36 +0100 | 3 | Date: Tue, 1 Apr 2014 17:23:36 +0100 |
4 | Subject: [PATCH] gdk-pixbuf: add an option so that loader errors are fatal | 4 | Subject: [PATCH] gdk-pixbuf: add an option so that loader errors are fatal |
@@ -8,13 +8,12 @@ non-zero if the loader had errors (missing libraries, generally). | |||
8 | 8 | ||
9 | Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/144] | 9 | Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/144] |
10 | Signed-off-by: Ross Burton <ross.burton@intel.com> | 10 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
11 | |||
12 | --- | 11 | --- |
13 | gdk-pixbuf/queryloaders.c | 19 +++++++++++++++---- | 12 | gdk-pixbuf/queryloaders.c | 19 +++++++++++++++---- |
14 | 1 file changed, 15 insertions(+), 4 deletions(-) | 13 | 1 file changed, 15 insertions(+), 4 deletions(-) |
15 | 14 | ||
16 | diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c | 15 | diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c |
17 | index 1d39b44..2b00815 100644 | 16 | index baa9a5c..9b6fa89 100644 |
18 | --- a/gdk-pixbuf/queryloaders.c | 17 | --- a/gdk-pixbuf/queryloaders.c |
19 | +++ b/gdk-pixbuf/queryloaders.c | 18 | +++ b/gdk-pixbuf/queryloaders.c |
20 | @@ -216,7 +216,7 @@ write_loader_info (GString *contents, const char *path, GdkPixbufFormat *info) | 19 | @@ -216,7 +216,7 @@ write_loader_info (GString *contents, const char *path, GdkPixbufFormat *info) |
@@ -77,7 +76,7 @@ index 1d39b44..2b00815 100644 | |||
77 | } | 76 | } |
78 | g_free (cwd); | 77 | g_free (cwd); |
79 | } | 78 | } |
80 | @@ -490,5 +498,8 @@ int main (int argc, char **argv) | 79 | @@ -492,5 +500,8 @@ int main (int argc, char **argv) |
81 | 80 | ||
82 | g_free (pixbuf_libdir); | 81 | g_free (pixbuf_libdir); |
83 | 82 | ||
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.12.bb index cca89a9059..9f825a68ef 100644 --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.12.bb | |||
@@ -22,7 +22,7 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \ | |||
22 | file://0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch \ | 22 | file://0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch \ |
23 | " | 23 | " |
24 | 24 | ||
25 | SRC_URI[sha256sum] = "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b" | 25 | SRC_URI[sha256sum] = "b9505b3445b9a7e48ced34760c3bcb73e966df3ac94c95a148cb669ab748e3c7" |
26 | 26 | ||
27 | inherit meson pkgconfig gettext pixbufcache ptest-gnome upstream-version-is-even gobject-introspection gi-docgen lib_package | 27 | inherit meson pkgconfig gettext pixbufcache ptest-gnome upstream-version-is-even gobject-introspection gi-docgen lib_package |
28 | 28 | ||
diff --git a/meta/recipes-graphics/mesa/mesa-gl_24.0.3.bb b/meta/recipes-graphics/mesa/mesa-gl_24.0.5.bb index ca160f1bfc..ca160f1bfc 100644 --- a/meta/recipes-graphics/mesa/mesa-gl_24.0.3.bb +++ b/meta/recipes-graphics/mesa/mesa-gl_24.0.5.bb | |||
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 1c9fa66c72..77e9c80fcb 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc | |||
@@ -22,7 +22,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ | |||
22 | file://0001-Revert-meson-do-not-pull-in-clc-for-clover.patch \ | 22 | file://0001-Revert-meson-do-not-pull-in-clc-for-clover.patch \ |
23 | " | 23 | " |
24 | 24 | ||
25 | SRC_URI[sha256sum] = "77aec9a2a37b7d3596ea1640b3cc53d0b5d9b3b52abed89de07e3717e91bfdbe" | 25 | SRC_URI[sha256sum] = "38cc245ca8faa3c69da6d2687f8906377001f63365348a62cc6f7fafb1e8c018" |
26 | 26 | ||
27 | UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)" | 27 | UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)" |
28 | 28 | ||
diff --git a/meta/recipes-graphics/mesa/mesa_24.0.3.bb b/meta/recipes-graphics/mesa/mesa_24.0.5.bb index 96e8aa38d6..96e8aa38d6 100644 --- a/meta/recipes-graphics/mesa/mesa_24.0.3.bb +++ b/meta/recipes-graphics/mesa/mesa_24.0.5.bb | |||
diff --git a/meta/recipes-graphics/wayland/libinput_1.25.0.bb b/meta/recipes-graphics/wayland/libinput_1.25.0.bb index 517b247fed..894858e361 100644 --- a/meta/recipes-graphics/wayland/libinput_1.25.0.bb +++ b/meta/recipes-graphics/wayland/libinput_1.25.0.bb | |||
@@ -32,7 +32,7 @@ do_configure:append() { | |||
32 | 32 | ||
33 | PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" | 33 | PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" |
34 | PACKAGECONFIG[libwacom] = "-Dlibwacom=true,-Dlibwacom=false,libwacom" | 34 | PACKAGECONFIG[libwacom] = "-Dlibwacom=true,-Dlibwacom=false,libwacom" |
35 | PACKAGECONFIG[gui] = "-Ddebug-gui=true,-Ddebug-gui=false,cairo gtk+3" | 35 | PACKAGECONFIG[gui] = "-Ddebug-gui=true,-Ddebug-gui=false,cairo gtk+3 wayland-native" |
36 | PACKAGECONFIG[tests] = "-Dtests=true -Dinstall-tests=true,-Dtests=false -Dinstall-tests=false,libcheck" | 36 | PACKAGECONFIG[tests] = "-Dtests=true -Dinstall-tests=true,-Dtests=false -Dinstall-tests=false,libcheck" |
37 | 37 | ||
38 | UDEVDIR = "`pkg-config --variable=udevdir udev`" | 38 | UDEVDIR = "`pkg-config --variable=udevdir udev`" |
diff --git a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch index 86982924a8..de0862599d 100644 --- a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch +++ b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | Upstream-Status: Pending | 1 | Upstream-Status: Inactive-Upstream [last commits over a decade ago] |
2 | 2 | ||
3 | From 14734a93bd3fc323325459e24b04795422e395e6 Mon Sep 17 00:00:00 2001 | 3 | From 14734a93bd3fc323325459e24b04795422e395e6 Mon Sep 17 00:00:00 2001 |
4 | From: Laurentiu Palcu <laurentiu.palcu@intel.com> | 4 | From: Laurentiu Palcu <laurentiu.palcu@intel.com> |
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.11.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.12.bb index 6506d775ca..570e08d5ae 100644 --- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.11.bb +++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.12.bb | |||
@@ -3,7 +3,7 @@ require xserver-xorg.inc | |||
3 | SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch \ | 3 | SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch \ |
4 | file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \ | 4 | file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \ |
5 | " | 5 | " |
6 | SRC_URI[sha256sum] = "1d3dadbd57fb86b16a018e9f5f957aeeadf744f56c0553f55737628d06d326ef" | 6 | SRC_URI[sha256sum] = "1e016e2be1b5ccdd65eac3ea08e54bd13ce8f4f6c3fb32ad6fdac4e71729a90f" |
7 | 7 | ||
8 | # These extensions are now integrated into the server, so declare the migration | 8 | # These extensions are now integrated into the server, so declare the migration |
9 | # path for in-place upgrades. | 9 | # path for in-place upgrades. |
diff --git a/meta/recipes-kernel/libtraceevent/libtraceevent/meson.patch b/meta/recipes-kernel/libtraceevent/libtraceevent/meson.patch index 38b6107136..6e96ba2167 100644 --- a/meta/recipes-kernel/libtraceevent/libtraceevent/meson.patch +++ b/meta/recipes-kernel/libtraceevent/libtraceevent/meson.patch | |||
@@ -4,7 +4,7 @@ Fixes for the Meson build of libtraceevent: | |||
4 | - Install the plugins as modules not static and versioned shared libraries | 4 | - Install the plugins as modules not static and versioned shared libraries |
5 | - Add an option to disable building the documentation (needs asciidoc and xmlto) | 5 | - Add an option to disable building the documentation (needs asciidoc and xmlto) |
6 | 6 | ||
7 | Upstream-Status: Pending | 7 | Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20240311111140.1789879-1-alex@linutronix.de/T/#u] |
8 | Signed-off-by: Ross Burton <ross.burton@arm.com> | 8 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
9 | 9 | ||
10 | diff --git a/meson.build b/meson.build | 10 | diff --git a/meson.build b/meson.build |
diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.13.7.bb b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb index 9509185bad..dddd3a5004 100644 --- a/meta/recipes-kernel/lttng/lttng-ust_2.13.7.bb +++ b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb | |||
@@ -34,7 +34,7 @@ SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ | |||
34 | file://0001-Makefile.am-update-rpath-link.patch \ | 34 | file://0001-Makefile.am-update-rpath-link.patch \ |
35 | " | 35 | " |
36 | 36 | ||
37 | SRC_URI[sha256sum] = "5fb4f17c307c8c1b79c68561e89be9562d07e7425bf40e728c4d66755342a5eb" | 37 | SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937" |
38 | 38 | ||
39 | CVE_PRODUCT = "ust" | 39 | CVE_PRODUCT = "ust" |
40 | 40 | ||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.11.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.11.bb index edd8609b7c..85143aa1b9 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.11.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.11.bb | |||
@@ -52,7 +52,7 @@ PACKAGECONFIG[libpng] = "-Dpng=enabled,-Dpng=disabled,libpng" | |||
52 | PACKAGECONFIG[libv4l2] = "-Dv4l2-libv4l2=enabled,-Dv4l2-libv4l2=disabled,v4l-utils" | 52 | PACKAGECONFIG[libv4l2] = "-Dv4l2-libv4l2=enabled,-Dv4l2-libv4l2=disabled,v4l-utils" |
53 | PACKAGECONFIG[mpg123] = "-Dmpg123=enabled,-Dmpg123=disabled,mpg123" | 53 | PACKAGECONFIG[mpg123] = "-Dmpg123=enabled,-Dmpg123=disabled,mpg123" |
54 | PACKAGECONFIG[pulseaudio] = "-Dpulse=enabled,-Dpulse=disabled,pulseaudio" | 54 | PACKAGECONFIG[pulseaudio] = "-Dpulse=enabled,-Dpulse=disabled,pulseaudio" |
55 | PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native ${QT5WAYLANDDEPENDS}" | 55 | PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native qttools-native ${QT5WAYLANDDEPENDS}" |
56 | PACKAGECONFIG[soup2] = "-Dsoup=enabled,,libsoup-2.4,,,soup3" | 56 | PACKAGECONFIG[soup2] = "-Dsoup=enabled,,libsoup-2.4,,,soup3" |
57 | PACKAGECONFIG[soup3] = "-Dsoup=enabled,,libsoup,,,soup2" | 57 | PACKAGECONFIG[soup3] = "-Dsoup=enabled,,libsoup,,,soup2" |
58 | PACKAGECONFIG[speex] = "-Dspeex=enabled,-Dspeex=disabled,speex" | 58 | PACKAGECONFIG[speex] = "-Dspeex=enabled,-Dspeex=disabled,speex" |
diff --git a/meta/recipes-sato/webkit/webkitgtk/2922af379dc70b4b1a63b01d67179eb431f03ac4.patch b/meta/recipes-sato/webkit/webkitgtk/2922af379dc70b4b1a63b01d67179eb431f03ac4.patch deleted file mode 100644 index 3067500447..0000000000 --- a/meta/recipes-sato/webkit/webkitgtk/2922af379dc70b4b1a63b01d67179eb431f03ac4.patch +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | From 2922af379dc70b4b1a63b01d67179eb431f03ac4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Catanzaro <mcatanzaro@redhat.com> | ||
3 | Date: Mon, 18 Mar 2024 11:14:54 -0700 | ||
4 | Subject: [PATCH] REGRESSION(274077@main): failure to build on i586 (and likely | ||
5 | other 32bit arches): static assertion failed: Timer should stay small | ||
6 | https://bugs.webkit.org/show_bug.cgi?id=271108 | ||
7 | |||
8 | Unreviewed build fix. This changes SameSizeOfTimer to ensure it matches | ||
9 | the size of Timer on 32-bit platforms. | ||
10 | |||
11 | * Source/WebCore/platform/Timer.cpp: | ||
12 | |||
13 | Canonical link: https://commits.webkit.org/276282@main | ||
14 | |||
15 | Upstream-Status: Backport [https://github.com/WebKit/WebKit/commit/2922af379dc70b4b1a63b01d67179eb431f03ac4] | ||
16 | |||
17 | Signed-off-by: Markus Volk <f_l_k@t-online.de> | ||
18 | --- | ||
19 | Source/WebCore/platform/Timer.cpp | 6 +++++- | ||
20 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/Source/WebCore/platform/Timer.cpp b/Source/WebCore/platform/Timer.cpp | ||
23 | index 4f7c0f5c39ca9..0f3734cca2474 100644 | ||
24 | --- a/Source/WebCore/platform/Timer.cpp | ||
25 | +++ b/Source/WebCore/platform/Timer.cpp | ||
26 | @@ -263,7 +263,11 @@ struct SameSizeAsTimer { | ||
27 | |||
28 | WeakPtr<TimerAlignment> timerAlignment; | ||
29 | double times[2]; | ||
30 | - void* pointers[3]; | ||
31 | + void* pointers[2]; | ||
32 | +#if CPU(ADDRESS32) | ||
33 | + uint8_t bitfields; | ||
34 | +#endif | ||
35 | + void* pointer; | ||
36 | }; | ||
37 | |||
38 | static_assert(sizeof(Timer) == sizeof(SameSizeAsTimer), "Timer should stay small"); | ||
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.44.0.bb b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb index 0819f6de0d..29e12bb8c5 100644 --- a/meta/recipes-sato/webkit/webkitgtk_2.44.0.bb +++ b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb | |||
@@ -16,9 +16,8 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \ | |||
16 | file://no-musttail-arm.patch \ | 16 | file://no-musttail-arm.patch \ |
17 | file://t6-not-declared.patch \ | 17 | file://t6-not-declared.patch \ |
18 | file://30e1d5e22213fdaca2a29ec3400c927d710a37a8.patch \ | 18 | file://30e1d5e22213fdaca2a29ec3400c927d710a37a8.patch \ |
19 | file://2922af379dc70b4b1a63b01d67179eb431f03ac4.patch \ | ||
20 | " | 19 | " |
21 | SRC_URI[sha256sum] = "c66530e41ba59b1edba4ee89ef20b2188e273bed0497e95084729e3cfbe30c87" | 20 | SRC_URI[sha256sum] = "425b1459b0f04d0600c78d1abb5e7edfa3c060a420f8b231e9a6a2d5d29c5561" |
22 | 21 | ||
23 | inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gi-docgen | 22 | inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gi-docgen |
24 | 23 | ||
diff --git a/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch b/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch index a274f3a16e..b46dc76a86 100644 --- a/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch +++ b/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch | |||
@@ -7,7 +7,7 @@ The disabled tests rely on timing to pass correctly. On a virtualized | |||
7 | system under heavy load, these tests randomly fail because they miss | 7 | system under heavy load, these tests randomly fail because they miss |
8 | a timer or other timing related issues. | 8 | a timer or other timing related issues. |
9 | 9 | ||
10 | Upstream-Status: Pending | 10 | Upstream-Status: Submitted [https://github.com/apache/apr/pull/54] |
11 | Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com> | 11 | Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com> |
12 | 12 | ||
13 | --- | 13 | --- |
diff --git a/meta/recipes-support/icu/icu/fix-install-manx.patch b/meta/recipes-support/icu/icu/fix-install-manx.patch index 7526bde370..16cabc8264 100644 --- a/meta/recipes-support/icu/icu/fix-install-manx.patch +++ b/meta/recipes-support/icu/icu/fix-install-manx.patch | |||
@@ -11,7 +11,9 @@ and one process tries to chown a file that the other process has just deleted. | |||
11 | Also install-manx should be a phony target, and for clarity use $^ instead of $? | 11 | Also install-manx should be a phony target, and for clarity use $^ instead of $? |
12 | in the install command. | 12 | in the install command. |
13 | 13 | ||
14 | Upstream-Status: Pending | 14 | Upstream ticket: https://unicode-org.atlassian.net/jira/software/c/projects/ICU/issues/ICU-21172 |
15 | |||
16 | Upstream-Status: Submitted [https://github.com/unicode-org/icu/pull/2966] | ||
15 | Signed-off-by: Ross Burton <ross.burton@intel.com> | 17 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
16 | --- | 18 | --- |
17 | Makefile.in | 8 ++++---- | 19 | Makefile.in | 8 ++++---- |
diff --git a/meta/recipes-support/libusb/libusb1_1.0.27.bb b/meta/recipes-support/libusb/libusb1_1.0.27.bb index f2431d75c8..5bf854f95d 100644 --- a/meta/recipes-support/libusb/libusb1_1.0.27.bb +++ b/meta/recipes-support/libusb/libusb1_1.0.27.bb | |||
@@ -8,6 +8,8 @@ SECTION = "libs" | |||
8 | LICENSE = "LGPL-2.1-or-later" | 8 | LICENSE = "LGPL-2.1-or-later" |
9 | LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" | 9 | LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" |
10 | 10 | ||
11 | CVE_PRODUCT = "libusb" | ||
12 | |||
11 | BBCLASSEXTEND = "native nativesdk" | 13 | BBCLASSEXTEND = "native nativesdk" |
12 | 14 | ||
13 | SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libusb-${PV}.tar.bz2 \ | 15 | SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libusb-${PV}.tar.bz2 \ |
diff --git a/meta/recipes-support/ptest-runner/ptest-runner_2.4.3.bb b/meta/recipes-support/ptest-runner/ptest-runner_2.4.4.bb index e6668da01f..2263e07280 100644 --- a/meta/recipes-support/ptest-runner/ptest-runner_2.4.3.bb +++ b/meta/recipes-support/ptest-runner/ptest-runner_2.4.4.bb | |||
@@ -7,7 +7,7 @@ HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/ptest-runner2/about/" | |||
7 | LICENSE = "GPL-2.0-or-later" | 7 | LICENSE = "GPL-2.0-or-later" |
8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe" | 8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe" |
9 | 9 | ||
10 | SRCREV = "92c1b97bfdb4a94acc1cabcaf97eef52dc29144c" | 10 | SRCREV = "95f528cff0bc52903b98c292d4a322fcffa74471" |
11 | PV .= "+git" | 11 | PV .= "+git" |
12 | 12 | ||
13 | SRC_URI = "git://git.yoctoproject.org/ptest-runner2;branch=master;protocol=https \ | 13 | SRC_URI = "git://git.yoctoproject.org/ptest-runner2;branch=master;protocol=https \ |
diff --git a/meta/recipes-support/serf/serf/SConstruct.stop.creating.directories.without.sandbox-install.prefix.patch b/meta/recipes-support/serf/serf/SConstruct.stop.creating.directories.without.sandbox-install.prefix.patch index 91640d6044..c8e6eddfec 100644 --- a/meta/recipes-support/serf/serf/SConstruct.stop.creating.directories.without.sandbox-install.prefix.patch +++ b/meta/recipes-support/serf/serf/SConstruct.stop.creating.directories.without.sandbox-install.prefix.patch | |||
@@ -31,7 +31,7 @@ ERROR: scons install execution failed. | |||
31 | and the installed paths (including the paths inside libserf*.pc) | 31 | and the installed paths (including the paths inside libserf*.pc) |
32 | look correct | 32 | look correct |
33 | 33 | ||
34 | Upstream-Status: Pending | 34 | Upstream-Status: Inappropriate [removes block of code rather than fixing the problem in that block] |
35 | 35 | ||
36 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | 36 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> |
37 | 37 | ||
diff --git a/meta/recipes-support/taglib/taglib_2.0.bb b/meta/recipes-support/taglib/taglib_2.0.1.bb index 4bf9be15ae..14f99aabbc 100644 --- a/meta/recipes-support/taglib/taglib_2.0.bb +++ b/meta/recipes-support/taglib/taglib_2.0.1.bb | |||
@@ -11,7 +11,7 @@ DEPENDS = "zlib utfcpp" | |||
11 | 11 | ||
12 | SRC_URI = "http://taglib.github.io/releases/${BP}.tar.gz" | 12 | SRC_URI = "http://taglib.github.io/releases/${BP}.tar.gz" |
13 | 13 | ||
14 | SRC_URI[sha256sum] = "e36ea877a6370810b97d84cf8f72b1e4ed205149ab3ac8232d44c850f38a2859" | 14 | SRC_URI[sha256sum] = "08c0a27b96aa5c4e23060fe0b6f93102ee9091a9385257b9d0ddcf467de0d925" |
15 | 15 | ||
16 | UPSTREAM_CHECK_URI = "https://taglib.org/" | 16 | UPSTREAM_CHECK_URI = "https://taglib.org/" |
17 | UPSTREAM_CHECK_REGEX = "taglib-(?P<pver>\d+(\.\d+)+)\.tar" | 17 | UPSTREAM_CHECK_REGEX = "taglib-(?P<pver>\d+(\.\d+)+)\.tar" |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 6674e67267..05161942b7 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -661,7 +661,18 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
661 | srctree_localdir = os.path.join(srctree, 'oe-local-files') | 661 | srctree_localdir = os.path.join(srctree, 'oe-local-files') |
662 | 662 | ||
663 | if sync: | 663 | if sync: |
664 | bb.process.run('git fetch file://' + srcsubdir + ' ' + devbranch + ':' + devbranch, cwd=srctree) | 664 | try: |
665 | logger.info('Backing up current %s branch as branch: %s.bak' % (devbranch, devbranch)) | ||
666 | bb.process.run('git branch -f ' + devbranch + '.bak', cwd=srctree) | ||
667 | |||
668 | # Use git fetch to update the source with the current recipe | ||
669 | # To be able to update the currently checked out branch with | ||
670 | # possibly new history (no fast-forward) git needs to be told | ||
671 | # that's ok | ||
672 | logger.info('Syncing source files including patches to git branch: %s' % devbranch) | ||
673 | bb.process.run('git fetch --update-head-ok --force file://' + srcsubdir + ' ' + devbranch + ':' + devbranch, cwd=srctree) | ||
674 | except bb.process.ExecutionError as e: | ||
675 | raise DevtoolError("Error when syncing source files to local checkout: %s" % str(e)) | ||
665 | 676 | ||
666 | # Move the oe-local-files directory to srctree. | 677 | # Move the oe-local-files directory to srctree. |
667 | # As oe-local-files is not part of the constructed git tree, | 678 | # As oe-local-files is not part of the constructed git tree, |
@@ -893,7 +904,10 @@ def modify(args, config, basepath, workspace): | |||
893 | (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_revs["."], cwd=srctree) | 904 | (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_revs["."], cwd=srctree) |
894 | commits["."] = stdout.split() | 905 | commits["."] = stdout.split() |
895 | check_commits = True | 906 | check_commits = True |
896 | (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) | 907 | try: |
908 | (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) | ||
909 | except bb.process.ExecutionError: | ||
910 | stdout = "" | ||
897 | for line in stdout.splitlines(): | 911 | for line in stdout.splitlines(): |
898 | (rev, submodule_path) = line.split() | 912 | (rev, submodule_path) = line.split() |
899 | submodule = os.path.relpath(submodule_path, srctree) | 913 | submodule = os.path.relpath(submodule_path, srctree) |
@@ -1452,8 +1466,10 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1452 | 1. updated - files that already exist in SRCURI | 1466 | 1. updated - files that already exist in SRCURI |
1453 | 2. added - new files files that don't exist in SRCURI | 1467 | 2. added - new files files that don't exist in SRCURI |
1454 | 3 removed - files that exist in SRCURI but not in exported files | 1468 | 3 removed - files that exist in SRCURI but not in exported files |
1455 | In each dict the key is the 'basepath' of the URI and value is the | 1469 | In each dict the key is the 'basepath' of the URI and value is: |
1456 | absolute path to the existing file in recipe space (if any). | 1470 | - for updated and added dicts, a dict with 1 optionnal key: |
1471 | - 'path': the absolute path to the existing file in recipe space (if any) | ||
1472 | - for removed dict, the absolute path to the existing file in recipe space | ||
1457 | """ | 1473 | """ |
1458 | import oe.recipeutils | 1474 | import oe.recipeutils |
1459 | 1475 | ||
@@ -1535,9 +1551,9 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1535 | origpath = existing_files.pop(fname) | 1551 | origpath = existing_files.pop(fname) |
1536 | workpath = os.path.join(local_files_dir, fname) | 1552 | workpath = os.path.join(local_files_dir, fname) |
1537 | if not filecmp.cmp(origpath, workpath): | 1553 | if not filecmp.cmp(origpath, workpath): |
1538 | updated[fname] = origpath | 1554 | updated[fname] = {'path' : origpath} |
1539 | elif fname != '.gitignore': | 1555 | elif fname != '.gitignore': |
1540 | added[fname] = None | 1556 | added[fname] = {} |
1541 | 1557 | ||
1542 | workdir = rd.getVar('WORKDIR') | 1558 | workdir = rd.getVar('WORKDIR') |
1543 | s = rd.getVar('S') | 1559 | s = rd.getVar('S') |
@@ -1554,7 +1570,7 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1554 | if os.path.exists(fpath): | 1570 | if os.path.exists(fpath): |
1555 | origpath = existing_files.pop(fname) | 1571 | origpath = existing_files.pop(fname) |
1556 | if not filecmp.cmp(origpath, fpath): | 1572 | if not filecmp.cmp(origpath, fpath): |
1557 | updated[fpath] = origpath | 1573 | updated[fpath] = {'path' : origpath} |
1558 | 1574 | ||
1559 | removed = existing_files | 1575 | removed = existing_files |
1560 | return (updated, added, removed) | 1576 | return (updated, added, removed) |
@@ -1640,7 +1656,8 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1640 | redirect_output=dry_run_outdir) | 1656 | redirect_output=dry_run_outdir) |
1641 | else: | 1657 | else: |
1642 | files_dir = _determine_files_dir(rd) | 1658 | files_dir = _determine_files_dir(rd) |
1643 | for basepath, path in upd_f.items(): | 1659 | for basepath, param in upd_f.items(): |
1660 | path = param['path'] | ||
1644 | logger.info('Updating file %s%s' % (basepath, dry_run_suffix)) | 1661 | logger.info('Updating file %s%s' % (basepath, dry_run_suffix)) |
1645 | if os.path.isabs(basepath): | 1662 | if os.path.isabs(basepath): |
1646 | # Original file (probably with subdir pointing inside source tree) | 1663 | # Original file (probably with subdir pointing inside source tree) |
@@ -1650,7 +1667,8 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1650 | _move_file(os.path.join(local_files_dir, basepath), path, | 1667 | _move_file(os.path.join(local_files_dir, basepath), path, |
1651 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) | 1668 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) |
1652 | update_srcuri= True | 1669 | update_srcuri= True |
1653 | for basepath, path in new_f.items(): | 1670 | for basepath, param in new_f.items(): |
1671 | path = param['path'] | ||
1654 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) | 1672 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) |
1655 | _move_file(os.path.join(local_files_dir, basepath), | 1673 | _move_file(os.path.join(local_files_dir, basepath), |
1656 | os.path.join(files_dir, basepath), | 1674 | os.path.join(files_dir, basepath), |
@@ -1772,7 +1790,8 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1772 | else: | 1790 | else: |
1773 | # Update existing files | 1791 | # Update existing files |
1774 | files_dir = _determine_files_dir(rd) | 1792 | files_dir = _determine_files_dir(rd) |
1775 | for basepath, path in upd_f.items(): | 1793 | for basepath, param in upd_f.items(): |
1794 | path = param['path'] | ||
1776 | logger.info('Updating file %s' % basepath) | 1795 | logger.info('Updating file %s' % basepath) |
1777 | if os.path.isabs(basepath): | 1796 | if os.path.isabs(basepath): |
1778 | # Original file (probably with subdir pointing inside source tree) | 1797 | # Original file (probably with subdir pointing inside source tree) |
@@ -1806,7 +1825,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1806 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) | 1825 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) |
1807 | updatefiles = True | 1826 | updatefiles = True |
1808 | # Add any new files | 1827 | # Add any new files |
1809 | for basepath, path in new_f.items(): | 1828 | for basepath, param in new_f.items(): |
1810 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) | 1829 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) |
1811 | _move_file(os.path.join(local_files_dir, basepath), | 1830 | _move_file(os.path.join(local_files_dir, basepath), |
1812 | os.path.join(files_dir, basepath), | 1831 | os.path.join(files_dir, basepath), |
diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py index c560831442..a85a2f2786 100644 --- a/scripts/lib/recipetool/create_go.py +++ b/scripts/lib/recipetool/create_go.py | |||
@@ -16,7 +16,7 @@ from html.parser import HTMLParser | |||
16 | from recipetool.create import RecipeHandler, handle_license_vars | 16 | from recipetool.create import RecipeHandler, handle_license_vars |
17 | from recipetool.create import guess_license, tidy_licenses, fixup_license | 17 | from recipetool.create import guess_license, tidy_licenses, fixup_license |
18 | from recipetool.create import determine_from_url | 18 | from recipetool.create import determine_from_url |
19 | from urllib.error import URLError | 19 | from urllib.error import URLError, HTTPError |
20 | 20 | ||
21 | import bb.utils | 21 | import bb.utils |
22 | import json | 22 | import json |
@@ -225,7 +225,7 @@ class GoRecipeHandler(RecipeHandler): | |||
225 | 225 | ||
226 | def __init__(self): | 226 | def __init__(self): |
227 | super().__init__() | 227 | super().__init__() |
228 | self.__srv = [] | 228 | self.__srv = {} |
229 | 229 | ||
230 | def handle_starttag(self, tag, attrs): | 230 | def handle_starttag(self, tag, attrs): |
231 | if tag == 'meta' and list( | 231 | if tag == 'meta' and list( |
@@ -233,36 +233,34 @@ class GoRecipeHandler(RecipeHandler): | |||
233 | content = list( | 233 | content = list( |
234 | filter(lambda a: (a[0] == 'content'), attrs)) | 234 | filter(lambda a: (a[0] == 'content'), attrs)) |
235 | if content: | 235 | if content: |
236 | self.__srv = content[0][1].split() | 236 | srv = content[0][1].split() |
237 | self.__srv[srv[0]] = srv | ||
237 | 238 | ||
238 | @property | 239 | def go_import(self, modulepath): |
239 | def import_prefix(self): | 240 | if modulepath in self.__srv: |
240 | return self.__srv[0] if len(self.__srv) else None | 241 | srv = self.__srv[modulepath] |
241 | 242 | return GoImport(srv[0], srv[1], srv[2], None) | |
242 | @property | 243 | return None |
243 | def vcs(self): | ||
244 | return self.__srv[1] if len(self.__srv) else None | ||
245 | |||
246 | @property | ||
247 | def repourl(self): | ||
248 | return self.__srv[2] if len(self.__srv) else None | ||
249 | 244 | ||
250 | url = url.geturl() + "?go-get=1" | 245 | url = url.geturl() + "?go-get=1" |
251 | req = urllib.request.Request(url) | 246 | req = urllib.request.Request(url) |
252 | 247 | ||
253 | try: | 248 | try: |
254 | resp = urllib.request.urlopen(req) | 249 | body = urllib.request.urlopen(req).read() |
255 | 250 | except HTTPError as http_err: | |
251 | logger.warning( | ||
252 | "Unclean status when fetching page from [%s]: %s", url, str(http_err)) | ||
253 | body = http_err.fp.read() | ||
256 | except URLError as url_err: | 254 | except URLError as url_err: |
257 | logger.warning( | 255 | logger.warning( |
258 | "Failed to fetch page from [%s]: %s", url, str(url_err)) | 256 | "Failed to fetch page from [%s]: %s", url, str(url_err)) |
259 | return None | 257 | return None |
260 | 258 | ||
261 | parser = GoImportHTMLParser() | 259 | parser = GoImportHTMLParser() |
262 | parser.feed(resp.read().decode('utf-8')) | 260 | parser.feed(body.decode('utf-8')) |
263 | parser.close() | 261 | parser.close() |
264 | 262 | ||
265 | return GoImport(parser.import_prefix, parser.vcs, parser.repourl, None) | 263 | return parser.go_import(modulepath) |
266 | 264 | ||
267 | def __resolve_from_golang_proxy(self, modulepath, version): | 265 | def __resolve_from_golang_proxy(self, modulepath, version): |
268 | """ | 266 | """ |