https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127240

            Bug ID: 127240
           Summary: .data.rel.ro section naming ambiguity
           Product: gcc
           Version: 16.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at suse dot com
  Target Milestone: ---

The use of .data.rel. as a section naming prefix (with -fpic plus
-fdata-sections) conflicts with the special meaning .data.rel.ro has: That's
data which is effectively r/o after relocations were processed, and which
therefore may be converted to r/o from a certain point onwards. Writable
variables named "ro" would, if they have an initializer requiring relocation,
also end up in .data.rel.ro, and hence could be marked r/o along with
everything else there, leading to a crash upon the first write to that
variable.

The issue may also exist with other variables / section name prefixes (e.g.
"local"), but in most cases there wouldn't be a conflict in access attributes.

Names chosen with -ffunction-section / -fdata-section should generally be
chosen such that they wouldn't collide with "basic" section names.

Observed on x86_64-linux, but likely almost independent of target choice.

Reply via email to