NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/58663: gpt(1) biosboot.c doesn't compile on modern Linux



The following reply was made to PR toolchain/58663; it has been noted by GNATS.

From: Rin Okuyama <rokuyama.rk%gmail.com@localhost>
To: Lloyd Parkes <lloyd%must-have-coffee.gen.nz@localhost>,
 matthew green <mrg%NetBSD.org@localhost>, gnats-bugs%NetBSD.org@localhost
Cc: toolchain-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: toolchain/58663: gpt(1) biosboot.c doesn't compile on modern
 Linux
Date: Wed, 4 Sep 2024 14:23:45 +0900

 On 2024/09/04 13:33, matthew green wrote:
 >> -       daddr_t start = 0;
 >> +       off_t start = 0;        /* off_t because of gpt_human_get() */
 > 
 > i think your change is generally correct, but it really indicates
 > it much larger problem.
 > 
 > daddr_t should be made to be 64-bit. (except for the cases where netbsd
 > is building 32-bit daddr_t values for eg, old platform boot programs.)
 >   
 > ie, this seems like it is *also* a compat issue we should fix, it may
 > be causing weird issues elsewhere (but only when Huge Images?)
 
 Yeah. For Linux/glibc, it seems that daddr_t can be overridden in
 a similar manner to ours:
 
 https://github.com/bminor/glibc/blob/master/posix/sys/types.h#L113-L117
 (/usr/include/x86_64-linux-gnu/sys/types.h for Ubuntu/x86_64)
 
 Then, adding
 
 ````
 #ifdef __linux__
 #define	__daddr_t long long
 #endif
 ````
 
 to tools/compat/compat_defs, works around the problems for *most* cases.
 However,
 
 - Host library routines or syscalls may accept daddr_t arguments (and/or
    struct members). daddr_t is not portable, and we should avoid direct
    call for such routines although...
 - Other libc implementation may handles daddr_t differently.
 
 Thoughts?
 
 Lloyd, please modify `start` argument for biosboot() also. Otherwise,
 it gets truncated similarly.
 
 Thanks,
 rin
 
 P.S. Lloyd, welcome to our project :)
 


Home | Main Index | Thread Index | Old Index