Segmentation fault when trying to call a function locating in .data section

Brian Dessent brian@dessent.net
Wed Aug 15 08:27:00 GMT 2007


PRC wrote:

> I am confused. In x86 architecture, the physical memory pages have either Read or Write attributes.

That's taking a rather naive view, as there exist several technologies
to emulate or approximate the NX bit for 32 bit x86 (Exec Shield, PaX),
and you must be using a distro/kernel that uses one of them.  Or if
you're using a x86_64 machine in 32 bit mode the kernel can still use
the hardware NX bit, assuming it's been configured properly.

But this doesn't have anything to do with gcc, it's a function of the
kernel/operating system, so it's sort of off-topic for this list.  FWIW
your testcase ran without segfault for me on a vanilla 32 bit linux
without any of the above.

Brian



More information about the Gcc-help mailing list