https://sourceware.org/bugzilla/show_bug.cgi?id=24031
Bug ID: 24031 Summary: Cannot remove section related to a function (even if the function is in separate section and isn't referenced elsewhere) Product: binutils Version: 2.30 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: sasha2048 at gmail dot com Target Milestone: --- Created attachment 11491 --> https://sourceware.org/bugzilla/attachment.cgi?id=11491&action=edit Samples: file.c, file.s and file.o Suppose, I have the following C-source file: $ cat file.c void f() {} void g() {} I can compile it to an object-file with the -ffunction-sections flag: $ gcc -c -ffunction-sections file.c -o file.o It corresponds to the following assembler code: .file "file.c" .text .section .text.f,"ax",@progbits .globl f .type f, @function f: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size f, .-f .section .text.g,"ax",@progbits .globl g .type g, @function g: .LFB1: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size g, .-g .ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0" .section .note.GNU-stack,"",@progbits Then I try to remove the .text.g section (with the g function) from object file, I get the following error: $ objcopy --remove-section .text.g file.o objcopy: stReXCNA: symbol `.text.g' required but not present objcopy:stReXCNA: No symbols Is there reason why such task can't be performed by objcopy? See also: https://stackoverflow.com/q/39873148 -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils