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

Cannot use va_list, va_start, or va_end, when %ss != .data (-mno-callee-assume-ss-data-segment) #104

Closed
tkchia opened this issue May 17, 2022 · 3 comments
Labels

Comments

@tkchia
Copy link
Owner

tkchia commented May 17, 2022

$ cat test2.c
#include <stdarg.h>

void
baz (const char *fmt, ...)
{
  va_list ap;
  va_start (ap, fmt);
  while (va_arg(ap, int) != 0);
  va_end (ap);
}
$ ia16-elf-gcc -S -Os test2.c -mno-callee-assume-ss-data-segment 
In file included from test2.c:1:0:
test2.c: In function ‘baz’:
test2.c:7:13: error: passing argument 1 of ‘__builtin_va_start’ from pointer to non-enclosed address space
   va_start (ap, fmt);
             ^
test2.c:9:11: error: passing argument 1 of ‘__builtin_va_end’ from pointer to non-enclosed address space
   va_end (ap);
           ^

The issue was first surfaced by @asiekierka, at #102 (comment) .

@tkchia
Copy link
Owner Author

tkchia commented May 18, 2022

Starting a new Git branch tkchia/va-list to deal with this stuff...

@tkchia
Copy link
Owner Author

tkchia commented May 21, 2022

va_list + -no-callee-assume-ss-data-segment should work now, with the latest commits 5f8df20, 65e74b7, e4f7308, d43023a, and 9336aa4.

@asiekierka
Copy link

Can confirm. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants