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

Segfault when running makerom v0.18.2 #122

Closed
lephilousophe opened this issue Apr 19, 2022 · 3 comments
Closed

Segfault when running makerom v0.18.2 #122

lephilousophe opened this issue Apr 19, 2022 · 3 comments

Comments

@lephilousophe
Copy link

When running makerom in 64-bit Linux, a SIGSEGV happens in yaml_parser_append_tag_directive when checking if a directive already exists.
This is because the directive handle pointer pushed is invalid.
The root cause is that when running gcc with -std=c11, strdup is not defined on Linux.
When it is used in yaml_strdup, it is then implicitly defined as returning int which is 32-bit size on Linux (the generated assembly code truncates the strdup result using CDQE instruction.
Two solutions for this: either use -std=gnu11 which enables all GNU extensions or add -D_GNU_SOURCE to CFLAGS to make strdup defined (gnu11 makes this definition plus enables other extensions) in file makerom/deps/libyaml/makefile.

@jakcron
Copy link
Collaborator

jakcron commented Apr 20, 2022

Thank you for flagging. I’ll investigate.

@jakcron
Copy link
Collaborator

jakcron commented Apr 22, 2022

I decided to add -D_GNU_SOURCE to CFLAGS for the affected modules.

This is effective in MakeROM v0.18.3.

https://github.com/3DSGuy/Project_CTR/releases/tag/makerom-v0.18.3

@jakcron jakcron closed this as completed Apr 22, 2022
@jakcron
Copy link
Collaborator

jakcron commented Apr 22, 2022

Thank you for filing this bug. I'll make sure to watch the warnings more carefully for other targets in future.

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

No branches or pull requests

2 participants