summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYogesh Tyagi <yogesh.tyagi@intel.com>2026-05-12 23:14:43 +0800
committerYogesh Tyagi <yogesh.tyagi@intel.com>2026-05-12 23:28:51 +0800
commit2a8d44bf7b9faca3935b851107c70754e1cdcae3 (patch)
treea6f634dc1468030bd1a10ee20cf1eaa689d6985b
parent447287c57ef405c37271178b26db7750c6bdaf1c (diff)
downloadmeta-intel-2a8d44bf7b9faca3935b851107c70754e1cdcae3.tar.gz
libipt: drop pttc nasm patch and runtime QA case
The 0001-pttc-use-nasm-instead-of-yasm.patch local patch reworked upstream pttc to invoke nasm in place of the unmaintained yasm assembler. The patch was submitted upstream (https://github.com/intel/libipt/pull/120) but has not been merged, and carrying it locally is the only reason meta-intel needs to diverge from a pristine stable/v2.2 checkout. Drop the patch and let pttc fall back to upstream's stock yasm-based behaviour. This matches what Fedora/RHEL already does for the libipt package: ship libipt without yasm support and let libipt's own CMake skip the yasm-driven ptt tests automatically when yasm isn't available. Native nasm support in pttc remains a future upstream enhancement; when it lands we can revisit and re-add a runtime case that exercises pttc end-to-end against nasm. The libipt runtime test (lib/oeqa/runtime/cases/libipt.py) gated on the 'nasm' package and ran pttc on the shipped sample .ptt files. With the patch removed pttc invokes yasm at runtime, so the test would fail on every DUT (yasm is not pulled in as an RDEPENDS anywhere in meta-intel). The test exercised pttc/ptdump end-to-end, not the libipt library itself, and library coverage is provided indirectly by anything that links against libipt2; the runtime case has no remaining utility once the assembler-substitution patch is gone. No change to the recipe's PACKAGES, FILES, or EXTRA_OECMAKE: the libipt-test sub-package still ships pttc, ptdump, ptseg and the .ptt sample sources under ${bindir}/libipt for any user that installs yasm out-of-band and wants to drive pttc manually. This matches the Fedora libipt RPM behaviour. Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
-rw-r--r--lib/oeqa/runtime/cases/libipt.py23
-rw-r--r--recipes-support/libipt/libipt/0001-pttc-use-nasm-instead-of-yasm.patch177
-rw-r--r--recipes-support/libipt/libipt_2.2.bb4
3 files changed, 1 insertions, 203 deletions
diff --git a/lib/oeqa/runtime/cases/libipt.py b/lib/oeqa/runtime/cases/libipt.py
deleted file mode 100644
index dd31a538..00000000
--- a/lib/oeqa/runtime/cases/libipt.py
+++ /dev/null
@@ -1,23 +0,0 @@
1from oeqa.runtime.case import OERuntimeTestCase
2from oeqa.runtime.decorator.package import OEHasPackage
3from oeqa.core.decorator.depends import OETestDepends
4
5class LibiptTest(OERuntimeTestCase):
6 libipt_bin_dir = '/usr/bin/libipt/'
7
8 @classmethod
9 def tearDownClass(cls):
10 cls.tc.target.run('rm /tmp/loop-tnt*')
11
12 @OEHasPackage(['libipt', 'libipt2'])
13 @OEHasPackage(['libipt-test'])
14 @OEHasPackage(['nasm'])
15 def test_libipt_can_generate_trace_packet(self):
16 (status, output) = self.target.run('cd /tmp; %spttc %s/tests/loop-tnt.ptt' %
17 (self.libipt_bin_dir, self.libipt_bin_dir))
18 self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
19
20 @OETestDepends(['libipt.LibiptTest.test_libipt_can_generate_trace_packet'])
21 def test_libipt_can_perform_trace_packet_dump(self):
22 (status, output) = self.target.run('cd /tmp; %sptdump loop-tnt.pt' % self.libipt_bin_dir)
23 self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
diff --git a/recipes-support/libipt/libipt/0001-pttc-use-nasm-instead-of-yasm.patch b/recipes-support/libipt/libipt/0001-pttc-use-nasm-instead-of-yasm.patch
deleted file mode 100644
index 052d5aa6..00000000
--- a/recipes-support/libipt/libipt/0001-pttc-use-nasm-instead-of-yasm.patch
+++ /dev/null
@@ -1,177 +0,0 @@
1From 2a62be5f20707d350e9be6406a853ecdf4be4051 Mon Sep 17 00:00:00 2001
2From: Yogesh Tyagi <yogesh.tyagi@intel.com>
3Date: Sun, 1 Feb 2026 22:54:34 +0800
4Subject: [PATCH] pttc: Add support for nasm assembler
5
6Replace yasm with nasm as the default assembler for pttc. Yasm is no
7longer actively maintained and has known security vulnerabilities, while
8nasm is actively developed and provides equivalent functionality.
9
10Key changes:
111. Update assembler invocation from 'yasm' to 'nasm'
122. Remove '-L nasm' option (nasm doesn't need this flag)
133. Adjust argv array indices after removing the flag
144. Support both yasm and nasm org directive formats:
15 - yasm: [org 0x100000]
16 - nasm: org 0x100000
175. Handle nasm's listing format which lacks %line directives by
18 implementing 1:1 line mapping fallback for source correlation
19
20The changes maintain backward compatibility with existing .ptt test files
21while enabling nasm as the preferred assembler.
22
23Tested with:
24- test/src/loop-tnt.ptt
25- test/src/dump-all-packets.ptt
26
27Both tests generate valid PT traces that can be decoded with ptdump.
28
29Upstream-Status: Submitted [https://github.com/intel/libipt/pull/120]
30
31Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
32---
33 doc/howto_pttc.md | 6 ++---
34 pttc/src/yasm.c | 63 +++++++++++++++++++++++++++++++++++++++--------
35 2 files changed, 56 insertions(+), 13 deletions(-)
36
37diff --git a/doc/howto_pttc.md b/doc/howto_pttc.md
38index e7308cdb..c356103b 100644
39--- a/doc/howto_pttc.md
40+++ b/doc/howto_pttc.md
41@@ -31,7 +31,7 @@ Testing the Intel(R) Processor Trace (Intel PT) Decoder Library and Samples {#pt
42 !-->
43
44 This chapter documents how to use the pttc tool to generate and run tests.
45-Pttc takes a yasm assembly file and creates a Processor Trace stream from
46+Pttc takes a nasm assembly file and creates a Processor Trace stream from
47 special directives in its input.
48
49
50@@ -49,7 +49,7 @@ directory:
51 file-<tool>.exp
52 file-<src>.sb
53
54-The `.lst` and `.bin` files are generated by a call to yasm. The `.pt` file
55+The `.lst` and `.bin` files are generated by a call to nasm. The `.pt` file
56 contains the Processor Trace and the `.exp` files contain the content of the
57 comments after the `.exp` directive for tool `<tool>` (see below). The `.sb`
58 files contain sideband infomrmation from source `<src>` (see below).
59@@ -60,7 +60,7 @@ Pttc prints the filenames of the generated `.exp` and `.sb` files to stdout.
60 Syntax
61 ------
62
63-Pttc allows annotations in the comments of yasm assembler source files. The
64+Pttc allows annotations in the comments of nasm assembler source files. The
65 parser recognizes all comments that contain the `@pt` directive marker.
66
67 Every pt directive can be preceded by a label name followed by a colon (`:`).
68diff --git a/pttc/src/yasm.c b/pttc/src/yasm.c
69index 2f3020d1..98f6d846 100644
70--- a/pttc/src/yasm.c
71+++ b/pttc/src/yasm.c
72@@ -155,7 +155,7 @@ static int lookup_section_vstart(struct label *l, char *line,
73 }
74
75 static const char key_section[] = "[section";
76-static const char key_org[] = "[org";
77+static const char *key_org[] = {"[org", "org", NULL};
78
79 int parse_yasm_labels(struct label *l, const struct text *t)
80 {
81@@ -192,12 +192,33 @@ int parse_yasm_labels(struct label *l, const struct text *t)
82 continue;
83 }
84
85- tmp = strstr(line, key_org);
86- if (tmp) {
87+ /* Try both yasm format "[org" and nasm format "org" */
88+ tmp = NULL;
89+ int org_style = -1;
90+ for (int j = 0; key_org[j] != NULL; j++) {
91+ tmp = strstr(line, key_org[j]);
92+ if (tmp) {
93+ org_style = j;
94+ break;
95+ }
96+ }
97+
98+ if (tmp && org_style >= 0) {
99 char *org;
100
101- org = tmp + sizeof(key_org) - 1;
102- tmp = strstr(org, "]");
103+ org = tmp + strlen(key_org[org_style]);
104+ /* For yasm format "[org", look for ] */
105+ if (org_style == 0) {
106+ tmp = strstr(org, "]");
107+ } else {
108+ /* For nasm, skip whitespace to find hex value */
109+ while (isspace(*org))
110+ org++;
111+ tmp = org;
112+ /* Find end of hex number */
113+ while (*tmp && !isspace(*tmp))
114+ tmp++;
115+ }
116 if (!tmp)
117 return -err_no_org_directive;
118
119@@ -720,18 +741,17 @@ error:
120 static int yasm_run(struct yasm *y)
121 {
122 char *argv[] = {
123- "yasm",
124+ "nasm",
125 "<pttfile>",
126 "-f", "bin",
127 "-o", "<binfile>",
128- "-L", "nasm",
129 "-l", "<lstfile>",
130 NULL,
131 };
132
133 argv[1] = y->pttfile;
134 argv[5] = y->binfile;
135- argv[9] = y->lstfile;
136+ argv[7] = y->lstfile;
137
138 return run(argv[0], argv);
139 }
140@@ -825,9 +845,32 @@ static int yasm_advance_next_line(struct yasm *y)
141 /* if line number or increment in the previous line
142 * directive is <= 0, the current lst line has no
143 * corresponding line in the source file.
144+ *
145+ * For nasm compatibility: if no %line directives have been
146+ * seen yet, assume 1:1 mapping with source file.
147 */
148- if (y->st_asm->n <= 0 || y->st_asm->inc <= 0)
149- continue;
150+ if (y->st_asm->n <= 0 || y->st_asm->inc <= 0) {
151+ /* If we haven't seen any %line directive, try to use
152+ * the source file directly with 1:1 line mapping.
153+ */
154+ if (!y->st_asm->filename || y->st_asm->filename[0] == '\0') {
155+ /* Set to source .ptt file for first time */
156+ st_set_file(y->st_asm, y->pttfile, 1, 1);
157+ }
158+
159+ /* Calculate source line from listing line for nasm */
160+ asm_line = (int)y->lst_curr_line;
161+
162+ /* Read from source file at same line number */
163+ errcode = fl_getline(y->fl, s, (size_t) sizeof(s),
164+ y->st_asm->filename,
165+ (size_t) asm_line - 1u);
166+ if (errcode < 0)
167+ continue; /* Skip if can't read source line */
168+
169+ errcode = st_update(y->st_asm, s);
170+ break;
171+ }
172
173 /* finally the current line in the lst file can be
174 * correlated to the source file, so we retrieve the
175--
1762.34.1
177
diff --git a/recipes-support/libipt/libipt_2.2.bb b/recipes-support/libipt/libipt_2.2.bb
index 47f74f68..ca1edb7f 100644
--- a/recipes-support/libipt/libipt_2.2.bb
+++ b/recipes-support/libipt/libipt_2.2.bb
@@ -9,9 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=fcee2b5da70c8e2e58c5f4d1f2d5788a"
9 9
10inherit pkgconfig cmake 10inherit pkgconfig cmake
11 11
12SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.2 \ 12SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.2"
13 file://0001-pttc-use-nasm-instead-of-yasm.patch \
14 "
15 13
16SRCREV = "eecdf779a35384235d3c32a6213024f53368cb60" 14SRCREV = "eecdf779a35384235d3c32a6213024f53368cb60"
17 15