Skip to content
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

Fix build with link-time optimization #26

Merged
merged 1 commit into from
Aug 12, 2024
Merged

Fix build with link-time optimization #26

merged 1 commit into from
Aug 12, 2024

Conversation

pghmcfc
Copy link
Collaborator

@pghmcfc pghmcfc commented Aug 12, 2024

When building with link-time optimization enabled, the compiler errors out due to some arrays being declared with different sizes in different compilation units. All of the problematic declarations are of character arrays of size MAXPATHLEN in xv.h, which is included by all of xv's source files.

However, the value of the token MAXPATHLEN varies depending on whether or not the token NEEDSDIR is defined at the time of xv.h's inclusion. If it is defined, MAXPATHLEN will be defined via system headers, typically to a value of 4096. If it is not defined, a default value of 256 is used. The NEEDSDIR mechanism was probably created to speed up compilation by not including files unnecessarily on the very old and slow systems that xv was originally written for, and is almost certainly unnecessary now. Hence, the fix for this issue is to get rid of NEEDSDIR altogether and just include the necessary files unconditionally.

Fixes #25.

When building with link-time optimization enabled, the compiler errors
out due to some arrays being declared with different sizes in different
compilation units. All of the problematic declarations are of character
arrays of size MAXPATHLEN in xv.h, which is included by all of xv's
source files.

However, the value of the token MAXPATHLEN varies depending on whether
or not the token NEEDSDIR is defined at the time of xv.h's inclusion. If
it is defined, MAXPATHLEN will be defined via system headers, typically
to a value of 4096. If it is not defined, a default value of 256 is
used. The NEEDSDIR mechanism was probably created to speed up
compilation by not including files unnecessarily on the very old and
slow systems that xv was originally written for, and is almost certainly
unnecessary now. Hence, the fix for this issue is to get rid of NEEDSDIR
altogether and just include the necessary files unconditionally.

Fixes #25.
Copy link
Contributor

@tanabi tanabi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me!

@mdadams mdadams merged commit 9b18a11 into main Aug 12, 2024
4 checks passed
@pghmcfc pghmcfc deleted the lto-fix branch August 13, 2024 08:20
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.

Build fails with LTO
3 participants