Debian Bug report logs - #717032
changed behaviour of _end symbol

version graph

Package: binutils; Maintainer for binutils is Matthias Klose <doko@debian.org>; Source for binutils is src:binutils (PTS, buildd, popcon).

Reported by: Petr Salinger <Petr.Salinger@seznam.cz>

Date: Tue, 16 Jul 2013 08:00:01 UTC

Severity: important

Found in version binutils/2.23.52.20130612-1

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#717032; Package binutils. (Tue, 16 Jul 2013 08:00:06 GMT) (full text, mbox, link).


Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 16 Jul 2013 08:00:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: submit@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: changed behaviour of _end symbol
Date: Tue, 16 Jul 2013 09:57:20 +0200 (CEST)
Package: binutils
Version: 2.23.52.20130612-1
Severity: important
User: debian-bsd@lists.debian.org
Usertags: kfreebsd

Hi,

compared to binutils 2.22-8, there is a significant change of
_end symbol behaviour.


glibc built by binutils 2.22-8:

readelf -a 6/lib/x86_64-kfreebsd-gnu/libc.so.0.1 | grep _end
000000352fa8  03ee00000006 R_X86_64_GLOB_DAT 0000000000358e28 _end + 0
000000354ab8  03ee00000001 R_X86_64_64       0000000000358e28 _end + 0
  1006: 0000000000358e28     0 NOTYPE  GLOBAL DEFAULT  ABS _end@@GLIBC_PRIVATE


glibc built by binutils binutils_2.23.52.20130612-1
readelf -a 7/lib/x86_64-kfreebsd-gnu/libc.so.0.1 | grep _end
000000352fb8  03ee00000006 R_X86_64_GLOB_DAT 0000000000358e08 _end + 0
000000354ab8  03ee00000001 R_X86_64_64       0000000000358e08 _end + 0
  1006: 0000000000358e08     0 NOTYPE  GLOBAL DEFAULT   33 _end@@GLIBC_PRIVATE


The _end symbol used to resolve to the end of main binary.
It is used internally as initial brk value.
The FreeBSD kernel does not return new brk value,
only whether brk() syscall succeed or not.

As a result of this changed behaviour,
brk() and sbrk() fails everytime for kfreebsd-*.

I do not know, whether this binutils change is intentional
or how to workaround it.

Petr





Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#717032; Package binutils. (Tue, 16 Jul 2013 10:33:07 GMT) (full text, mbox, link).


Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 16 Jul 2013 10:33:07 GMT) (full text, mbox, link).


Message #10 received at 717032@bugs.debian.org (full text, mbox, reply):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 717032@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: Re: changed behaviour of _end symbol
Date: Tue, 16 Jul 2013 12:29:22 +0200 (CEST)
>> 1006: 0000000000358e28     0 NOTYPE  GLOBAL DEFAULT  ABS _end@@GLIBC_PRIVATE
>> 1006: 0000000000358e08     0 NOTYPE  GLOBAL DEFAULT   33 _end@@GLIBC_PRIVATE

> What about their content? Perhaps they're some kind of fixed-size metadata.

The value itself does not matter here, but ABS->33 change.

Try to build and run via ktrace under stable and under sid

int main()
{
  sbrk(16*1024);
};

You will see the key difference.

Petr



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#717032; Package binutils. (Wed, 17 Jul 2013 21:00:04 GMT) (full text, mbox, link).


Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Wed, 17 Jul 2013 21:00:04 GMT) (full text, mbox, link).


Message #15 received at 717032@bugs.debian.org (full text, mbox, reply):

From: Robert Millan <rmh@debian.org>
To: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: 717032@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: changed behaviour of _end symbol
Date: Wed, 17 Jul 2013 22:57:22 +0200
2013/7/16 Petr Salinger <Petr.Salinger@seznam.cz>:
> The value itself does not matter here, but ABS->33 change.
>
> Try to build and run via ktrace under stable and under sid
>
> int main()
> {
>   sbrk(16*1024);
> };
>
> You will see the key difference.

Just one thought that came to mind, in case this helps: startup.S in
GRUB relies on this symbol to calculate the size of BSS. If the symbol
is wrong, then BSS is not appropiately zeroed.

I would expect other "special" programs using the GNU toolchain to
have similar trouble. E.g. SeaBIOS, Linux, the C runtime entry point
for glibc itself (I forgot its name, I think it was called
"crtbegin")...

How did all these solve it?

--
Robert Millan



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Dec 6 13:34:28 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.