toolchain/58663: gpt(1) biosboot.c doesn't compile on modern Linux
Lloyd Parkes <[email protected]> Wed, 04 Sep 2024 16:25:19 +1200
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <b986fa422be7e638d703d36d0ef2b7f8cab97bd5.camel@must-have-coffee.gen.nz> |
Kia ora koutou,
While looking at JBG's problems uncovered by GCC 14 I found a tools
portability bug in gpt(1) biosboot.c and filed the above PR for it.
The fix is super trivial, but since I'm a newly minted NetBSD developer
I'm supposed to get source changes reviews. If someone gives the PR an
okey-dokey, I'll get on with committing the following patch to CVS.
The problem is that daddr_t and off_t are 32 bits and 64 bits in size
respectively on Linux and then pointers get screwy.
diff -r 3a2c38eb3772 sbin/gpt/biosboot.c
--- a/sbin/gpt/biosboot.c Tue Sep 03 19:51:02 2024 +0000
+++ b/sbin/gpt/biosboot.c Wed Sep 04 15:08:01 2024 +1200
@@ -267,7 +267,7 @@
#endif
int ch;
gpt_t ngpt = gpt;
- daddr_t start = 0;
+ off_t start = 0; /* off_t because of gpt_human_get() */
uint64_t size = 0;
int active = 0;
unsigned int entry = 0;
Ngā mihi,
Lloyd