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 on mips #44

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

Fix build on mips #44

wants to merge 1 commit into from

Conversation

ffontaine
Copy link
Contributor

@ffontaine ffontaine commented Dec 23, 2020

[Retrieved (and slightly updated to patch configure.ac instead of configure) from:
https://git.buildroot.net/buildroot/tree/package/dmalloc/0002-mips.patch]

[Retrieved (and slightly updated to patch configure.ac instead of
configure) from:
https://git.buildroot.net/buildroot/tree/package/dmalloc/0002-mips.patch]
@@ -680,7 +680,7 @@ int main()
])],
[ AC_DEFINE(RETURN_MACROS_WORK, 1) AC_MSG_RESULT([yes]) ],
[ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ],
[ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ]
Copy link
Owner

Choose a reason for hiding this comment

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

Can you revert this? I still want the default to be off.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AC_RUN_IFELSE can't be run when cross-compiling, so we have to update action-if-cross-compiling which is only used when cross-compiling: https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Runtime.html
Without this change, RETURN_MACROS_WORK will always be set to 0 when cross-compiling.

Copy link
Owner

Choose a reason for hiding this comment

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

But what happens if someone is cross compiling onto an architecture that causes the return address code to segfault. By forcing the yes it will be forcing a broken result. You should be able to override the RETURN_MACROS_WORK default for your particular build.

Copy link
Owner

Choose a reason for hiding this comment

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

I think the appropriate way to do that is to alter the settings.h file and set USE_RETURN_MACROS to be 1.

@@ -117,26 +117,16 @@
/*************************************/

/*
* For DEC Mips machines running Ultrix
* For Mips machines running Linux
Copy link
Owner

Choose a reason for hiding this comment

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

Is there some way to detect Mips running Linux better than just __mips?

Copy link
Contributor Author

@ffontaine ffontaine Dec 23, 2020

Choose a reason for hiding this comment

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

Nope, the only "standard" way is to check for __mips or __mips__ (cf. https://sourceforge.net/p/predef/wiki/Architectures or https://wiki.debian.org/ArchitectureSpecificsMemo)

@ffontaine
Copy link
Contributor Author

Do you have other comments on my answers?

@j256
Copy link
Owner

j256 commented Dec 30, 2020

Does this work with -O2 @ffontaine ? I've seen some return address code causing segfaults with optimization enabled.

@ffontaine
Copy link
Contributor Author

Yes, this works. This patch has been applied since 2006 in buildroot. Since that time, we didn't get any bug reports from our users or any build failures on the autobuilders.

@ffontaine
Copy link
Contributor Author

Do you plan to merge this PR?

buildroot-auto-update pushed a commit to buildroot/buildroot that referenced this pull request Dec 12, 2021
Fix the following build failure raised since bump to version 5.6.5 in
commit 736932c:

In file included from /home/buildroot/autobuild/instance-0/output-1/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/string.h:631:0,
                 from arg_check.c:31:
dmalloc.h:377:7: error: expected identifier or '(' before '__extension__'
 char *strdup(const char *string);
       ^

This build failure is raised because 0004-fix-strdup.patch was wrongly
removed and because configure.ac wrongly assumes that strdup macro is
not available when cross-compiling

As configure.ac can't be patched because autoreconf is not working,
patch configure as already done in DMALLOC_POST_PATCH. An upstream patch
on configure.ac will be sent as soon as upstream merges this old PR:
j256/dmalloc#44

Fixes:
 - http://autobuild.buildroot.org/results/00565c4b0618ea5f553d8c22284637b6574e4a93

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
@ffontaine
Copy link
Contributor Author

No update on this 3-year old PR?

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