bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/28398] New: binutils: KEEP ignored


From: xypron.glpk at gmx dot de
Subject: [Bug binutils/28398] New: binutils: KEEP ignored
Date: Thu, 30 Sep 2021 01:00:28 +0000

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

            Bug ID: 28398
           Summary: binutils: KEEP ignored
           Product: binutils
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: xypron.glpk at gmx dot de
  Target Milestone: ---

Created attachment 13684
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13684&action=edit
Test files

I am running ld on RISC-V or riscv64-linux-gnu-ld on x86_64

Ubuntu package version:
binutils-riscv64-linux-gnu 2.37-7ubuntu1
binutils 2.37-7ubuntu1

SUSE package version:
binutils-2.37-1.1.riscv64

I have a linker script with a KEEP() statement

grep -GHrn KEEP *.ld
fw_dynamic.elf.ld:48:  KEEP(*(SORT(.sbilist*)))

and a static library with multiple sections .sbilist* with non-zero size:

objdump -h libplatsbi.a | grep sbilist
  3 .sbilist_fdtreset_1_ 00000000  0000000000000000  0000000000000000  000001b0
 2**3
  4 .sbilist_fdtreset_3_ 00000000  0000000000000000  0000000000000000  000001b0
 2**3
  6 .sbilist_fdtreset_2_gpio_poweroff 00000010  0000000000000000 
0000000000000000  00000498  2**3
  7 .discard.sbilist 00000010  0000000000000000  0000000000000000  000004a8 
2**3
  8 .sbilist_fdtreset_2_gpio_reset 00000010  0000000000000000  0000000000000000
 000004b8  2**3
  5 .sbilist_fdtreset_2_htif 00000010  0000000000000000  0000000000000000 
000000a0  2**3
  6 .discard.sbilist 00000008  0000000000000000  0000000000000000  000000b0 
2**3
  5 .sbilist_fdtreset_2_sifive 00000010  0000000000000000  0000000000000000 
000000d0  2**3
  6 .discard.sbilist 00000008  0000000000000000  0000000000000000  000000e0 
2**3
  6 .sbilist_fdtreset_2_sunxi_wdt 00000010  0000000000000000  0000000000000000 
000001d8  2**3
  7 .discard.sbilist 00000008  0000000000000000  0000000000000000  000001e8 
2**3
  6 .sbilist_fdtreset_2_thead 00000010  0000000000000000  0000000000000000 
000006e8  2**3
  7 .discard.sbilist 00000008  0000000000000000  0000000000000000  000006f8 
2**3

When linking using the linker script

ld -T fw_dynamic.elf.ld \
fw_dynamic.o  libplatsbi.a \
-o fw_dynamic.elf

only referenced .sbilist* sections ends up in the elf file.

objdump -h fw_dynamic.elf | grep sbilist
  6 .sbilist      00000010  0000000080021ba0  0000000080021ba0  00022ba0  2**3

The expected behavior is that unreferenced sections .sbilist* are retained due
to the KEEP statement.

The test files are appended.

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