bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/18452] ld allows overlapping sections


From: cristiangavril_olar at yahoo dot com
Subject: [Bug ld/18452] ld allows overlapping sections
Date: Mon, 28 Mar 2016 22:46:24 +0000

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

Cristian Gavril Olar <cristiangavril_olar at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #9132|0                           |1
        is obsolete|                            |

--- Comment #6 from Cristian Gavril Olar <cristiangavril_olar at yahoo dot com> 
---
Created attachment 9135
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9135&action=edit
binutils LD individual section selection patch suggestion

I've been thinking a little bit more about this and I realized in the same
application one can have both the problem of accidental overlaps but at the
same time, in the same application have a need to create overlapped noload
sections.

A reference to this usecase was hinted I think previously when the text in the
endnote of https://sourceware.org/ml/binutils/2009-05/msg00330.html .

As a linker script evolves, one may have additions or changes to the linker
script(s) used. If at some point one had enabled a general option to not warn
anymore, one may still get later in trouble if a new section is accidentally
overlapped.

As a consequence I'm thinking that the previous suggestion should be changed a
little bit to something of this sort:
1) By default LD should just not allow section overlapping of any sort but
2) During the checks, if a section overlapping is detected to be a NOLOAD
section then LD, even if not linking, could display a message informing the
user that they can consciously allow the overlap if they mark that particular
NOLOAD section as possible to be overlapped
3) Provide an option to allow the overlap of a NOLOAD section as per the
description at point "2)"

Thinking about this problem I had thought of maybe adding an extra flag to the
bfd_section structure may be one solution, but the bits in the flagword are
pretty expensive I think to burn for this, so instead I thought of keeping a
separate list in the bfd alive which holds the names of desired sections to be
overlapped.

In terms of how to specify which sections are possible to be overlapped, I
thought of just overloading the use of "OVERLAY". But then I'm aware that
OVERLAY is mostly just meant to be syntactic sugar
(ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_22.html), and the way
it is implemented it actually forced the sections to have the LOAD flag set. I
think changing that may have too great an implication worldwide and I don't
think it's worth it.

Considering all of these I think the remaining option is to build the list of
accepted NOLOAD sections to be overlapped a list of options in as command line
arguments. This patch is suggesting one way of doing that.

Additionally, if there is interest in this direction, I guess an additional
improvement that could be done would be to add a ld script new option called
"OVERLAP" or something similar that would allow the sections to be added to the
accepted list in this fashion too.

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