Skip to content

Fix compiler warnings and update README.OSX#501

Merged
wolfcw merged 2 commits intowolfcw:masterfrom
usertam:patch/clean-up-and-readme
Jun 9, 2025
Merged

Fix compiler warnings and update README.OSX#501
wolfcw merged 2 commits intowolfcw:masterfrom
usertam:patch/clean-up-and-readme

Conversation

@usertam
Copy link
Copy Markdown
Contributor

@usertam usertam commented Jun 8, 2025

Some finishing touches following #500 and #497.

  • Fix the compiler warnings about stat64 things; please review the commit message. I wish there could be a clear-cut solution to stat64, but I don't think there is one without sacrificing backwards compatibility.

    libfaketime.c:212:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
      212 | static int          (*real_xstat64)         (int, const char *, struct stat64 *);
          |                                                                        ^
    libfaketime.c:213:64: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
      213 | static int          (*real_fxstat64)        (int, int , struct stat64 *);
          |                                                                ^
    libfaketime.c:214:78: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
      214 | static int          (*real_fxstatat64)      (int, int , const char *, struct stat64 *, int);
          |                                                                              ^
    libfaketime.c:215:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
      215 | static int          (*real_lxstat64)        (int, const char *, struct stat64 *);
          |                                                                        ^
    4 warnings generated.
    
  • Update README.OSX about the new arm64e ABI.

Can we do a version bump after this, if there are no problems with it?

I hate having the latest release broken on darwin. Thanks :D

usertam added 2 commits June 8, 2025 19:34
To give more context, stat64 is a child of large-file support (LFS)
back in 1996, during the transition from 32-bit to 64-bit. People
wanted 64-bit inodes in 32-bit systems, hence stat and stat64.

Nowadays where everything is 64-bit, stat64 is mostly just an alias
to stat, as stat is already native 64-bit. On modern implementations
like musl, stat64 is even dropped entirely as a sane default. We
observe the same in darwin's stat.h:

  #if !__DARWIN_ONLY_64_BIT_INO_T
  struct stat64 __DARWIN_STRUCT_STAT64;
  #endif /* !__DARWIN_ONLY_64_BIT_INO_T */

Because struct stat64 doesn't ever exist on aarch64-darwin, and we
don't have to worry about people using stat64 calls, we can safely
remove all stat64 bloat, according to __DARWIN_ONLY_64_BIT_INO_T.

I nuked fake_stat64buf because only STAT64_HANDLER is using it, and
only non-darwin stat64 things use that handler. I didn't do more
because people might still use stat64 things on x86_64 (on glibc)
and other older 32-bit platforms, and we still need to hook those.

A loose follow up to PR wolfcw#453. Fixes the remaining clang warnings on
aarch64-darwin.
@wolfcw wolfcw merged commit cb48e45 into wolfcw:master Jun 9, 2025
@usertam
Copy link
Copy Markdown
Contributor Author

usertam commented Jun 9, 2025

@wolfcw Do you want to do a version bump on this?

@wolfcw
Copy link
Copy Markdown
Owner

wolfcw commented Jun 9, 2025

the recent changes break building on Linux, so I need to fix that first :)

@usertam
Copy link
Copy Markdown
Contributor Author

usertam commented Jun 9, 2025

Ahhh I see, that's worrying D: I will look into it 👀

@usertam
Copy link
Copy Markdown
Contributor Author

usertam commented Jun 9, 2025

OK I think I did it wrong, I can open another PR.

usertam added a commit to usertam/libfaketime that referenced this pull request Jun 9, 2025
I got the logic wrong in PR wolfcw#501 in the inner `#ifndef __APPLE__`.
This broke building on linux. This should fix it.
@wolfcw
Copy link
Copy Markdown
Owner

wolfcw commented Jun 9, 2025

Looks good with #502, version bumped :)

@usertam
Copy link
Copy Markdown
Contributor Author

usertam commented Jun 9, 2025

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants