All of lore.kernel.org
 help / color / mirror / Atom feed
From: "b.gunreben" <b.gunreben@web.de>
To: parisc-linux@lists.parisc-linux.org
Subject: [parisc-linux] Problem with weak symbols
Date: Tue, 07 Jan 2003 14:05:25 +0100	[thread overview]
Message-ID: <3E1AD095.FA5CF165@web.de> (raw)

Hi,

I have a problem with weak symbols on parisc. If I use the following
small program, the result should be always (nil), but it isn=B4t:

> cat weak.c
#include <stdio.h>
#include <ctype.h>
 =

asm (".weak linux_bla");
asm (".weak linux_foo");
 =

extern const char * linux_bla;
extern const int linux_foo[];
 =

int
main ()
{
  printf("linux_bla: %p\n", &linux_bla);
  printf("linux_foo: %p\n", &linux_foo);
  return 0;
}

> ./weak
linux_bla: 0x205f0
linux_foo: (nil)

The main difference in compiling seems to be the different relocation
type for both symbols:

> readelf -r weak.o
 =

Relocation section '.rela.text' at offset 0x410 contains 10 entries:
  Offset    Info  Type            Symbol's Value  Symbol's Name         =

Addend
  00000010  00502 R_PARISC_DIR21L       00000000 =

=2ELC0                      + 0
  00000014  00506 R_PARISC_DIR14R       00000000 =

=2ELC0                      + 0
  00000018  00912 R_PARISC_DPREL21L     00000000 =

linux_bla                 + 0
  0000001c  00916 R_PARISC_DPREL14R     00000000 =

linux_bla                 + 0
  00000020  00c0c R_PARISC_PCREL17F     00000000 =

printf                    + 0
  00000028  00602 R_PARISC_DIR21L       00000010 =

=2ELC1                      + 0
  0000002c  00606 R_PARISC_DIR14R       00000010 =

=2ELC1                      + 0
  00000030  00a02 R_PARISC_DIR21L       00000000 =

linux_foo                 + 0
  00000034  00a06 R_PARISC_DIR14R       00000000 =

linux_foo                 + 0
  00000038  00c0c R_PARISC_PCREL17F     00000000 =

printf                    + 0

I am currently using gcc version 3.2.1, binutils version 2.13.90.0.16
20021126, glibc version 2.3.1, but I had this problem already with gcc
3.0.4 and all compilers inbetween. Is there a possibility to work around
this?


Berthold

             reply	other threads:[~2003-01-07 13:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-07 13:05 b.gunreben [this message]
2003-01-07 17:47 ` [parisc-linux] Problem with weak symbols John David Anglin
2003-01-07 17:51   ` John David Anglin
2003-01-07 20:49 ` John David Anglin
2003-01-07 22:49   ` b.gunreben
2003-01-07 23:10     ` Grant Grundler
2003-01-13  1:48       ` Andrew Shugg

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=3E1AD095.FA5CF165@web.de \
    --to=b.gunreben@web.de \
    --cc=parisc-linux@lists.parisc-linux.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.