GCC Compilation problem in HP LINUX server
Helge Bahmann
hcb@chaoticmind.net
Tue Aug 4 14:57:00 GMT 2009
On Tue, 4 Aug 2009, gkarthi29 wrote:
> Still i cannot believe that there is no option is linux compilers to
> dereference the null pointer as like in AIX and some other HP server.
> strange. %-|
There is actually nothing the compiler could do to map something at
address zero; there might be some funny ELF flag that the linker could put
into your executable and that is honoured by the run-time loader, but I
don't know (I doubt it).
On Linux there you can have the zero page mapped by running your program
through the following wrapper:
---
#include <linux/personality.h>
#include <unistd.h>
main()
{
personality(MMAP_PAGE_ZERO);
char *cmd[]={"/path/to/your/broken/app", 0};
execv(cmd[0], cmd);
}
---
This will get you a single page mapped at address zero (depending on
the brokenness of your app this may not be enough and you have to map
more than that manually).
But as already pointed out, better fix the mess.
Best regards
Helge
More information about the Gcc-help
mailing list