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

Re: the mangling of ‘va_list’ has changed in GCC 4.4



Modestas Vainius wrote:

I have recently came across .symver directive [1][2] that is more straightforward way to achieve the same thing. In that case, only source file (.cpp) needs to be changed.
Brilliant! This shall be the plan then:

1) identify affected libraries (Jakubs list as base?)
2) provide patches for the libraries and submit them to BTS
3) give maintainers X days to MU the libraries, after that proceed to NMU them
4) binNMU any packages using the functions with va_list parameters
5) release squeeze ;)
6) tell maintainers they are free to drop the symbol alias

Sounds ok to everyone?

For example:

-----------------------------------------------
$ cat test.h
void myprint(const char* fmt, va_list list);

$ cat libtest.cpp
#include <cstdarg>
#include "test.h"

void myprint(const char* fmt, va_list list) {
}

// va_list mangling has been changed in g++ 4.4
// Add ABI <= g++-4.3 compatibility hack
#if defined __ARM_EABI__ && defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
__asm__(".symver _Z7myprintPKcSt9__va_list, _Z7myprintPKcPv@@");
#endif
-----------------------------------------------

"_Z7myprintPKcSt9__va_list" ( myprint(char const*, std::__va_list) )
here is the new mangling while "_Z7myprintPKcPv ( myprint(char const*, void*) )" is the old mangling. When this code is built under g++-4.4, the resulting binary will have both symbols with _Z7myprintPKcPv and '_Z7myprintPKcSt9__va_list' referring to the same address:

$ objdump -T libtest.so | grep _Z7myprint
000006d8 g    DF .text  00000058  Base        _Z7myprintPKcSt9__va_list
000006d8 g    DF .text  00000058  Base        _Z7myprintPKcPv

1. http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gnu-
assembler/symver.html
2. http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-
linker/version.html



Reply to: