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

Function assigned to variable causes linker errors m68k/gcc #29

Closed
chris-y opened this issue Mar 10, 2019 · 4 comments
Closed

Function assigned to variable causes linker errors m68k/gcc #29

chris-y opened this issue Mar 10, 2019 · 4 comments
Assignees

Comments

@chris-y
Copy link

chris-y commented Mar 10, 2019

This follows on from my comment #15 (comment)_

Build target is m68k GCC.

In https://github.com/curl/curl/blob/ff7e5a29c781802ae5f37730e076df44a3936717/lib/vtls/openssl.c#L823 sk_X509_pop_free(ca, X509_free); causes the following linker error when the lib is used:

../lib/.libs/libcurl.a()(.text+0x58d6):: undefined reference to `_X509_free'
../lib/.libs/libcurl.a()(.text+0x59be):: undefined reference to `_X509_free'
../lib/.libs/libcurl.a()(.text+0x5bee):: undefined reference to `_X509_free'

Normal usage of X509_free() in the same file is fine, so I think this is an AmiSSL includes (inline?) issue with the X509_free function being used as a parameter.

There appears to be a related issue with the MD5 functions where they are assigned to a variable before being used and this is also causing the same linker errors.

@chris-y
Copy link
Author

chris-y commented Mar 10, 2019

My workaround is to create a C function of a different name which mirrors and calls the AmiSSL function.

@Futaura
Copy link
Collaborator

Futaura commented Mar 11, 2019

I think you'll face this issue on all targets, even OS4. You can't assign library functions to a pointer - there is the added complication of the library/interface needing to be passed as a parameter in A6/r2.

Take a look at amissl/src/libstubs.c - sounds like you've already done something similar. IIRC, on m68k in the old days you could choose not to use the inline macros, and instead build a stub llink ibrary which contains all library calls without the A6 library base parameter, which then call the real library using a globally defined library base. I think there are tools to create such libraries (fd2pragma). Although, for AmiSSL it may be a bit too much overhead - better to create stubs for the functions you need if there are only a few.

@ksdhans
Copy link

ksdhans commented Jul 22, 2019

On OS4, this could be resolved by the change suggested in #31.

@Futaura Futaura self-assigned this Jun 1, 2022
@Futaura
Copy link
Collaborator

Futaura commented Jun 1, 2022

Stub link library now supplied with AmiSSL v5

@Futaura Futaura closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants