-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
313 lines (287 loc) · 15.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!DOCTYPE html>
<html lang="en" dir="auto">
<head>
<meta name="generator" content="Hugo 0.139.4"><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="index, follow">
<title>Po-Yao's blog</title>
<meta name="description" content="">
<meta name="author" content="張博堯 (Po-Yao Chang)">
<link rel="canonical" href="http://poyaoc97.github.io/">
<link crossorigin="anonymous" href="/assets/css/stylesheet.d6fcd20a4fb86efa4dfac8ec95da60244cc8871042183da1ef28e3a762ad79c8.css" integrity="sha256-1vzSCk+4bvpN+sjsldpgJEzIhxBCGD2h7yjjp2Ktecg=" rel="preload stylesheet" as="style">
<link rel="icon" href="http://poyaoc97.github.io/favicon.ico">
<link rel="icon" type="image/png" sizes="16x16" href="http://poyaoc97.github.io/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="http://poyaoc97.github.io/favicon-32x32.png">
<link rel="apple-touch-icon" href="http://poyaoc97.github.io/apple-touch-icon.png">
<link rel="mask-icon" href="http://poyaoc97.github.io/safari-pinned-tab.svg">
<meta name="theme-color" content="#2e2e33">
<meta name="msapplication-TileColor" content="#2e2e33">
<link rel="alternate" type="application/rss+xml" href="http://poyaoc97.github.io/index.xml">
<link rel="alternate" type="application/json" href="http://poyaoc97.github.io/index.json">
<link rel="alternate" hreflang="en" href="http://poyaoc97.github.io/">
<noscript>
<style>
#theme-toggle,
.top-link {
display: none;
}
</style>
<style>
@media (prefers-color-scheme: dark) {
:root {
--theme: rgb(29, 30, 32);
--entry: rgb(46, 46, 51);
--primary: rgb(218, 218, 219);
--secondary: rgb(155, 156, 157);
--tertiary: rgb(65, 66, 68);
--content: rgb(196, 196, 197);
--code-block-bg: rgb(46, 46, 51);
--code-bg: rgb(55, 56, 62);
--border: rgb(51, 51, 51);
}
.list {
background: var(--theme);
}
.list:not(.dark)::-webkit-scrollbar-track {
background: 0 0;
}
.list:not(.dark)::-webkit-scrollbar-thumb {
border-color: var(--theme);
}
}
</style>
</noscript><meta property="og:url" content="http://poyaoc97.github.io/">
<meta property="og:site_name" content="Po-Yao's blog">
<meta property="og:title" content="Po-Yao's blog">
<meta property="og:locale" content="en">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Po-Yao's blog">
<meta name="twitter:description" content="">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Po-Yao's blog",
"url": "http://poyaoc97.github.io/",
"description": "",
"logo": "http://poyaoc97.github.io/favicon.ico",
"sameAs": [
]
}
</script>
</head>
<body class="list" id="top">
<script>
if (localStorage.getItem("pref-theme") === "dark") {
document.body.classList.add('dark');
} else if (localStorage.getItem("pref-theme") === "light") {
document.body.classList.remove('dark')
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
}
</script>
<header class="header">
<nav class="nav">
<div class="logo">
<a href="http://poyaoc97.github.io/" accesskey="h" title="Po-Yao's blog (Alt + H)">Po-Yao's blog</a>
<div class="logo-switches">
<button id="theme-toggle" accesskey="t" title="(Alt + T)">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</div>
</div>
<ul id="menu">
<li>
<a href="http://poyaoc97.github.io/archives/" title="Archive">
<span>Archive</span>
</a>
</li>
<li>
<a href="http://poyaoc97.github.io/about/" title="About">
<span>About</span>
</a>
</li>
<li>
<a href="https://github.com/poyaoc97" title="GitHub">
<span>GitHub</span>
<svg fill="none" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2.5" viewBox="0 0 24 24" height="12" width="12">
<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"></path>
<path d="M15 3h6v6"></path>
<path d="M10 14L21 3"></path>
</svg>
</a>
</li>
</ul>
</nav>
</header>
<main class="main">
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">Fixed a Bug Crashing Clang
</h2>
</header>
<div class="entry-content">
<p>An ill-formed C++ code snippet Before the fix, this following C++ snippet would crash Clang. From the bug report, we can see how a user might accidentally omit the function name when they meant to declare a member function on line 3.
To many people’s surprise, line 3 is actually parsed as a member variable declaration. The parantheses are insignificant here unlike when declaring a pointer to function or array. So line 3 is essentially T A<T>{};. The template parameter there is ill-formed and is handled by 942c03910aef.
...</p>
</div>
<footer class="entry-footer"><span title='2022-03-24 00:00:00 +0000 UTC'>March 24, 2022</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to Fixed a Bug Crashing Clang" href="http://poyaoc97.github.io/posts/2022-03-24-clang/"></a>
</article>
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">C++ Trivia;
</h2>
</header>
<div class="entry-content">
<p>I was browsing 🫣 the latest working draft of the ISO C++ Standard (https://eel.is/c++draft/) and then I found that what a single semicolon is called grammatically depends on where it appears. Cool beans 😎!
Here’s a screenshot illustrating my findings (engorgio): The top half is a piece of valid C++ code stored in sc.cpp and the bottom half is its Clang AST dump with unimportant parts removed.
The ; in the global scope on line 1 of sc.cpp is an empty-declaration as noted in [decl.pre]p1. The grammar production goes:
translation-unit
-> declaration-seq
-> declaration
-> empty-declaration
-> ;
...</p>
</div>
<footer class="entry-footer"><span title='2022-03-01 00:00:00 +0000 UTC'>March 1, 2022</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to C++ Trivia;" href="http://poyaoc97.github.io/posts/2022-03-01-cpp-trivia/"></a>
</article>
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">The Bug Strikes Back: LLDB Bugs Lurking for Over a Decade
</h2>
</header>
<div class="entry-content">
<p>The Issue One day, I was wondering how dynamic function call works. I thought I’d start with a simple puts call like in this C snippet.
#include <stdio.h> int main(void) { puts("Hello\n"); } To see it going through the Procedure Linkage Table (PLT) in the context of lazy binding on x86_64 Linux LIVE, naturally, LLDB came to my mind. To my dismay, instead of something relevant to puts there were only these ugly and unidentifiable ___lldb_unnamed_symbol36 in the disaseembly on LLDB 13.0.0 🫠: In comparison, this is GDB 11.1: Let’s see how an older version of LLDB is doing. Here’s LLDB version 12.0.1 🫥: Apparently, something went wrong between the creation of LLVM version 12 and 13 release branch. It turned out that it was a patch landing in July 2021 that changed the behavior. Someone also filed a GitHub issue just a few days before I found this. I then commented my findings on the code review page of the seemingly problematic patch.
...</p>
</div>
<footer class="entry-footer"><span title='2022-01-07 00:00:00 +0800 CST'>January 7, 2022</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to The Bug Strikes Back: LLDB Bugs Lurking for Over a Decade" href="http://poyaoc97.github.io/posts/2022-01-07-lldb/"></a>
</article>
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">ABI Incompatibility of libc++ and libstdc++ and C++ Inline Namespace
</h2>
</header>
<div class="entry-content">
<p>I ran into linker errors similar to the screenshot below in November 2021. After some close inspection, I realized this was a result of mixing 2 C++ standard libraries, namely libc++ and libstdc++. I was unkowningly 😱 compiling TVM with libc++’s headers while linking it against LLVM which was compiled with libstdc++’s headers and linked against libstdc++.
A Simple Example Here is a simple example illustrating what’s happening.
Source Files Given 2 C++ souce files:
...</p>
</div>
<footer class="entry-footer"><span title='2022-01-06 00:00:00 +0000 UTC'>January 6, 2022</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to ABI Incompatibility of libc++ and libstdc++ and C++ Inline Namespace" href="http://poyaoc97.github.io/posts/2022-01-06-abi/"></a>
</article>
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">Set Up an SSD for Your Tesla on a Mac
</h2>
</header>
<div class="entry-content">
<p>
Foreword Tesla intriduced custom light show in its holiday update, and I would like to put Tesla dash cam, music, boombox, and custom light show all in one storage device (assumed to be an SSD in this post). By doing this, I can put my SSD in the glove box, which is locked in the case of a breakin. This can be achieved by partitioning the storage device into 4 partitions, during which I found it was a PITA to do with file system other than APFS. Then, I recalled that there was this system utility on macOS called diskutil. Thankfully, the man page is easy to grasp. Nonetheless, I decided to compile a blog post after some light reading.
...</p>
</div>
<footer class="entry-footer"><span title='2021-12-31 00:00:00 +0000 UTC'>December 31, 2021</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to Set Up an SSD for Your Tesla on a Mac" href="http://poyaoc97.github.io/posts/2021-12-31-tesla/"></a>
</article>
<article class="post-entry">
<header class="entry-header">
<h2 class="entry-hint-parent">Set up a blog using Hugo
</h2>
</header>
<div class="entry-content">
<p>本文紀錄如何用Hugo建立blog,並部署到GitHub Pages。
...</p>
</div>
<footer class="entry-footer"><span title='2020-03-07 13:29:30 +0800 CST'>March 7, 2020</span> · 張博堯 (Po-Yao Chang)</footer>
<a class="entry-link" aria-label="post link to Set up a blog using Hugo" href="http://poyaoc97.github.io/posts/2020-03-07-set-up-a-blog-using-hugo/"></a>
</article>
</main>
<footer class="footer">
<span>© 2024 <a href="http://poyaoc97.github.io/">Po-Yao's blog</a></span> ·
<span>
Powered by
<a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> &
<a href="https://github.com/adityatelange/hugo-PaperMod/" rel="noopener" target="_blank">PaperMod</a>
</span>
</footer>
<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
<path d="M12 6H0l6-6z" />
</svg>
</a>
<script>
let menu = document.getElementById('menu')
if (menu) {
menu.scrollLeft = localStorage.getItem("menu-scroll-position");
menu.onscroll = function () {
localStorage.setItem("menu-scroll-position", menu.scrollLeft);
}
}
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
var id = this.getAttribute("href").substr(1);
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
behavior: "smooth"
});
} else {
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
}
if (id === "top") {
history.replaceState(null, null, " ");
} else {
history.pushState(null, null, `#${id}`);
}
});
});
</script>
<script>
var mybutton = document.getElementById("top-link");
window.onscroll = function () {
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
mybutton.style.visibility = "visible";
mybutton.style.opacity = "1";
} else {
mybutton.style.visibility = "hidden";
mybutton.style.opacity = "0";
}
};
</script>
<script>
document.getElementById("theme-toggle").addEventListener("click", () => {
if (document.body.className.includes("dark")) {
document.body.classList.remove('dark');
localStorage.setItem("pref-theme", 'light');
} else {
document.body.classList.add('dark');
localStorage.setItem("pref-theme", 'dark');
}
})
</script>
</body>
</html>