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

            Bug ID: 89096
           Summary: [6/7/8/9 regression] AIX 7 linker rejects
                    _<filename>.ro_ sections by default
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrew at ishiboo dot com
  Target Milestone: ---

I am trying to determine if this change in behavior is intentional or if there
is something that can be done to work with the linker default behavior...

GCC 6+ started generating sections named `_<file>.ro_` that when passed to AIX
`ld` produce the following error:

  ld: 0711-308 SEVERE ERROR: Object main.cc.o, csect <_main.ro_>
          The csect is part of the .text section.

This happens for any such `.ro` symbol, not just the one for `main`. These are
generated in gcc/config/rs6000/rs6000.c:

  rs6000_gen_section_name (&xcoff_read_only_section_name,
                           main_input_filename, ".ro_");

GCC 5 compiled objects link properly with default `ld` invocation.

In order to "fix" this and link an executable, the following flag must be
passed to deviate from default linker behavior:

       notextro or nro
            Does not check to ensure that there are no load time relocation
            entries for the text section of the output object file. This is
            the default.

That implies default linker behavior is to reject any load time relocation
entries against the `.text` section. Can anything be done to eliminate the need
for this non-standard option or is this now required for all linking of
GCC-compiled objects?

Reply via email to