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



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