Hi David, I'll fix the code incorrectly indented.
About your comment about our code looking for TEXT section by looking at string ".text" , please note that our patch fixes a file called "simple-object-xcoff.c" : SIMPLE. Do not expect us to handle more than required. However, are you sure that -ffunction-sections is implemented on AIX ? Moreover, if it is not implemented on AIX, don't you think that such an option which is documented as: " Place each function or data item into its own section in the output file if the target supports arbitrary sections. The name of the function or the name of the data item determines the section’s name in the output file. Use these options on systems where the linker can perform optimizations to improve locality of reference in the instruction space. Most systems using the ELF object format and SPARC processors running Solaris 2 have linkers with such optimizations. AIX may have these optimizations in the future. Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker create larger object and executable files and are also slower." is not compatible with the already existing high complexity of GCC Go implementation ?and should be forbidden with Go on AIX ? We have tried another approach: 127a128 > #define STYP_TEXT 0x20 408a410 > unsigned int flags; 482a485,486 > flags = fetch_32 (scnhdr + offsetof (struct external_scnhdr, > u.xcoff64.s_flags)); 489a494,495 > flags = fetch_32 (scnhdr + offsetof (struct external_scnhdr, > u.xcoff32.s_flags)); 492c498 < if (strcmp (name, ".text") == 0) --- > if ((flags & 0xffff) == STYP_TEXT) However, that makes never-seen-before errors to appear when running libgo tests in always-succeeding libgo tests, like: bufio & bytes. Since we have many other GCC Go stuff on AIX to handle, wouldn't it be possible to start with this implementation and to improve it later if it needs to be hardened ? Document it as a limitation. Regards, Cordialement, Tony Reix Bull - ATOS IBM Coop Architect & Technical Leader Office : +33 (0) 4 76 29 72 67 1 rue de Provence - 38432 Échirolles - France www.atos.net ________________________________________ De : David Edelsohn [dje....@gmail.com] Envoyé : mercredi 7 juin 2017 01:25 À : REIX, Tony; Ian Taylor Cc : SARTER, MATTHIEU (ext); GCC Patches Objet : Re: [PATCH,AIX] Enable libiberty to read AIX XCOFF Tony, This patch generally looks good to me -- it clearly is an incremental improvement. One of the libiberty maintainers, such as Ian, needs to approve the patch. https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01181.html + if (strcmp (name, ".text") == 0) + textptr = scnptr; The above code does not seem very robust. What if the application is compiled with -ffunction-sections so the text section is not named ".text"? + if (strtab == NULL) + { + XDELETEVEC (symtab); + XDELETEVEC (scnbuf); + return errmsg; The first XDELETEVEC (symtab) is indented incorrectly and should be fixed. Thanks, David