Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do files that use optind, optarg, getopt(), or environ sometimes fail to compile?

environ fail files optarg
0
Posted

Why do files that use optind, optarg, getopt(), or environ sometimes fail to compile?

0

The tool xflat-gcc is just a thin wrapper around the real GNU compiler (with name like arm-linux-gcc or armeb-linux-uclibc-gcc or some such thing). They are the same compiler. The only difference is that xflat-gcc mucks with the command line parameters that are passed to the real GNU compiler in order to make life easier for you. As disccussed above here and here, because of the technical approach taken by XFLAT, there are issues with accessing global variables across shared module boundaries. This is not so much a consequence of the XFLAT implementation as it is a consequence of the absence of the GOT (Global Offset Table): The absence of a GOT means that XFLAT cannot support the indirection that you would need to relocate the data references. XFLAT works around this limitation by (1) recognizing when your code attempts to access a well-known shared variable, (2) replacing the variable reference with a call to an XFLAT accessor function that gets the variable address for you, and then

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123