Bug 23788 - objcopy: src/steddNxf: failed to find link section for section 24
Summary: objcopy: src/steddNxf: failed to find link section for section 24
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.32
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-17 22:13 UTC by mewbaz
Modified: 2020-03-27 11:14 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2018-10-19 00:00:00


Attachments
Produced with clang-7 -c shell.c from SQLite3. (92.44 KB, application/x-object)
2018-10-19 10:22 UTC, mewbaz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mewbaz 2018-10-17 22:13:02 UTC
The latest version of Clang adds a section called "llvm_addrsig" that is not yet recognized by objcopy.

The issue was originally reported in the WLLVM project at https://github.com/travitch/whole-program-llvm/issues/75#issuecomment-430638246

When compiling Coreutils using WLLVM, the following errors are displayed from objcopy.

  CCLD     src/split
  CC       src/stat.o
objcopy: src/stkShpi9: failed to find link section for section 30
objcopy: src/stkShpi9: failed to find link section for section 30

Cheers,
Robin
Comment 1 Alan Modra 2018-10-17 22:50:42 UTC
Please attach the input object file and specify the command line options, in one of the failing objcopy commands.
Comment 2 mewbaz 2018-10-18 11:57:12 UTC
Example based on SQLite3: https://sqlite.org/2018/sqlite-amalgamation-3250200.zip

u@x1 ~/D/p/y/0/f/l/sqlite-amalgamation-3250200> cat foo
asdf
u@x1 ~/D/p/y/0/f/l/sqlite-amalgamation-3250200> clang-7 -c shell.c
u@x1 ~/D/p/y/0/f/l/sqlite-amalgamation-3250200> 
objcopy --add-section .llvm_bc=foo shell.o
objcopy: stlck9zT: failed to find link section for section 17
objcopy: stlck9zT: failed to find link section for section 17
Comment 3 mewbaz 2018-10-18 11:58:12 UTC
And these versions are used:

u@x1 ~> clang --version
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

u@x1 ~> objcopy --version
GNU objcopy (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
Comment 4 Alan Modra 2018-10-19 00:07:21 UTC
I asked for an **OBJECT** file, you know, the file that objcopy is operating on, not source files.  That would be shell.o in this instance.  I don't have clang-7 installed.  If I build clang myself, the configure opions I use or those auto-detected might get me a compiler that doesn't reproduce the same object file.
Comment 5 mewbaz 2018-10-19 10:22:22 UTC
Created attachment 11346 [details]
Produced with clang-7 -c shell.c from SQLite3.
Comment 6 Alan Modra 2018-10-19 13:43:24 UTC
Testing a patch.
Comment 7 cvs-commit@gcc.gnu.org 2018-10-20 09:26:25 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ac85e67c053f1555def2c111962f4e68740794f9

commit ac85e67c053f1555def2c111962f4e68740794f9
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Oct 20 00:02:17 2018 +1030

    PR23788, objcopy: failed to find link section
    
    Symbol tables can change when a number of objcopy options are used.
    I figure string tables are similarly changeable.
    
    	PR 23788
    	* elf.c (section_match): Don't require a size match for SHT_SYMTAB
    	or SHT_STRTAB.
Comment 8 Alan Modra 2018-10-20 09:49:57 UTC
Fixed
Comment 9 cvs-commit@gcc.gnu.org 2018-12-12 01:14:02 UTC
The binutils-2_31-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2e05e3e689f25b7b866c49435417b1ded33f7ac7

commit 2e05e3e689f25b7b866c49435417b1ded33f7ac7
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Oct 20 00:02:17 2018 +1030

    PR23788, objcopy: failed to find link section
    
    Symbol tables can change when a number of objcopy options are used.
    I figure string tables are similarly changeable.
    
    	PR 23788
    	* elf.c (section_match): Don't require a size match for SHT_SYMTAB
    	or SHT_STRTAB.
    
    (cherry picked from commit ac85e67c053f1555def2c111962f4e68740794f9)
Comment 10 justinher 2020-03-16 12:38:36 UTC
Fixed!
Helped me on - https://appmirror.net/games/action/grand-theft-auto-san-andreas-game/
Comment 11 Kaitlyn John 2020-03-27 11:13:43 UTC
This article is so helpful for me. I have follow the steps shared here. It was so beneficial for me. Thanks for sharing this useful tips which helped in fixing the issue easily. Hope to see more useful post. https://www.handsomegroup.net
Comment 12 Kaitlyn John 2020-03-27 11:14:27 UTC
This article is so helpful for me. I have follow the steps shared here. It was so beneficial for me. Thanks for sharing this useful tips which helped in fixing the issue easily. Hope to see more useful post. https://www.handsomegroup.net