bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/28262] Add warning when generating code in data section


From: nickc at redhat dot com
Subject: [Bug gas/28262] Add warning when generating code in data section
Date: Wed, 01 Sep 2021 13:38:30 +0000

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

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Dietmar May from comment #0)
Hi Dietmar,

> If assembler code exists within a section that does not have a flags
> argument, and does not have a "well known" name (like ".init" or ".text"),
> it is assembled and silently placed within a data section.

I guess it depends upon what you mean by a data section.  If you mean a section
with the PROGBITS type and the ALLOC and WRITE flags, then I would agree.  But
to be clear such a section will not have the EXECUTE flag.  (I am restricting
myself to ELF here, but similar concepts exist for other file formats).


> ld will happily link the code, and the code will execute; 

Are you sure about this ?  If the code is in a non-executable section then it
should be linked into a non-executable segment, and so it should never be run.

Do you have an example to demonstrate the behaviour you describe ?


> The warning would only be emitted in the case where a section contains
> executable code,

Well I am not convinced enough of the utility of this warning to want to
implement it myself, but if someone volunteers I am not going to object...

Cheers
  Nick

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