bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/14962] New: Change of behaviour (symbols in linker file) in 2.22


From: etienne_lorrain at yahoo dot fr
Subject: [Bug ld/14962] New: Change of behaviour (symbols in linker file) in 2.22.90.20120924
Date: Fri, 14 Dec 2012 19:37:45 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=14962

             Bug #: 14962
           Summary: Change of behaviour (symbols in linker file) in
                    2.22.90.20120924
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


Hello,
Gujin GPL bootloader uses different sections to map to different ia32 segments,
and to protect against involuntary references in the wrong segment it uses 
NOCROSSREFS in the linker file.
For very few variables Gujin disable that restriction by using a symbol defined
in the linker file having the value of a defined reference in the C file.
In that case you have "gujin_param = 0 + gujin_param;" in the linker file.
The behaviour of such a construct has changed - at least in the latest Ubuntu
release (other latest distributions seem fine).
I do not know if that is a problem in the way the linker is generated in
Ubuntu, so I am reporting it here first.

Here is a simple way to reproduce the change, in the latest Ubuntu (fail), in
an updated Debian (works)(I think Fedora works too), and in a old version of
Ubuntu:

On latest Ubuntu:

~/tmp$ cat tmp.c
#include <stdio.h>

int var1 = 0, var2 = 0;

int main (int argc, char **argv)
{
    printf ("Address var1 %p var2 %p\n", &var1, &var2);
}
~/tmp$ cat tmp.ld
var2 = var2 + 3;
~/tmp$ gcc -O2 tmp.c -Wl,tmp.ld
~/tmp$ ./a.out 
Address var1 0x804a028 var2 0x21         ######### var2 is wrong
~/tmp$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) 
~/tmp$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.22.90.20120924
~/tmp$ 

On Debian wheezy/sid :
~/tmp$ gcc -O2 tmp.c -Wl,tmp.ld
~/tmp$ ./a.out 
Address var1 0x804968c var2 0x804968f         ######### var2 is right
~/tmp$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-4'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-4) 
~/tmp$ ld --version
GNU ld (GNU Binutils for Debian) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
~/tmp$ 

On Ubuntu 12.04.1:
~/tmp$ gcc -O2 tmp.c -Wl,tmp.ld
~/tmp$ ./a.out 
Address var1 0x804a01c var2 0x804a01f         ######### var2 is right
~/tmp$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
~/tmp$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.22
~/tmp$ 

Best Regards,
Etienne.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]