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: detect loongarch cpu in header #2128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zitsen
Copy link

@zitsen zitsen commented Jul 29, 2024

@zitsen
Copy link
Author

zitsen commented Aug 7, 2024

@briansmith can I ping you to review this pr?

@@ -42,9 +42,9 @@
#elif !(defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) && \
!(defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
#error "Unsupported endianness"
#elif defined(__LP64__)
#elif defined(__LP64__) || defined(__loongarch64) || defined(__loongarch_lp64)
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this needed? Does GCC for the 64-bit target not define __LP64__? https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html says it is defined so this shouldn't be needed.

#define OPENSSL_64_BIT
#elif defined(__ILP32__)
#elif defined(__ILP32__) || defined(__loongarch__)
Copy link
Owner

Choose a reason for hiding this comment

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

Wouldn't this addition be better placed ...

Copy link

@setarcos setarcos Nov 2, 2024

Choose a reason for hiding this comment

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

__loongarch__ is defined for 64-bit systems as well, so this expression doesn't seem correct.

Copy link
Owner

Choose a reason for hiding this comment

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

__loongarch__ is defined for 64-bit systems as well, so this expression doesn't seem correct.

Yes, but __LP64__ will be set for 64-bit systems, right? Otherwise the logic for the other 32-bit archs wouldn't work either. Keep in mind that the thing we're really working around is that these old versions of GCC didn't set __ILP32__ for many 32-bit architectures.

#define OPENSSL_64_BIT
#elif defined(__ILP32__)
#elif defined(__ILP32__) || defined(__loongarch__)
#define OPENSSL_32_BIT
// Versions of GCC before 10.0 didn't define `__ILP32__` for all 32-bit targets.
#elif defined(__MIPSEL__) || defined(__MIPSEB__) || defined(__PPC__) || defined(__powerpc__) || defined(__csky__) || defined(__XTENSA__)
Copy link
Owner

Choose a reason for hiding this comment

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

...here, with all the other similar ones?

@briansmith
Copy link
Owner

Any updates on this? Would love to get this resolved for the next release.

@heiher
Copy link
Contributor

heiher commented Dec 6, 2024

Is this patch intended to ensure compatibility with some outdated compilers that haven't been upstreamed yet? I believe the upstream version (compatible with LoongArch ABI 2.0) doesn't require it.

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.

5 participants