binutils-gdb/sim/igen
Tsukasa OI dd6c5a9217 sim, sim/{m32c,ppc,rl78}: Use getopt_long
Because of a Libiberty hack, getopt on GNU libc (2.25 or earlier) is
currently unusable on sim, causing a regression on CentOS 7.

This is caused as follows:

1.  If HAVE_DECL_GETOPT is defined (getopt declaration with known prototype
    is detected while configuration), a declaration of getopt in
    "include/getopt.h" is suppressed.
    The author started to define HAVE_DECL_GETOPT in sim with the commit
    340aa4f687 ("sim: Check known getopt definition existence").
2.  GNU libc (2.25 or earlier)'s <unistd.h> includes <getopt.h> with a
    special purpose macro defined to declare only getopt function but due
    to include path (not tested while configuration), it causes <unistd.h>
    to include Libiberty's "include/getopt.h".
3.  If both 1. and 2. are satisfied, despite that <unistd.h> tries to
    declare getopt by including <getopt.h>, "include/getopt.h" does not do
    so, causing getopt function undeclared.

Getting rid of "include/getopt.h" (e.g. renaming this header file) is the
best solution to avoid hacking but as a short-term solution, this commit
replaces getopt with getopt_long under sim/.
2022-10-29 05:39:52 +00:00
..
ChangeLog-2021
compare_igen_models
filter_host.c
filter_host.h
filter.c
filter.h
gen-engine.c
gen-engine.h
gen-icache.c
gen-icache.h
gen-idecode.c
gen-idecode.h
gen-itable.c
gen-itable.h
gen-model.c
gen-model.h
gen-semantics.c
gen-semantics.h
gen-support.c
gen-support.h
gen.c
gen.h
igen.c
igen.h
ld-cache.c
ld-cache.h
ld-decode.c
ld-decode.h
ld-insn.c
ld-insn.h
lf.c
lf.h
local.mk
misc.c
misc.h
table.c
table.h