bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/31106] strip --strip-debug breaks relocations


From: nickc at redhat dot com
Subject: [Bug binutils/31106] strip --strip-debug breaks relocations
Date: Tue, 05 Dec 2023 15:16:59 +0000

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

--- Comment #12 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Stas Sergeev from comment #11)
> OK, I checked that the new binary
> works as expected.

Ok, I will check in the patch.

> If that's the problem, then I'd suggest
> no not touch relocations at all. It will
> fix both objcopy and '--strip-debug', and
> will actually regress nothing that I can
> think of?

Consider this, rather contrived, example:

  $ cat demo.s
  .data
  .long debug_sym

  .section .debug_aranges
  .global debug_sym
  debug_sym:
  .word 1

  $ as demo.s -o demo.o
  % strip --strip-debug demo.o -o demo.stripped
  strip: demo.stripped: symbol `debug_sym' required but not present

If strip just deleted the debug sections and did not process the relocations
then it would not detect the fact that the output was broken and so it would
not be able to generate those error messages.

In general removing sections from a binary is not just as simple as deleting
their presence.  There are lots of potential dependencies between sections and
the code has to make sure that they are all checked.

Cheers
  Nick

PS.  Yes, in theory a straight "objcopy foo foo.copy" should not need any
checks, but why would that ever be done, and is it really worth coding a
special case just to optimize it ?

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