bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/23078] New: Weak alias to a weak symbol is not resolved correctl


From: pftbest at gmail dot com
Subject: [Bug ld/23078] New: Weak alias to a weak symbol is not resolved correctly.
Date: Wed, 18 Apr 2018 13:29:07 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23078

            Bug ID: 23078
           Summary: Weak alias to a weak symbol is not resolved correctly.
           Product: binutils
           Version: 2.29
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: pftbest at gmail dot com
  Target Milestone: ---

Created attachment 10957
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10957&action=edit
Archive with code to reproduce this issue.

Example code

// main.c -------------------

void _start() {}

void DEFAULT_HANDLER() {
  *((int*)0x10) = 5;
}

// foo.c --------------------

__attribute__((weak)) void DEFAULT_HANDLER() {
    *((int*)0x10) = 1;
}

__attribute__((weak, alias("DEFAULT_HANDLER"))) void HARD_FAULT();
__attribute__((weak, alias("DEFAULT_HANDLER"))) void BUS_FAULT();

void (*VECTORS[])() = {
    HARD_FAULT,
    BUS_FAULT,
};

// compile with ---------------

gcc -Os -o main.o -c main.c
gcc -Os -o foo.o -c foo.c
ld main.o foo.o
objdump -d -j .text -j .data a.out > dump.txt

// ----------------

VECTORS array points to a weak function instead of a strong function defined in
main.c

-- 
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]