Skip to content

[libc] Fix overlay mode inclusion for fcntl.h header. #119159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libc/hdr/fcntl_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
// `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.

#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif

#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
Expand All @@ -28,6 +33,11 @@

#include <fcntl.h>

#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif

#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
Expand Down
6 changes: 6 additions & 0 deletions libc/hdr/types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ add_proxy_header_library(
struct_flock
HDRS
struct_flock.h
DEPENDS
libc.hdr.fcntl_overlay
FULL_BUILD_DEPENDS
libc.include.llvm-libc-types.struct_flock
)
Expand All @@ -59,6 +61,8 @@ add_proxy_header_library(
struct_flock64
HDRS
struct_flock64.h
DEPENDS
libc.hdr.fcntl_overlay
FULL_BUILD_DEPENDS
libc.include.llvm-libc-types.struct_flock64
)
Expand All @@ -67,6 +71,8 @@ add_proxy_header_library(
struct_f_owner_ex
HDRS
struct_f_owner_ex.h
DEPENDS
libc.hdr.fcntl_overlay
FULL_BUILD_DEPENDS
libc.include.llvm-libc-types.struct_f_owner_ex
)
Expand Down
2 changes: 1 addition & 1 deletion libc/hdr/types/struct_f_owner_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#else

#include <fcntl.h>
#include "hdr/fcntl_overlay.h"

#endif // LIBC_FULL_BUILD

Expand Down
2 changes: 1 addition & 1 deletion libc/hdr/types/struct_flock.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#else

#include <fcntl.h>
#include "hdr/fcntl_overlay.h"

#endif // LIBC_FULL_BUILD

Expand Down
2 changes: 1 addition & 1 deletion libc/hdr/types/struct_flock64.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#else

#include <fcntl.h>
#include "hdr/fcntl_overlay.h"

#endif // LIBC_FULL_BUILD

Expand Down
Loading