public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: u-boot@lists.denx.de
Subject: [RFC PATCH u-boot 02/12] sandbox: errno: avoid conflict with libc's errno
Date: Fri, 5 Mar 2021 18:24:18 +0100	[thread overview]
Message-ID: <20210305182418.4572f762@nic.cz> (raw)
In-Reply-To: <CAPnjgZ32uRRVkGfiiCELRYFbkY9bcR6707NrbcbV_w9vQ7aF1g@mail.gmail.com>

On Fri, 5 Mar 2021 09:58:34 -0700
Simon Glass <sjg@chromium.org> wrote:

> Hi Marek,
> 
> On Fri, 5 Mar 2021 at 09:50, Marek Behun <marek.behun@nic.cz> wrote:
> >
> > On Fri, 5 Mar 2021 09:39:53 -0700
> > Simon Glass <sjg@chromium.org> wrote:
> >  
> > > Hi Marek,
> > >
> > > On Fri, 5 Mar 2021 at 08:37, Marek Behun <marek.behun@nic.cz> wrote:  
> > > >
> > > > On Fri, 5 Mar 2021 11:00:45 +0800
> > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > >  
> > > > > On Wed, Mar 3, 2021 at 12:13 PM Marek Beh?n <marek.behun@nic.cz> wrote:  
> > > > > >
> > > > > > When building with LTO, the system libc's `errno` variable used in
> > > > > > arch/sandbox/cpu/os.c conflicts with U-Boot's `errno` (defined in
> > > > > > lib/errno.c) with the following error:
> > > > > >  .../ld: errno@@GLIBC_PRIVATE: TLS definition in /lib64/libc.so.6
> > > > > >          section .tbss mismatches non-TLS reference in
> > > > > >          /tmp/u-boot.EQlEXz.ltrans0.ltrans.o  
> > > > >
> > > > > Do you know if this is the expected behavior when enabling LTO on the compiler?  
> > > >
> > > > I don't, but this is a bug anyway. The symbol clashes with the symbol
> > > > from glibc. Does somebody know whether the usage of this symbol in os.c
> > > > does really use glibc's version or U-Boot's one?  
> > >
> > > It is intended to use glibc's version. In fact I don't think U-Boot
> > > should have an errno. We return errors in each case, as does Linux.  
> >
> > The problem is that libc defines errno as a thread-local variable or,
> > in older version, as a macro expading to a function dereference, i.e.
> >   #define errno (*__get_threads_errno())
> > But U-Boot usis the errno symbol defined in include/errno.h as a symbol.
> >
> > So in order for these two symbols not to clash (in case libc is using
> > thread-local symbol with name errno), we need to rename the U-Boot
> > errno variable's symbol name.  
> 
> Rename is OK, but can we delete it instead? I really don't think it
> should be there.

We can't simply delete it. The whole u-boot is using the errno symbol
from include/errno.h and if we want the whole u-boot to use libc's
symbol we need to code include/errno.h to declare it in the same way as
libc, which may be different for different libcs.

  parent reply	other threads:[~2021-03-05 17:24 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  4:11 [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 01/12] build: use thin archives instead of incremental linking Marek Behún
2021-03-04 10:57   ` Bin Meng
2021-03-04 18:17     ` Marek Behun
2021-03-05 13:34       ` Bin Meng
2021-03-05 13:37         ` Tom Rini
2021-03-06 21:20           ` Marek Behun
2021-03-05 15:39         ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 02/12] sandbox: errno: avoid conflict with libc's errno Marek Behún
2021-03-05  3:00   ` Bin Meng
2021-03-05 15:37     ` Marek Behun
2021-03-05 16:39       ` Simon Glass
2021-03-05 16:50         ` Marek Behun
2021-03-05 16:58           ` Simon Glass
2021-03-05 17:24             ` Heinrich Schuchardt
2021-03-05 17:24             ` Marek Behun [this message]
2021-03-05 19:42               ` Simon Glass
2021-03-05 17:21       ` Heinrich Schuchardt
2021-03-07  3:14         ` Marek Behun
2021-03-12  4:45   ` Simon Glass
2021-03-03  4:12 ` [RFC PATCH u-boot 03/12] linker_lists: declare entries and lists externally visible Marek Behún
2021-03-04 13:47   ` Marek Behun
2021-03-05  3:04   ` Bin Meng
2021-03-05 15:49     ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 04/12] efi_loader: fix warning when linking with LTO Marek Behún
2021-03-05  5:50   ` Bin Meng
2021-03-03  4:12 ` [RFC PATCH u-boot 05/12] binman: declare symbols externally visible Marek Behún
2021-03-04  0:37   ` Tom Rini
2021-03-04  1:53     ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 06/12] build: support building with Link Time Optimizations Marek Behún
2021-03-05  6:34   ` Bin Meng
2021-03-03  4:12 ` [RFC PATCH u-boot 07/12] arch: sandbox: make LTO available Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 08/12] sandbox: build with LTO Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 09/12] ARM: make gd a function for LTO Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 10/12] string: make memcpy() visible to fix LTO linking errors Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 11/12] arch: ARM: make LTO available Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 12/12] Nokia RX-51: build with LTO Marek Behún
2021-03-03 16:11 ` [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Tom Rini
2021-03-03 16:41   ` Marek Behun
2021-03-03 16:47     ` Tom Rini
2021-03-03 21:36     ` Tom Rini
2021-03-04  0:40       ` Adam Ford
2021-03-04  7:07         ` [PATCH] arm: fix LTO build for some thumb-interwork cases Marek Behún
2021-03-04 10:43       ` [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Marek Behun
2021-03-04 13:46         ` Adam Ford
2021-03-04 13:50           ` Marek Behun
2021-03-04 13:59             ` Adam Ford
2021-03-04 14:58           ` Tom Rini
2021-03-04 15:07             ` Adam Ford
2021-03-04 15:37               ` Marek Behun
2021-03-04 16:18                 ` Tom Rini
2021-03-04 15:59               ` Marek Behun
2021-03-04 22:18                 ` Adam Ford
2021-03-04 22:33                   ` Marek Behun
2021-03-05 11:25                     ` Adam Ford
2021-03-05 12:31                       ` Stefan Roese
2021-03-05 17:10                         ` Adam Ford
2021-03-06  3:03                           ` Adam Ford
2021-03-06 11:12                             ` Adam Ford
2021-03-06 17:37                               ` Marek Behun
2021-03-06 20:08                                 ` Tom Rini
2021-03-06 20:41                                   ` Pali Rohár
2021-03-06 20:54                                     ` Marek Behun
2021-03-06 21:00                                       ` Pali Rohár
2021-03-06 21:19                                         ` Marek Behun
2021-03-06 21:38                                           ` Pali Rohár
2021-03-06 21:49                                             ` Marek Behun
2021-03-07  3:45                                               ` Adam Ford
2021-03-07  4:06                                                 ` Marek Behun
2021-05-09 14:14                                                   ` Adam Ford
2021-05-09 18:44                                                     ` Marek Behun
2021-05-10 16:28                                                       ` Simon Glass
2021-05-13  9:22                                                         ` Pali Rohár
2021-03-04 16:17               ` Tom Rini
2021-03-04 16:35                 ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305182418.4572f762@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox