https://sourceware.org/bugzilla/show_bug.cgi?id=22717
Bug ID: 22717 Summary: String concatenation impossible to translate in bfd Product: binutils Version: 2.30 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: fmarchal at perso dot be Target Milestone: --- In elf64-x86-64.c, at line 1404 (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf64-x86-64.c;h=ba4f47bff469e829f5ffdc95ded6bf1061b2d24a;hb=HEAD#l1404), the message contains several %s that are replaced with translated words: _bfd_error_handler (_("%B: relocation %s against %s%s`%s' can " "not be used when making %s%s"), input_bfd, howto->name, und, v, name, object, pic); Constructing a message like this is impossible to translate correctly into French (and probably other languages). The usual solution is to swap format arguments like this in the translated message: %2$s%1$s. But that syntax isn't supported by _bfd_doprnt. Is it possible to add printf positional arguments to _bfd_doprnt? The alternative would be to hard code every possible message such as in: static bfd_boolean elf_x86_64_need_pic (struct bfd_link_info *info, bfd *input_bfd, asection *sec, struct elf_link_hash_entry *h, Elf_Internal_Shdr *symtab_hdr, Elf_Internal_Sym *isym, reloc_howto_type *howto) { int v = 0; int und = 0; int pic = 0; int object = 0; const char *name; if (h) { name = h->root.root.string; switch (ELF_ST_VISIBILITY (h->other)) { case STV_HIDDEN: v = 0x01; break; case STV_INTERNAL: v = 0x02; break; case STV_PROTECTED: v = 0x03; break; default: if (((struct elf_x86_link_hash_entry *) h)->def_protected) v = 0x04; else v = 0x05; pic = 0x08; break; } if (!h->def_regular && !h->def_dynamic) und = 0x20; } else { name = bfd_elf_sym_name (input_bfd, symtab_hdr, isym, NULL); pic = 0x10; } if (bfd_link_dll (info)) object = 0x40; else if (bfd_link_pie (info)) object = 0x80; else object = 0xC0; switch (v | pic | und | object) { case 0x41: /* xgettext:c-format */ _bfd_error_handler (_("%B: relocation %s against hidden symbol `%s' can " "not be used when making a shared object"), input_bfd, howto->name, name); break; case 0x61: /* xgettext:c-format */ _bfd_error_handler (_("%B: relocation %s against undefined hidden symbol `%s' can " "not be used when making a shared object"), input_bfd, howto->name, name,); break; /* Still 31 cases to add... */ } bfd_set_error (bfd_error_bad_value); sec->check_relocs_failed = 1; return FALSE; } Not fun but maybe easier than adding positional arguments to _bfd_doprnt. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils