Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

HEADS-UP: default compiler code model has changed



Hey folks,

I recently did a few changes in -current that may impact your future
binary compatibility, so here is a short summary of the effects.

Untill now, the gcc shipped with NetBSD used to default to -mcmodel=medlow,
which means: programs have to be linked in the low 32 bits of memory, 
including shared libraries. Heap/pointers could be everywhere (and the
main stack was at the very top of the virtual address space).

Since we support a lot of machines that easily can have more than 4G of ram,
it was time to change this. Once we start making use of this feature (which
we do not yet), we will map shared libraries at higher addresses - and this
will cause trouble for binaries compiled with the old model.

This is NetBSD, so we do care about binary compatibility, and want all old
binaries to continue working. So the compiler marks binaries with the code
model used now, and the kernel only applies new top-down memory layout to
new binaries.

This means: for the base system you do not have to care about compatibility,
everything compiled new will work, everything old will still work too.

For pkgsrc or your own programs, however, you might run into trouble if
you start using the updated gcc (and the top-down memory has been enabled
in the kernel, which is not yet the case): new binaries will be marked
as using mcmodel=medmid, but if you did not recompile all used shared 
libraries, those might not be able to deal with the new layout.

So, best practices would be: when you start recompiling stuff outside
of the base system, recompile it completely, with all dependencies.

Since the import of gcc 4.8.2 is likely to happen soon, it might be a good
idea to wait for that, as it is another good reason to recompile everything.

Also it may be possible that we hit bugs now (I had to fix a few ld.elf_so
problems to get this going). If you see something strange, post here or
file a PR!

Martin


Home | Main Index | Thread Index | Old Index