diff options
author | Daniel Jacobowitz <drow@false.org> | 2003-12-20 18:16:52 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2003-12-20 18:16:52 +0000 |
commit | 543385e1777075e10b3d389433e514122708c277 (patch) | |
tree | 56625b15fdcffb483fab2537e00c64e9e90823c0 | |
parent | 61547efc7fe23d6c09acd75051e45a5a978de09f (diff) | |
download | gdb-543385e1777075e10b3d389433e514122708c277.zip gdb-543385e1777075e10b3d389433e514122708c277.tar.gz gdb-543385e1777075e10b3d389433e514122708c277.tar.bz2 |
Merge from mainline.
74 files changed, 4620 insertions, 1610 deletions
@@ -1,3 +1,12 @@ +2003-12-19 Nathanael Nerode <neroden@gcc.gnu.org> + + Port change over from GCC: + 2003-11-20 Kelley Cook <kcook@gcc.gnu.org> + * Makefile.tpl (BASE_FLAGS_TO_PASS): Pass along CONFIG_SHELL. + (configure-build-[+module+], configure-[+module+]): Likewise. + (configure-target-[+module+], configure-gcc, config.status): Likewise. + * Makefile.in: Regenerate. + 2003-12-08 Thomas Fitzsimmons <fitzsim@redhat.com> * configure.in (raw_libstdcxx_flags): Remove the leading space. diff --git a/Makefile.in b/Makefile.in index 13d9be0..8fe85ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -446,6 +446,7 @@ BASE_FLAGS_TO_PASS = \ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ "WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \ + "CONFIG_SHELL=$(SHELL)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" # For any flags above that may contain shell code that varies from one @@ -17608,6 +17609,7 @@ configure-build-libiberty: AS="$(AS_FOR_BUILD)"; export AS; \ CC="$(CC_FOR_BUILD)"; export CC; \ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX_FOR_BUILD)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ @@ -17679,6 +17681,7 @@ configure-ash: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -17745,6 +17748,7 @@ configure-autoconf: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -17811,6 +17815,7 @@ configure-automake: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -17877,6 +17882,7 @@ configure-bash: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -17943,6 +17949,7 @@ configure-bfd: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18009,6 +18016,7 @@ configure-opcodes: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18075,6 +18083,7 @@ configure-binutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18141,6 +18150,7 @@ configure-bison: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18210,6 +18220,7 @@ configure-byacc: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18279,6 +18290,7 @@ configure-bzip2: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18345,6 +18357,7 @@ configure-dejagnu: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18411,6 +18424,7 @@ configure-diff: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18477,6 +18491,7 @@ configure-dosutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18539,6 +18554,7 @@ configure-etc: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18605,6 +18621,7 @@ configure-fastjar: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18674,6 +18691,7 @@ configure-fileutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18740,6 +18758,7 @@ configure-findutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18806,6 +18825,7 @@ configure-find: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18872,6 +18892,7 @@ configure-flex: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -18941,6 +18962,7 @@ configure-gas: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19007,6 +19029,7 @@ configure-gawk: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19073,6 +19096,7 @@ configure-gettext: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19139,6 +19163,7 @@ configure-gnuserv: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19205,6 +19230,7 @@ configure-gprof: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19271,6 +19297,7 @@ configure-gzip: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19337,6 +19364,7 @@ configure-hello: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19403,6 +19431,7 @@ configure-indent: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19469,6 +19498,7 @@ configure-intl: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19535,6 +19565,7 @@ configure-tcl: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19601,6 +19632,7 @@ configure-itcl: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19667,6 +19699,7 @@ configure-ld: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19733,6 +19766,7 @@ configure-libgui: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19799,6 +19833,7 @@ configure-libiberty: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19865,6 +19900,7 @@ configure-libtool: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19931,6 +19967,7 @@ configure-m4: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -19997,6 +20034,7 @@ configure-make: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20063,6 +20101,7 @@ configure-mmalloc: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20125,6 +20164,7 @@ configure-patch: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20191,6 +20231,7 @@ configure-perl: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20257,6 +20298,7 @@ configure-prms: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20323,6 +20365,7 @@ configure-rcs: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20389,6 +20432,7 @@ configure-readline: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20455,6 +20499,7 @@ configure-release: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20513,6 +20558,7 @@ configure-recode: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20579,6 +20625,7 @@ configure-sed: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20645,6 +20692,7 @@ configure-send-pr: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20711,6 +20759,7 @@ configure-shellutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20777,6 +20826,7 @@ configure-sid: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20843,6 +20893,7 @@ configure-sim: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20909,6 +20960,7 @@ configure-tar: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -20975,6 +21027,7 @@ configure-texinfo: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21037,6 +21090,7 @@ configure-textutils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21103,6 +21157,7 @@ configure-time: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21169,6 +21224,7 @@ configure-uudecode: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21235,6 +21291,7 @@ configure-wdiff: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21301,6 +21358,7 @@ configure-zip: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21370,6 +21428,7 @@ configure-zlib: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21428,6 +21487,7 @@ configure-gdb: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21494,6 +21554,7 @@ configure-expect: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21560,6 +21621,7 @@ configure-guile: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21626,6 +21688,7 @@ configure-tk: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21692,6 +21755,7 @@ configure-tix: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21758,6 +21822,7 @@ configure-libtermcap: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21820,6 +21885,7 @@ configure-utils: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -21897,6 +21963,7 @@ configure-target-libstdc++-v3: $(TARGET_SUBDIR)/libstdc++-v3/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \ @@ -21999,6 +22066,7 @@ configure-target-newlib: $(TARGET_SUBDIR)/newlib/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22100,6 +22168,7 @@ configure-target-libf2c: $(TARGET_SUBDIR)/libf2c/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22201,6 +22270,7 @@ configure-target-libobjc: $(TARGET_SUBDIR)/libobjc/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22302,6 +22372,7 @@ configure-target-libtermcap: $(TARGET_SUBDIR)/libtermcap/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22399,6 +22470,7 @@ configure-target-winsup: $(TARGET_SUBDIR)/winsup/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22500,6 +22572,7 @@ configure-target-libgloss: $(TARGET_SUBDIR)/libgloss/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22597,6 +22670,7 @@ configure-target-libiberty: $(TARGET_SUBDIR)/libiberty/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22698,6 +22772,7 @@ configure-target-gperf: $(TARGET_SUBDIR)/gperf/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22799,6 +22874,7 @@ configure-target-examples: $(TARGET_SUBDIR)/examples/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22892,6 +22968,7 @@ configure-target-libffi: $(TARGET_SUBDIR)/libffi/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -22993,6 +23070,7 @@ configure-target-libjava: $(TARGET_SUBDIR)/libjava/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \ @@ -23095,6 +23173,7 @@ configure-target-zlib: $(TARGET_SUBDIR)/zlib/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -23196,6 +23275,7 @@ configure-target-boehm-gc: $(TARGET_SUBDIR)/boehm-gc/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -23297,6 +23377,7 @@ configure-target-qthreads: $(TARGET_SUBDIR)/qthreads/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -23398,6 +23479,7 @@ configure-target-rda: $(TARGET_SUBDIR)/rda/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXX="$(CXX_FOR_TARGET)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ @@ -23499,6 +23581,7 @@ configure-gcc: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ @@ -23832,7 +23915,7 @@ Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status config.status: configure $(gcc_version_trigger) - $(SHELL) ./config.status --recheck + CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck # Rebuilding configure. AUTOCONF = autoconf diff --git a/Makefile.tpl b/Makefile.tpl index f8f8005..3b545c4 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -389,6 +389,7 @@ all: all.normal # Flags to pass down to all sub-makes. BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\ "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\ + "CONFIG_SHELL=$(SHELL)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" # For any flags above that may contain shell code that varies from one @@ -777,6 +778,7 @@ configure-build-[+module+]: AS="$(AS_FOR_BUILD)"; export AS; \ CC="$(CC_FOR_BUILD)"; export CC; \ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX_FOR_BUILD)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ @@ -848,6 +850,7 @@ configure-[+module+]: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ AR="$(AR)"; export AR; \ @@ -954,6 +957,7 @@ configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+ IF raw_cxx +] CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ @@ -1074,6 +1078,7 @@ configure-gcc: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ @@ -1407,7 +1412,7 @@ Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status config.status: configure $(gcc_version_trigger) - $(SHELL) ./config.status --recheck + CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck # Rebuilding configure. AUTOCONF = autoconf diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 603d3cb..9665466 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,111 @@ +2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + Adfd m32r-linux and PIC support. Add new ABI that uses RELA. + * config.bfd (m32r*-*-linux*, m32r*le-*-linux*, m32r*le-*-*): Added. + * configure.in (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec, + bfd_elf32_m32rle_vec): Added + * configure: Regenerated. + * elf32-m32r.c (m32r_info_to_howto, m32r_elf_adjust_dynamic_symbol, + m32r_elf_size_dynamic_sections, m32r_elf_create_dynamic_sections, + m32r_elf_finish_dynamic_sections, m32r_elf_finish_dynamic_symbol, + allocate_dynrelocs, readonly_dynrelocs, m32r_elf_reloc_type_class, + m32r_elf_fake_sections): Added. + (m32r_elf_howto_table): Added + R_M32R_16_RELA, R_M32R_32_RELA, R_M32R_24_RELA, + R_M32R_10_PCREL_RELA, R_M32R_18_PCREL_RELA, + R_M32R_26_PCREL_RELA, R_M32R_HI16_ULO_RELA, + R_M32R_HI16_SLO_RELA, R_M32R_LO16_RELA, + R_M32R_SDA16_RELA, R_M32R_RELA_GNU_VTINHERIT, + R_M32R_RELA_GNU_VTENTRY, R_M32R_GOT24, + R_M32R_26_PLTREL, R_M32R_COPY, R_M32R_GLOB_DAT, + R_M32R_JMP_SLOT, R_M32R_RELATIVE, R_M32R_GOTOFF, + R_M32R_GOTPC24, R_M32R_GOT16_HI_ULO, + R_M32R_GOT16_HI_SLO, R_M32R_GOT16_LO, + R_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_SLO, + R_M32R_GOTPC_LO. + (m32r_elf_relocate_section, m32r_elf_check_relocs): Changed for + New ABI. + * reloc.c: Add BFD_RELOC_M32R_GOT24, BFD_RELOC_M32R_26_PLTREL, + BFD_RELOC_M32R_COPY, BFD_RELOC_M32R_GLOB_DAT, + BFD_RELOC_M32R_JMP_SLOT, BFD_RELOC_M32R_RELATIVE, + BFD_RELOC_M32R_GOTOFF, BFD_RELOC_M32R_GOTPC24, + BFD_RELOC_M32R_GOT16_HI_ULO, BFD_RELOC_M32R_GOT16_HI_SLO, + BFD_RELOC_M32R_GOT16_LO, BFD_RELOC_M32R_GOTPC_HI_ULO, + BFD_RELOC_M32R_GOTPC_HI_SLO, BFD_RELOC_M32R_GOTPC_LO. + * targets.c (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec, + bfd_elf32_m32rle_vec): Added. + * bfd-in2.h: Regenerated. + * libbfd.h: Regenerated. + +2003-12-19 Danny Smith <dannysmith@users.sourceforge.net> + + * coffcode.h (styp_to_sec_flags): Don't treat .reloc section + as SEC_DEBUGGING. + +2003-12-18 Richard Sandiford <rsandifo@redhat.com> + + * elf32-mips.c (elf_mips_howto_table_rel): Replace all uses of + mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use + _bfd_mips_elf_hi16_reloc for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16, + _bfd_mips_elf_lo16_reloc for R_MIPS_LO16 and R_MIPS_GNU_REL_LO16, + and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16. Change rightshift + to 16 for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16. + (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc) + (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete. + (_bfd_mips_elf32_gprel16_reloc): Remove special case. + (mips_elf_gprel32_reloc, mips32_64bit_reloc): Likewise. + + * elf64-mips.c (mips_elf64_howto_table_rel): Replace all uses of + mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use + _bfd_mips_elf_hi16_reloc for R_MIPS_HI16, _bfd_mips_elf_lo16_reloc + for R_MIPS_LO16 and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16. + Change R_MIPS_HI16's rightshift to 16. + (mips_elf64_howto_table_rela): Replace all uses of + mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. + Use _bfd_mips_elf_generic_reloc for R_MIPS_GOT16 as well. + (mips_elf64_hi16_reloc, mips_elf64_got16_reloc): Delete. + (mips_elf64_shift6_reloc): Remove special case. Use + _bfd_mips_elf_generic_reloc instead of returning bfd_reloc_continue. + + * elfn32-mips.c (prev_reloc_section): Delete. + (prev_reloc_address, prev_reloc_addend): Delete. + (elf_mips_howto_table_rel, elf_mips_howto_table_rela): As for + elf64-mips.c + (GET_RELOC_ADDEND, SET_RELOC_ADDEND): Delete. + (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc) + (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete. + (mips_elf_gprel16_reloc): Delete use of GET_RELOC_ADDEND. + (mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise. + (mips16_jump_reloc, mips16_gprel_reloc): Likewise. + (mips_elf_shift6_reloc): Likewise. Delete use of SET_RELOC_ADDEND. + + * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Use + _bfd_relocate_contents to install an in-place addend. + (mips_hi16): New structure. + (mips_hi16_list): Moved from elf32-mips.c. + (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_got16_reloc): New functions. + (_bfd_mips_elf_lo16_reloc, _bfd_mips_elf_generic_reloc): New functions. + (mips_elf_calculate_relocation): Assume addend is unshifted. + (_bfd_mips_elf_relocate_section): Don't apply the howto rightshift + on top of the usual high-part shift. Don't shift the addend right + before calling mips_elf_calculate_relocation. + + * elfxx-mips.h (_bfd_mips_elf_hi16_reloc): Declare. + (_bfd_mips_elf_got16_reloc, _bfd_mips_elf_lo16_reloc): Declare. + (_bfd_mips_elf_generic_reloc): Declare. + +2003-12-16 Eric Youngdale <eric@mkssoftware.com> + Nick Clifton <nickc@redhat.com> + + * peicode.h (pe_ILF_build_a_bfd): Only skip one instance of each + prefix character, if they are present. + +2003-12-15 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags + are set on known section types. + 2003-12-12 Nick Clifton <nickc@redhat.com> * po/ro.po: Updated translation. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 2afcf7f..cfce4ce 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -2807,6 +2807,22 @@ used when the lower 16 bits are treated as signed. */ add3, load, and store instructions. */ BFD_RELOC_M32R_SDA16, +/* For PIC. */ + BFD_RELOC_M32R_GOT24, + BFD_RELOC_M32R_26_PLTREL, + BFD_RELOC_M32R_COPY, + BFD_RELOC_M32R_GLOB_DAT, + BFD_RELOC_M32R_JMP_SLOT, + BFD_RELOC_M32R_RELATIVE, + BFD_RELOC_M32R_GOTOFF, + BFD_RELOC_M32R_GOTPC24, + BFD_RELOC_M32R_GOT16_HI_ULO, + BFD_RELOC_M32R_GOT16_HI_SLO, + BFD_RELOC_M32R_GOT16_LO, + BFD_RELOC_M32R_GOTPC_HI_ULO, + BFD_RELOC_M32R_GOTPC_HI_SLO, + BFD_RELOC_M32R_GOTPC_LO, + /* This is a 9-bit reloc */ BFD_RELOC_V850_9_PCREL, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index ccac05b..15d9709 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1064,7 +1064,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) sec_flags &= ~ SEC_READONLY; break; case IMAGE_SCN_MEM_DISCARDABLE: - sec_flags |= SEC_DEBUGGING; + /* The MS PE spec sets the DISCARDABLE flag on .reloc sections + but we do not want them to be labelled as debug section, since + then strip would remove them. */ + if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0) + sec_flags |= SEC_DEBUGGING; break; case IMAGE_SCN_MEM_SHARED: sec_flags |= SEC_SHARED; diff --git a/bfd/config.bfd b/bfd/config.bfd index c1ca87e..4987bce 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -597,6 +597,21 @@ case "${targ}" in targ_defvec=bfd_elf32_iq2000_vec ;; + m32r*le-*-linux*) + targ_defvec=bfd_elf32_m32rlelin_vec + targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" + ;; + + m32r*-*-linux*) + targ_defvec=bfd_elf32_m32rlin_vec + targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" + ;; + + m32r*le-*-*) + targ_defvec=bfd_elf32_m32rle_vec + targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec" + ;; + m32r-*-*) targ_defvec=bfd_elf32_m32r_vec ;; diff --git a/bfd/configure b/bfd/configure index 42345bb..5704aef 100755 --- a/bfd/configure +++ b/bfd/configure @@ -6320,6 +6320,9 @@ do bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;; @@ -6579,10 +6582,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6583: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6586: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6586 "configure" +#line 6589 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6628,17 +6631,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6632: checking for $ac_hdr" >&5 +echo "configure:6635: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6637 "configure" +#line 6640 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6667,12 +6670,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6671: checking for $ac_func" >&5 +echo "configure:6674: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6676 "configure" +#line 6679 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6695,7 +6698,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6720,7 +6723,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6724: checking for working mmap" >&5 +echo "configure:6727: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6728,7 +6731,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6732 "configure" +#line 6735 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6868,7 +6871,7 @@ main() } EOF -if { (eval echo configure:6872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6893,12 +6896,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6897: checking for $ac_func" >&5 +echo "configure:6900: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6902 "configure" +#line 6905 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6921,7 +6924,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 72c32bd..760bfe3 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -631,6 +631,9 @@ do bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 2794ffb..3edf4a9 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -44,6 +44,8 @@ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); static void m32r_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void m32r_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); bfd_boolean _bfd_m32r_elf_section_from_bfd_section PARAMS ((bfd *, asection *, int *)); void _bfd_m32r_elf_symbol_processing @@ -77,10 +79,34 @@ static bfd_boolean m32r_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static bfd_boolean m32r_elf_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean m32r_elf_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + asection * m32r_elf_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean m32r_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean m32r_elf_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean m32r_elf_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); + +static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean readonly_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static enum elf_reloc_type_class m32r_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); +static bfd_boolean m32r_elf_fake_sections + PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); + #define NOP_INSN 0x7000 #define MAKE_PARALLEL(insn) ((insn) | 0x8000) @@ -88,11 +114,55 @@ asection * m32r_elf_gc_mark_hook This only saves space in libraries and object files, but perhaps relocs will be put in ROM? All in all though, REL relocs are a pain to work with. */ -#define USE_REL 1 +/* #define USE_REL 1 #ifndef USE_REL #define USE_REL 0 -#endif +#endif */ +/* Use RELA. But use REL to link old objects for backwords compatibility. */ + +/* Functions for the M32R ELF linker. */ + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +/* The nop opcode we use. */ + +#define M32R_NOP 0x7000f000 + +#define PLT_EMPTY 0x10101010 /* RIE -> RIE */ + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 20 +#define PLT_HEADER_SIZE 20 + +/* The first one entries in a procedure linkage table are reserved, + and the initial contents are unimportant (we zero them out). + Subsequent entries look like this. */ + +#define PLT0_ENTRY_WORD0 0xd6c00000 /* seth r6, #high(.got+4) */ +#define PLT0_ENTRY_WORD1 0x86e60000 /* or3 r6, r6, #low(.got)+4) */ +#define PLT0_ENTRY_WORD2 0x24e626c6 /* ld r4, @r6+ -> ld r6, @r6 */ +#define PLT0_ENTRY_WORD3 0x1fc6f000 /* jmp r6 || pnop */ +#define PLT0_ENTRY_WORD4 PLT_EMPTY /* RIE -> RIE */ + +#define PLT0_PIC_ENTRY_WORD0 0xa4cc0004 /* ld r4, @(4,r12) */ +#define PLT0_PIC_ENTRY_WORD1 0xa6cc0008 /* ld r6, @(8,r12) */ +#define PLT0_PIC_ENTRY_WORD2 0x1fc6f000 /* jmp r6 || nop */ +#define PLT0_PIC_ENTRY_WORD3 PLT_EMPTY /* RIE -> RIE */ +#define PLT0_PIC_ENTRY_WORD4 PLT_EMPTY /* RIE -> RIE */ + +#define PLT_ENTRY_WORD0 0xe6000000 /* ld24 r6, .name_in_GOT */ +#define PLT_ENTRY_WORD1 0x06acf000 /* add r6, r12 || nop */ +#define PLT_ENTRY_WORD0b 0xd6c00000 /* seth r6, #high(.name_in_GOT) */ +#define PLT_ENTRY_WORD1b 0x86e60000 /* or3 r6, r6, #low(.name_in_GOT) */ +#define PLT_ENTRY_WORD2 0x26c61fc6 /* ld r6, @r6 -> jmp r6 */ +#define PLT_ENTRY_WORD3 0xe5000000 /* ld24 r5, $offset */ +#define PLT_ENTRY_WORD4 0xff000000 /* bra .plt0. */ + static reloc_howto_type m32r_elf_howto_table[] = { @@ -302,6 +372,437 @@ static reloc_howto_type m32r_elf_howto_table[] = 0, /* dst_mask */ FALSE), /* pcrel_offset */ + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), + EMPTY_HOWTO (24), + EMPTY_HOWTO (25), + EMPTY_HOWTO (26), + EMPTY_HOWTO (27), + EMPTY_HOWTO (28), + EMPTY_HOWTO (29), + EMPTY_HOWTO (30), + EMPTY_HOWTO (31), + EMPTY_HOWTO (32), + + /* A 16 bit absolute relocation. */ + HOWTO (R_M32R_16_RELA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_16_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_M32R_32_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_M32R_32_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 24 bit address. */ + HOWTO (R_M32R_24_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_M32R_24_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_M32R_10_PCREL_RELA, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_10_pcrel_reloc, /* special_function */ + "R_M32R_10_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_18_PCREL_RELA, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_18_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 26 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_26_PCREL_RELA, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is or'd in. */ + HOWTO (R_M32R_HI16_ULO_RELA, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_HI16_ULO_RELA",/* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is added in. */ + HOWTO (R_M32R_HI16_SLO_RELA, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_HI16_SLO_RELA",/* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Lower 16 bits of address. */ + HOWTO (R_M32R_LO16_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_LO16_RELA", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Small data area 16 bits offset. */ + HOWTO (R_M32R_SDA16_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_SDA16_RELA", /* name */ + TRUE, /* partial_inplace */ /* FIXME: correct? */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_M32R_RELA_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_M32R_RELA_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_M32R_RELA_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_M32R_RELA_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (45), + EMPTY_HOWTO (46), + EMPTY_HOWTO (47), + + /* Like R_M32R_24, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_PCREL, but referring to the procedure linkage table + entry for the symbol. */ + HOWTO (R_M32R_26_PLTREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PLTREL", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* This is used only by the dynamic linker. The symbol should exist + both in the object being run and in some shared library. The + dynamic linker copies the data addressed by the symbol from the + shared library into the object, because the object being + run has to have the data at some particular address. */ + HOWTO (R_M32R_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_COPY", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_24, but used when setting global offset table + entries. */ + HOWTO (R_M32R_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Marks a procedure linkage table entry for a symbol. */ + HOWTO (R_M32R_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_JMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used only by the dynamic linker. When the object is run, this + longword is set to the load address of the object, plus the + addend. */ + HOWTO (R_M32R_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_M32R_GOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTOFF", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative 24-bit relocation used when setting PIC offset + table register. */ + HOWTO (R_M32R_GOTPC24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Like R_M32R_HI16_ULO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_HI_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_HI_ULO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_HI16_SLO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_HI_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_HI_SLO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_LO16, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_LO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_LO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_HI16_ULO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_HI_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_HI_ULO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_HI16_SLO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_HI_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_HI_SLO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_LO16, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_LO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_LO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ }; /* Handle the R_M32R_10_PCREL reloc. */ @@ -715,7 +1216,7 @@ struct m32r_reloc_map unsigned char elf_reloc_val; }; -static const struct m32r_reloc_map m32r_reloc_map[] = +static const struct m32r_reloc_map m32r_reloc_map_old[] = { { BFD_RELOC_NONE, R_M32R_NONE }, { BFD_RELOC_16, R_M32R_16 }, @@ -732,6 +1233,38 @@ static const struct m32r_reloc_map m32r_reloc_map[] = { BFD_RELOC_VTABLE_ENTRY, R_M32R_GNU_VTENTRY }, }; +static const struct m32r_reloc_map m32r_reloc_map[] = +{ + { BFD_RELOC_NONE, R_M32R_NONE }, + { BFD_RELOC_16, R_M32R_16_RELA }, + { BFD_RELOC_32, R_M32R_32_RELA }, + { BFD_RELOC_M32R_24, R_M32R_24_RELA }, + { BFD_RELOC_M32R_10_PCREL, R_M32R_10_PCREL_RELA }, + { BFD_RELOC_M32R_18_PCREL, R_M32R_18_PCREL_RELA }, + { BFD_RELOC_M32R_26_PCREL, R_M32R_26_PCREL_RELA }, + { BFD_RELOC_M32R_HI16_ULO, R_M32R_HI16_ULO_RELA }, + { BFD_RELOC_M32R_HI16_SLO, R_M32R_HI16_SLO_RELA }, + { BFD_RELOC_M32R_LO16, R_M32R_LO16_RELA }, + { BFD_RELOC_M32R_SDA16, R_M32R_SDA16_RELA }, + { BFD_RELOC_VTABLE_INHERIT, R_M32R_RELA_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_M32R_RELA_GNU_VTENTRY }, + + { BFD_RELOC_M32R_GOT24, R_M32R_GOT24 }, + { BFD_RELOC_M32R_26_PLTREL, R_M32R_26_PLTREL }, + { BFD_RELOC_M32R_COPY, R_M32R_COPY }, + { BFD_RELOC_M32R_GLOB_DAT, R_M32R_GLOB_DAT }, + { BFD_RELOC_M32R_JMP_SLOT, R_M32R_JMP_SLOT }, + { BFD_RELOC_M32R_RELATIVE, R_M32R_RELATIVE }, + { BFD_RELOC_M32R_GOTOFF, R_M32R_GOTOFF }, + { BFD_RELOC_M32R_GOTPC24, R_M32R_GOTPC24 }, + { BFD_RELOC_M32R_GOT16_HI_ULO, R_M32R_GOT16_HI_ULO }, + { BFD_RELOC_M32R_GOT16_HI_SLO, R_M32R_GOT16_HI_SLO }, + { BFD_RELOC_M32R_GOT16_LO, R_M32R_GOT16_LO }, + { BFD_RELOC_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_ULO }, + { BFD_RELOC_M32R_GOTPC_HI_SLO, R_M32R_GOTPC_HI_SLO }, + { BFD_RELOC_M32R_GOTPC_LO, R_M32R_GOTPC_LO }, +}; + static reloc_howto_type * bfd_elf32_bfd_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; @@ -739,6 +1272,16 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) { unsigned int i; +#ifdef USE_M32R_OLD_RELOC + for (i = 0; + i < sizeof (m32r_reloc_map_old) / sizeof (struct m32r_reloc_map); + i++) + { + if (m32r_reloc_map_old[i].bfd_reloc_val == code) + return &m32r_elf_howto_table[m32r_reloc_map_old[i].elf_reloc_val]; + } +#else /* ! USE_M32R_OLD_RELOC */ + for (i = 0; i < sizeof (m32r_reloc_map) / sizeof (struct m32r_reloc_map); i++) @@ -746,6 +1289,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) if (m32r_reloc_map[i].bfd_reloc_val == code) return &m32r_elf_howto_table[m32r_reloc_map[i].elf_reloc_val]; } +#endif return NULL; } @@ -761,9 +1305,22 @@ m32r_info_to_howto_rel (abfd, cache_ptr, dst) unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_M32R_max); + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY) cache_ptr->howto = &m32r_elf_howto_table[r_type]; } + +static void +m32r_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + BFD_ASSERT ((ELF32_R_TYPE(dst->r_info) == (unsigned int) R_M32R_NONE) + || ((ELF32_R_TYPE(dst->r_info) > (unsigned int) R_M32R_GNU_VTENTRY) + && (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_M32R_max))); + cache_ptr->howto = &m32r_elf_howto_table[ELF32_R_TYPE(dst->r_info)]; +} + /* Given a BFD section, try to locate the corresponding ELF section index. */ @@ -935,6 +1492,997 @@ m32r_elf_final_sda_base (output_bfd, info, error_message, psb) return bfd_reloc_ok; } +/* Return size of a PLT entry. */ +#define elf_m32r_sizeof_plt(info) PLT_ENTRY_SIZE + +/* The m32r linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_m32r_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_m32r_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* The sh linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct elf_m32r_dyn_relocs +{ + struct elf_m32r_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + + +/* m32r ELF linker hash entry. */ + +struct elf_m32r_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Track dynamic relocs copied for this symbol. */ + struct elf_m32r_dyn_relocs *dyn_relocs; + +// bfd_signed_vma gotplt_refcount; + + /* Number of PC relative relocs copied for this symbol. */ + /* struct elf_m32r_pcrel_relocs_copied *pcrel_relocs_copied; FIXME */ +}; + +/* m32r ELF linker hash table. */ + +struct elf_m32r_link_hash_table +{ + struct elf_link_hash_table root; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; + +/* Traverse an m32r ELF linker hash table. */ + +#define m32r_elf_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the m32r ELF linker hash table from a link_info structure. */ + + +#define m32r_elf_hash_table(p) \ + ((struct elf_m32r_link_hash_table *) ((p)->hash)) + +/* Create an entry in an m32r ELF linker hash table. */ +static struct bfd_hash_entry * +m32r_elf_link_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, + const char * ); + +static struct bfd_hash_entry * +m32r_elf_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_m32r_link_hash_entry *ret = + (struct elf_m32r_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_m32r_link_hash_entry *) NULL) + ret = ((struct elf_m32r_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_m32r_link_hash_entry))); + if (ret == (struct elf_m32r_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_m32r_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_m32r_link_hash_entry *) NULL) + { + struct elf_m32r_link_hash_entry *eh; + + eh = (struct elf_m32r_link_hash_entry *) ret; + eh->dyn_relocs = NULL; +// eh->gotplt_refcount = 0; + /* eh->pcrel_relocs_copied = NULL; FIXME */ + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an m32r ELF linker hash table. */ +static struct bfd_link_hash_table *m32r_elf_link_hash_table_create (bfd *); + +static struct bfd_link_hash_table * +m32r_elf_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_m32r_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_m32r_link_hash_table); + + ret = (struct elf_m32r_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf_m32r_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + m32r_elf_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->sym_sec.abfd = NULL; + + return &ret->root.root; +} + +/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ +static bfd_boolean create_got_section (bfd *, struct bfd_link_info *); + +static bfd_boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab = m32r_elf_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (! htab->sgot || ! htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) + return FALSE; + + return TRUE; +} + +/* Create dynamic sections when linking against a dynamic object. */ + +static bfd_boolean +m32r_elf_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + flagword flags, pltflags; + register asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign = 2; /* 32bit */ + + htab = m32r_elf_hash_table (info); + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + htab->splt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct elf_link_hash_entry *h = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, FALSE, + get_elf_backend_data (abfd)->collect, + (struct bfd_link_hash_entry **) &h))) + return FALSE; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! _bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + htab->srelplt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (htab->sgot == NULL + && ! create_got_section (abfd, info)) + return FALSE; + + { + const char *secname; + char *relname; + flagword secflags; + asection *sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + if (bfd_get_section_by_name (abfd, secname)) + continue; + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + htab->sdynbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + htab->srelbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ +static void m32r_elf_copy_indirect_symbol (const struct elf_backend_data *, + struct elf_link_hash_entry *, + struct elf_link_hash_entry *); + +static void +m32r_elf_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf_m32r_link_hash_entry *edir, *eind; + + edir = (struct elf_m32r_link_hash_entry *) dir; + eind = (struct elf_m32r_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf_m32r_dyn_relocs **pp; + struct elf_m32r_dyn_relocs *p; + + if (ind->root.type == bfd_link_hash_indirect) + abort (); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf_m32r_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + +// if (ind->root.type == bfd_link_hash_indirect +// && dir->got.refcount <= 0) +// { +// edir->tls_type = eind->tls_type; +// eind->tls_type = GOT_UNKNOWN; +// } + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); +} + + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +m32r_elf_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + struct elf_m32r_link_hash_table *htab; + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + bfd *dynobj; + asection *s; + unsigned int power_of_two; + +#ifdef DEBUG_PIC +printf("m32r_elf_adjust_dynamic_symbol()\n"); +#endif + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a PCREL + reloc instead. */ + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; + } + else + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + eh = (struct elf_m32r_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & (SEC_READONLY | SEC_HAS_CONTENTS)) != 0) + break; + } + + /* If we didn't find any dynamic relocs in sections which needs the + copy reloc, then we'll be keeping the dynamic relocs and avoiding + the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + htab = m32r_elf_hash_table (info); + s = htab->sdynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_M32R_COPY reloc to tell the dynamic linker + to copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = htab->srelbss; + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* This is the condition under which finish_dynamic_symbol will be called + from elflink.h. If elflink.h doesn't call our finish_dynamic_symbol + routine, we'll need to do something about initializing any .plt and .got + entries in relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info; + struct elf_m32r_link_hash_table *htab; + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = m32r_elf_hash_table (info); + + eh = (struct elf_m32r_link_hash_entry *) h; +// if ((h->got.refcount > 0 +// || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) +// && eh->gotplt_refcount > 0) +// { +// /* The symbol has been forced local, or we have some direct got refs, +// so treat all the gotplt refs as got refs. */ +// h->got.refcount += eh->gotplt_refcount; +// if (h->plt.refcount >= eh->gotplt_refcount) +// h->plt.refcount -= eh->gotplt_refcount; +// } + + if (htab->root.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + h->plt.offset = s->_raw_size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += 4; + + /* We also need to make an entry in the .rel.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + + h->got.offset = s->_raw_size; + s->_raw_size += 4; + dyn = htab->root.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + + if (eh->dyn_relocs == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + struct elf_m32r_dyn_relocs **pp; + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf_m32r_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +m32r_elf_size_dynamic_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd_boolean relocs; + bfd *ibfd; + +#ifdef DEBUG_PIC +printf("m32r_elf_size_dynamic_sections()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + BFD_ASSERT (dynobj != NULL); + + if (htab->root.dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (! info->shared) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf_m32r_dyn_relocs *p; + + for (p = ((struct elf_m32r_dyn_relocs *) + elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (! bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf32_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += 4; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rela); + } + else + *local_got = (bfd_vma) -1; + } + } + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_M32R_NONE reloc instead + of garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL) + return FALSE; + } + + if (htab->root.dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in m32r_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (! info->shared) + { + if (! add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (htab->splt->_raw_size != 0) + { + if (! add_dynamic_entry (DT_PLTGOT, 0) + || ! add_dynamic_entry (DT_PLTRELSZ, 0) + || ! add_dynamic_entry (DT_PLTREL, DT_RELA) + || ! add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (! add_dynamic_entry (DT_RELA, 0) + || ! add_dynamic_entry (DT_RELASZ, 0) + || ! add_dynamic_entry (DT_RELAENT, + sizeof (Elf32_External_Rela))) + return FALSE; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->root, readonly_dynrelocs, + (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (! add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } + } +#undef add_dynamic_entry + + return TRUE; +} /* Relocate an M32R/D ELF section. There is some attempt to make this function usable for many architectures, both for RELA and REL type relocs, if only to serve as a learning tool. @@ -986,10 +2534,17 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Assume success. */ bfd_boolean ret = TRUE; -#if !USE_REL - if (info->relocatable) - return TRUE; -#endif + struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info); + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot, *splt, *sreloc; + + dynobj = htab->root.dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = htab->sgot; + splt = htab->splt; + sreloc = NULL; rel = relocs; relend = relocs + input_section->reloc_count; @@ -998,18 +2553,19 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, int r_type; reloc_howto_type *howto; unsigned long r_symndx; + struct elf_link_hash_entry *h; /* We can't modify r_addend here as elf_link_input_bfd has an assert to - ensure it's zero (we use REL relocs, not RELA). Therefore this - should be assigning zero to `addend', but for clarity we use - `r_addend'. */ + ensure it's zero (we use REL relocs, not RELA). Therefore this + should be assigning zero to `addend', but for clarity we use + `r_addend'. */ bfd_vma addend = rel->r_addend; bfd_vma offset = rel->r_offset; - struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; const char *sym_name; bfd_reloc_status_type r; const char *errmsg = NULL; + bfd_boolean use_rel = FALSE; h = NULL; r_type = ELF32_R_TYPE (rel->r_info); @@ -1024,14 +2580,19 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, } if (r_type == R_M32R_GNU_VTENTRY - || r_type == R_M32R_GNU_VTINHERIT) + || r_type == R_M32R_GNU_VTINHERIT + || r_type == R_M32R_NONE + || r_type == R_M32R_RELA_GNU_VTENTRY + || r_type == R_M32R_RELA_GNU_VTINHERIT) continue; + if (r_type <= R_M32R_GNU_VTENTRY) + use_rel = TRUE; + howto = m32r_elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); -#if USE_REL - if (info->relocatable) + if (info->relocatable && (use_rel == TRUE)) { /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, @@ -1092,13 +2653,13 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, } } else -#endif /* USE_REL */ { bfd_vma relocation; /* This is a final link. */ sym = NULL; sec = NULL; + h = NULL; if (r_symndx < symtab_hdr->sh_info) { @@ -1106,20 +2667,37 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; sym_name = "<local symbol>"; -#if !USE_REL - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); - addend = rel->r_addend; -#else - /* FIXME: This won't handle local relocations against SEC_MERGE - symbols. See elf32-i386.c for how to do this. */ - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); -#endif + + if (use_rel == FALSE) + { + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += sec->output_offset + sym->st_value; + + continue; + } + } + else + { + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } } else { /* External symbol. */ + if (info->relocatable && (use_rel == FALSE)) + continue; + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) @@ -1129,9 +2707,64 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { + bfd_boolean dyn; sec = h->root.u.def.section; - if (sec->output_section == NULL) - relocation = 0; + + dyn = htab->root.dynamic_sections_created; + sec = h->root.u.def.section; + if (r_type == R_M32R_GOTPC24 + || (r_type == R_M32R_GOTPC_HI_ULO + || r_type == R_M32R_GOTPC_HI_SLO + || r_type == R_M32R_GOTPC_LO) + || (r_type == R_M32R_26_PLTREL + && h->plt.offset != (bfd_vma) -1) + || ((r_type == R_M32R_GOT24 + || r_type == R_M32R_GOT16_HI_ULO + || r_type == R_M32R_GOT16_HI_SLO + || r_type == R_M32R_GOT16_LO) + && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && (((r_type == R_M32R_16_RELA + || r_type == R_M32R_32_RELA + || r_type == R_M32R_24_RELA + || r_type == R_M32R_HI16_ULO_RELA + || r_type == R_M32R_HI16_SLO_RELA + || r_type == R_M32R_LO16_RELA) + && (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) == 0) + || r_type == R_M32R_10_PCREL_RELA + || r_type == R_M32R_18_PCREL_RELA + || r_type == R_M32R_26_PCREL_RELA) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_M32R_16(24,32) relocations + in its sections against symbols defined + externally in shared libraries. We can't do + anything with them here. */ + || ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))) + { + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + } + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + + relocation = 0; + } else relocation = (h->root.u.def.value + sec->output_section->vma @@ -1139,11 +2772,17 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; + else if (info->shared + && (!info->symbolic) + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; else { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, offset, TRUE))) + input_section, offset, + (!info->shared + || ELF_ST_VISIBILITY (h->other))))) return FALSE; relocation = 0; } @@ -1158,11 +2797,283 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, switch ((int) r_type) { + case R_M32R_GOTPC24: + /* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation + ld24 rx,#_GLOBAL_OFFSET_TABLE_ + */ + relocation = sgot->output_section->vma; + break; + + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + { + /* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation + bl .+4 + seth rx,#high(_GLOBAL_OFFSET_TABLE_) + or3 rx,rx,#low(_GLOBAL_OFFSET_TABLE_ +4) + or + bl .+4 + seth rx,#shigh(_GLOBAL_OFFSET_TABLE_) + add3 rx,rx,#low(_GLOBAL_OFFSET_TABLE_ +4) + */ + relocation = sgot->output_section->vma; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + if ((r_type == R_M32R_GOTPC_HI_SLO) + && ((relocation + rel->r_addend) & 0x8000)) + rel->r_addend += 0x10000; + + break; + } + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + /* Fall through. */ + case R_M32R_GOT24: + /* Relocation is to the entry for this symbol in the global + offset table. */ + BFD_ASSERT (sgot != NULL); + + if (h != NULL) + { + bfd_boolean dyn; + bfd_vma off; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + + dyn = htab->root.dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + || (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, + sgot->contents + off); + h->got.offset |= 1; + } + } + + relocation = sgot->output_offset + off; + } + else + { + bfd_vma off; + bfd_byte *loc; + + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already processed this entry. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *srelgot; + Elf_Internal_Rela outrel; + + /* We need to generate a R_M32R_RELATIVE reloc + for the dynamic linker. */ + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + outrel.r_addend = relocation; + loc = srelgot->contents; + loc += srelgot->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc); + ++srelgot->reloc_count; + } + + local_got_offsets[r_symndx] |= 1; + } + + relocation = sgot->output_offset + off; + } + if ((r_type == R_M32R_GOT16_HI_SLO) + && ((relocation + rel->r_addend) & 0x8000)) + rel->r_addend += 0x10000; + + break; + + case R_M32R_26_PLTREL: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* The native assembler will generate a 26_PLTREL reloc + for a local symbol if you assemble a call from one + section to another when using -K pic. */ + if (h == NULL) + break; + + //if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + // || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + // break; + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + break; + + if (h->plt.offset == (bfd_vma) -1) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + break; + + case R_M32R_HI16_SLO_RELA: + { + if ((relocation + rel->r_addend) & 0x8000) + { + rel->r_addend += 0x10000; + } + } + /* Fall through. */ + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + if (info->shared + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && ((r_type != R_M32R_18_PCREL_RELA + && r_type != R_M32R_26_PCREL_RELA) + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate; + bfd_byte *loc; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = _bfd_elf_section_offset (output_bfd, + info, + input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (r_type == R_M32R_18_PCREL_RELA + || r_type == R_M32R_26_PCREL_RELA) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc); + ++sreloc->reloc_count; + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } + break; + case (int) R_M32R_10_PCREL : r = m32r_elf_do_10_pcrel_reloc (input_bfd, howto, input_section, contents, offset, sec, relocation, addend); - break; + goto check_reloc; case (int) R_M32R_HI16_SLO : case (int) R_M32R_HI16_ULO : @@ -1190,7 +3101,8 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, contents, offset, relocation, addend); } - break; + + goto check_reloc; case (int) R_M32R_SDA16 : { @@ -1233,14 +3145,20 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, continue; } } - /* fall through */ + /* fall through */ + + default : /* OLD_M32R_RELOC */ - default : r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, offset, relocation, addend); - break; + goto check_reloc; } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + } check_reloc: @@ -1307,6 +3225,353 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, return ret; } + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ +static bfd_boolean +m32r_elf_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + bfd_byte *loc; + +#ifdef DEBUG_PIC +printf("m32r_elf_finish_dynamic_symbol()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srela; + + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rela; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = htab->splt; + sgot = htab->sgotplt; + srela = htab->srelplt; + BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD0b + + (((sgot->output_section->vma + + sgot->output_offset + + got_offset) >> 16) & 0xffff)), + splt->contents + h->plt.offset); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD1b + + ((sgot->output_section->vma + + sgot->output_offset + + got_offset) & 0xffff)), + splt->contents + h->plt.offset + 4); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + splt->contents + h->plt.offset + 8); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD3 + + plt_index * sizeof (Elf32_External_Rela)), + splt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD4 + + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), + splt->contents + h->plt.offset + 16); + } + else + { + bfd_put_32 (output_bfd, + PLT_ENTRY_WORD0 + got_offset, + splt->contents + h->plt.offset); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD1, + splt->contents + h->plt.offset + 4); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + splt->contents + h->plt.offset + 8); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD3 + + plt_index * sizeof (Elf32_External_Rela)), + splt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD4 + + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), + splt->contents + h->plt.offset + 16); + } + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 12), /* same offset */ + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_JMP_SLOT); + rela.r_addend = 0; + loc = srela->contents; + loc += plt_index * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = htab->sgot; + srela = htab->srelgot; + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rela.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + rela.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + BFD_ASSERT((h->got.offset & 1) == 0); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_GLOB_DAT); + rela.r_addend = 0; + } + + loc = srela->contents; + loc += srela->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + ++srela->reloc_count; + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rela; + + /* This symbols needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_COPY); + rela.r_addend = 0; + loc = s->contents; + loc += s->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + ++s->reloc_count; + } + + /* Mark some specially defined symbols as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + + +/* Finish up the dynamic sections. */ + +static bfd_boolean +m32r_elf_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + asection *sdyn; + asection *sgot; + +#ifdef DEBUG_PIC +printf("m32r_elf_finish_dynamic_sections()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + + sgot = htab->sgotplt; + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (htab->root.dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sgot != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + s = htab->sgot->output_section; + goto get_vma; + case DT_JMPREL: + name = ".rela.plt"; + s = htab->srelplt->output_section; + get_vma: + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = htab->srelplt->output_section; + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->srelplt != NULL) + { + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = htab->splt; + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD2, splt->contents + 8); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD3, splt->contents + 12); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD4, splt->contents + 16); + } + else + { + unsigned long addr; + /* addr = .got + 4 */ + addr = sgot->output_section->vma + sgot->output_offset + 4; + bfd_put_32 (output_bfd, + PLT0_ENTRY_WORD0 | ((addr >> 16) & 0xffff), + splt->contents); + bfd_put_32 (output_bfd, + PLT0_ENTRY_WORD1 | (addr & 0xffff), + splt->contents + 4); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD2, splt->contents + 8); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD3, splt->contents + 12); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD4, splt->contents + 16); + } + + elf_section_data (splt->output_section)->this_hdr.sh_entsize = + PLT_ENTRY_SIZE; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot && sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } + + return TRUE; +} + #if 0 /* relaxing not supported yet */ @@ -2005,6 +4270,8 @@ m32r_elf_gc_mark_hook (sec, info, rel, h, sym) { case R_M32R_GNU_VTINHERIT: case R_M32R_GNU_VTENTRY: + case R_M32R_RELA_GNU_VTINHERIT: + case R_M32R_RELA_GNU_VTENTRY: break; default: @@ -2035,7 +4302,97 @@ m32r_elf_gc_sweep_hook (abfd, info, sec, relocs) asection *sec ATTRIBUTE_UNUSED; const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; { - /* we don't use got and plt entries for m32r */ + /* Update the got entry reference counts for the section being removed. */ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOT24: + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + case R_M32R_GOTPC24: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + h->got.refcount--; + } + else + { + if (local_got_refcounts && local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx]--; + } + break; + + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_HI16_SLO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs **pp; + struct elf_m32r_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf_m32r_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA + || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_M32R_26_PLTREL: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + h->plt.refcount--; + } + break; + + default: + break; + } + return TRUE; } @@ -2054,32 +4411,250 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot, *srelgot, *sreloc; if (info->relocatable) return TRUE; + sgot = srelgot = sreloc = NULL; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); if (!elf_bad_symtab (abfd)) sym_hashes_end -= symtab_hdr->sh_info; + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { + int r_type; struct elf_link_hash_entry *h; unsigned long r_symndx; r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); if (r_symndx < symtab_hdr->sh_info) h = NULL; else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - switch (ELF32_R_TYPE (rel->r_info)) + /* Some relocs require a global offset table. */ + if (htab->sgot == NULL) + { + switch (r_type) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOTPC24: + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + case R_M32R_GOT24: + if (dynobj == NULL) + htab->root.dynobj = dynobj = abfd; + if (! create_got_section (dynobj, info)) + return FALSE; + break; + + default: + break; + } + } + + switch (r_type) { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOT24: + + if (h != NULL) + h->got.refcount += 1; + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local + symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + local_got_refcounts[r_symndx] += 1; + } + break; + + case R_M32R_26_PLTREL: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code without + linking in any dynamic objects, in which case we don't + need to generate a procedure linkage table after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; + break; + + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_HI16_SLO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + + if (h != NULL && !info->shared) + { + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->plt.refcount += 1; + } + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + dyn_relocs field of the hash table entry. A similar + situation occurs when creating shared libraries and symbol + visibility changes render the symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && ((r_type != R_M32R_26_PCREL_RELA + && r_type != R_M32R_18_PCREL_RELA) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf_m32r_dyn_relocs *p; + struct elf_m32r_dyn_relocs **head; + + if (dynobj == NULL) + htab->root.dynobj = dynobj = abfd; + + /* When creating a shared object, we must copy these + relocs into the output file. We create a reloc + section in dynobj and make room for the reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + head = &((struct elf_m32r_link_hash_entry *) h)->dyn_relocs; + else + { + asection *s; + + /* Track dynamic relocs needed for local syms too. */ + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + head = ((struct elf_m32r_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + } + + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof (*p); + p = ((struct elf_m32r_dyn_relocs *) bfd_alloc (dynobj, amt)); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; + } + + p->count += 1; + if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA + || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA) + p->pc_count += 1; + } + break; + /* This relocation describes the C++ object vtable hierarchy. Reconstruct it for later use during GC. */ + case R_M32R_RELA_GNU_VTINHERIT: case R_M32R_GNU_VTINHERIT: if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) return FALSE; @@ -2091,6 +4666,10 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) return FALSE; break; + case R_M32R_RELA_GNU_VTENTRY: + if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; } } @@ -2103,6 +4682,61 @@ static struct bfd_elf_special_section const m32r_elf_special_sections[]= { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, { NULL, 0, 0, 0, 0 } }; + +static bfd_boolean +m32r_elf_fake_sections (abfd, hdr, sec) + bfd *abfd; + Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED; + asection *sec; +{ + register const char *name; + + name = bfd_get_section_name (abfd, sec); + + /* The generic elf_fake_sections will set up REL_HDR using the + default kind of relocations. But, we may actually need both + kinds of relocations, so we set up the second header here. + + This is not necessary for the O32 ABI since that only uses Elf32_Rel + relocations (cf. System V ABI, MIPS RISC Processor Supplement, + 3rd Edition, p. 4-17). It breaks the IRIX 5/6 32-bit ld, since one + of the resulting empty .rela.<section> sections starts with + sh_offset == object size, and ld doesn't allow that. While the check + is arguably bogus for empty or SHT_NOBITS sections, it can easily be + avoided by not emitting those useless sections in the first place. */ + if ((sec->flags & SEC_RELOC) != 0) + { + struct bfd_elf_section_data *esd; + bfd_size_type amt = sizeof (Elf_Internal_Shdr); + + esd = elf_section_data (sec); + BFD_ASSERT (esd->rel_hdr2 == NULL); + esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt); + if (!esd->rel_hdr2) + return FALSE; + _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, + !sec->use_rela_p); + } + + return TRUE; +} + +static enum elf_reloc_type_class +m32r_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_M32R_RELATIVE: + return reloc_class_relative; + case R_M32R_JMP_SLOT: + return reloc_class_plt; + case R_M32R_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} #define ELF_ARCH bfd_arch_m32r #define ELF_MACHINE_CODE EM_M32R @@ -2111,8 +4745,10 @@ static struct bfd_elf_special_section const m32r_elf_special_sections[]= #define TARGET_BIG_SYM bfd_elf32_m32r_vec #define TARGET_BIG_NAME "elf32-m32r" +#define TARGET_LITTLE_SYM bfd_elf32_m32rle_vec +#define TARGET_LITTLE_NAME "elf32-m32rle" -#define elf_info_to_howto 0 +#define elf_info_to_howto m32r_info_to_howto #define elf_info_to_howto_rel m32r_info_to_howto_rel #define elf_backend_section_from_bfd_section _bfd_m32r_elf_section_from_bfd_section #define elf_backend_symbol_processing _bfd_m32r_elf_symbol_processing @@ -2122,10 +4758,35 @@ static struct bfd_elf_special_section const m32r_elf_special_sections[]= #define elf_backend_gc_sweep_hook m32r_elf_gc_sweep_hook #define elf_backend_check_relocs m32r_elf_check_relocs +#define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create +#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections +#define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections +#define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol +#define elf_backend_finish_dynamic_symbol m32r_elf_finish_dynamic_symbol +#define elf_backend_reloc_type_class m32r_elf_reloc_type_class +#define elf_backend_copy_indirect_symbol m32r_elf_copy_indirect_symbol + #define elf_backend_can_gc_sections 1 -#if !USE_REL +/*#if !USE_REL #define elf_backend_rela_normal 1 +#endif*/ +#define elf_backend_can_refcount 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 + +#define elf_backend_may_use_rel_p 1 +#ifdef USE_M32R_OLD_RELOC +#define elf_backend_default_use_rela_p 0 +#define elf_backend_may_use_rela_p 0 +#else +#define elf_backend_default_use_rela_p 1 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_fake_sections m32r_elf_fake_sections #endif + #if 0 /* not yet */ /* relax support */ #define bfd_elf32_bfd_relax_section m32r_elf_relax_section @@ -2141,3 +4802,20 @@ static struct bfd_elf_special_section const m32r_elf_special_sections[]= #define elf_backend_special_sections m32r_elf_special_sections #include "elf32-target.h" + +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x1000 + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_m32rlin_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-m32r-linux" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_m32rlelin_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-m32rle-linux" +#undef elf32_bed +#define elf32_bed elf32_m32r_lin_bed + +#include "elf32-target.h" + diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 299c395..27b1c4b 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -47,14 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ECOFF_SIGNED_32 #include "ecoffswap.h" -static bfd_reloc_status_type mips_elf_generic_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_hi16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_lo16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_got16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type gprel32_with_gp (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_gprel32_reloc @@ -120,7 +112,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -135,7 +127,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -150,7 +142,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -165,7 +157,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -183,7 +175,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC + 4. */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ TRUE, /* partial_inplace */ 0x03ffffff, /* src_mask */ @@ -192,13 +184,13 @@ static reloc_howto_type elf_mips_howto_table_rel[] = /* High 16 bits of symbol value. */ HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_hi16_reloc, /* special_function */ + _bfd_mips_elf_hi16_reloc, /* special_function */ "R_MIPS_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -213,7 +205,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_lo16_reloc, /* special_function */ + _bfd_mips_elf_lo16_reloc, /* special_function */ "R_MIPS_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -258,7 +250,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_got16_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -273,7 +265,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -288,7 +280,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -324,7 +316,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ TRUE, /* partial_inplace */ 0x000007c0, /* src_mask */ @@ -341,7 +333,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT6", /* name */ TRUE, /* partial_inplace */ 0x000007c4, /* src_mask */ @@ -371,7 +363,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -386,7 +378,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -401,7 +393,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -416,7 +408,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -431,7 +423,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -446,7 +438,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -466,7 +458,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -481,7 +473,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -496,7 +488,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -511,7 +503,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -526,7 +518,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -547,7 +539,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0x00000000, /* src_mask */ @@ -611,13 +603,13 @@ static reloc_howto_type elf_mips16_gprel_howto = /* High 16 bits of symbol value, pc-relative. */ static reloc_howto_type elf_mips_gnu_rel_hi16 = HOWTO (R_MIPS_GNU_REL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_hi16_reloc, /* special_function */ + _bfd_mips_elf_hi16_reloc, /* special_function */ "R_MIPS_GNU_REL_HI16", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -633,7 +625,7 @@ static reloc_howto_type elf_mips_gnu_rel_lo16 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_lo16_reloc, /* special_function */ + _bfd_mips_elf_lo16_reloc, /* special_function */ "R_MIPS_GNU_REL_LO16", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -649,7 +641,7 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -665,7 +657,7 @@ static reloc_howto_type elf_mips_gnu_pcrel64 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC64", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -681,7 +673,7 @@ static reloc_howto_type elf_mips_gnu_pcrel32 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -720,260 +712,6 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto = 0, /* dst_mask */ FALSE); /* pcrel_offset */ -/* We use this instead of bfd_elf_generic_reloc because the latter - gets the handling of zero addends wrong. */ -static bfd_reloc_status_type -mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) -{ - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Just go on, nothing to see here. */ - return bfd_reloc_continue; -} - -/* Do a R_MIPS_HI16 relocation. This has to be done in combination - with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to - the HI16. Here we just save the information we need; we do the - actual relocation when we see the LO16. - - MIPS ELF requires that the LO16 immediately follow the HI16. As a - GNU extension, for non-pc-relative relocations, we permit an - arbitrary number of HI16 relocs to be associated with a single LO16 - reloc. This extension permits gcc to output the HI and LO relocs - itself. - - This cannot be done for PC-relative relocations because both the HI16 - and LO16 parts of the relocations must be done relative to the LO16 - part, and there can be carry to or borrow from the HI16 part. */ - -struct mips_hi16 -{ - struct mips_hi16 *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi16 *mips_hi16_list; - -static bfd_reloc_status_type -mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data, asection *input_section, - bfd *output_bfd, char **error_message) -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi16 *n; - - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - bfd_boolean relocatable; - bfd_vma gp; - - if (ret == bfd_reloc_undefined) - abort (); - - if (output_bfd != NULL) - relocatable = TRUE; - else - { - relocatable = FALSE; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocatable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - } - else - { - if (bfd_is_und_section (symbol->section) && output_bfd == NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - } - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let LO16 do the actual relocation. */ - n = bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_hi16_list; - mips_hi16_list = n; - - if (output_bfd != NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a R_MIPS_LO16 relocation. This is a straightforward 16 bit - inplace relocation; this function exists in order to do the - R_MIPS_HI16 relocation described above. */ - -static bfd_reloc_status_type -mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) -{ - arelent gp_disp_relent; - - if (mips_hi16_list != NULL) - { - struct mips_hi16 *l; - - l = mips_hi16_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi16 *next; - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = l->addend; - } - else - { - /* Do the HI16 relocation. Note that we actually don't need - to know anything about the LO16 itself, except where to - find the low 16 bits of the addend needed by the LO16. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - /* The low order 16 bits are always treated as a signed - value. */ - vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000; - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* If PC-relative, we need to subtract out the address of the LO - half of the HI/LO. (The actual relocation is relative - to that instruction.) */ - if (reloc_entry->howto->pc_relative) - val -= reloc_entry->address; - - /* At this point, "val" has the value of the combined HI/LO - pair. If the low order 16 bits (which will be used for - the LO16 insn) are negative, then we will need an - adjustment for the high order 16 bits. */ - val += 0x8000; - val = (val >> 16) & 0xffff; - - insn &= ~ (bfd_vma) 0xffff; - insn |= val; - bfd_put_32 (abfd, insn, l->addr); - } - - next = l->next; - free (l); - l = next; - } - - mips_hi16_list = NULL; - } - else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - bfd_reloc_status_type ret; - bfd_vma gp, relocation; - - /* FIXME: Does this case ever occur? */ - - ret = mips_elf_final_gp (output_bfd, symbol, TRUE, error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = relocation - 4; - } - - /* Now do the LO16 reloc in the usual way. */ - return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -static bfd_reloc_status_type -mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) -{ - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a dangerous relocation. */ @@ -1078,16 +816,6 @@ _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - if (output_bfd != NULL) relocatable = TRUE; else @@ -1118,17 +846,6 @@ mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - *error_message = (char *) - _("32bits gp relative relocation occurs for an external symbol"); - return bfd_reloc_outofrange; - } - if (output_bfd != NULL) relocatable = TRUE; else @@ -1194,20 +911,16 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, sign extension. */ static bfd_reloc_status_type -mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) +mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) { bfd_reloc_status_type r; arelent reloc32; unsigned long val; bfd_size_type addr; - r = mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - if (r != bfd_reloc_continue) - return r; - /* Do a normal 32 bit relocation on the lower 32 bits. */ reloc32 = *reloc_entry; if (bfd_big_endian (abfd)) diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 998c5df..ca0ed6e 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -104,8 +104,6 @@ static void mips_elf64_write_rel (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); static void mips_elf64_write_rela (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); -static bfd_reloc_status_type mips_elf64_hi16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_gprel16_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_literal_reloc @@ -114,8 +112,6 @@ static bfd_reloc_status_type mips_elf64_gprel32_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_shift6_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf64_got16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_jump_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc @@ -155,7 +151,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -170,7 +166,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -185,7 +181,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -200,7 +196,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -218,7 +214,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* This needs complex overflow detection, because the upper 36 bits must match the PC + 4. */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ TRUE, /* partial_inplace */ 0x03ffffff, /* src_mask */ @@ -230,13 +226,13 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* High 16 bits of symbol value. */ HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf64_hi16_reloc, /* special_function */ + _bfd_mips_elf_hi16_reloc, /* special_function */ "R_MIPS_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -251,7 +247,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_lo16_reloc, /* special_function */ "R_MIPS_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -296,7 +292,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf64_got16_reloc, /* special_function */ + _bfd_mips_elf_got16_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -311,7 +307,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -326,7 +322,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -360,7 +356,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ TRUE, /* partial_inplace */ 0x000007c0, /* src_mask */ @@ -390,7 +386,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -405,7 +401,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -420,7 +416,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -435,7 +431,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -450,7 +446,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -465,7 +461,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -480,7 +476,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -496,7 +492,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_A", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -513,7 +509,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_B", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -529,7 +525,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_DELETE", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -553,7 +549,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -568,7 +564,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -583,7 +579,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -597,7 +593,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -617,7 +613,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_RELGOT", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -633,7 +629,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -653,7 +649,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -668,7 +664,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -683,7 +679,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -698,7 +694,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -716,7 +712,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* This needs complex overflow detection, because the upper 36 bits must match the PC + 4. */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -731,7 +727,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -746,7 +742,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -791,7 +787,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf64_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -806,7 +802,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -821,7 +817,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -855,7 +851,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -885,7 +881,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -900,7 +896,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -915,7 +911,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -930,7 +926,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -945,7 +941,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -960,7 +956,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -975,7 +971,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -991,7 +987,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_A", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1008,7 +1004,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_B", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1024,7 +1020,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_DELETE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1039,7 +1035,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1054,7 +1050,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1069,7 +1065,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1084,7 +1080,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1099,7 +1095,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1113,7 +1109,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1133,7 +1129,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_RELGOT", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1149,7 +1145,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1233,7 +1229,7 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -1249,7 +1245,7 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1411,66 +1407,6 @@ mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src, (Elf64_Mips_External_Rela *) dst); } -/* Do a R_MIPS_HI16 relocation. */ - -static bfd_reloc_status_type -mips_elf64_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) -{ - /* If we're relocating, and this is an external symbol, we don't - want to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (reloc_entry->howto->partial_inplace) - { - if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff) - reloc_entry->addend += 0x8000; - } - - return bfd_reloc_continue; -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -static bfd_reloc_status_type -mips_elf64_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) -{ - /* If we're relocating, and this is a local symbol, we can handle it - just like an R_MIPS_HI16. */ - if (output_bfd != NULL - && ((symbol->flags & BSF_SECTION_SYM) != 0 - || (symbol->flags & BSF_LOCAL) == 0)) - return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - - /* Otherwise we try to handle it as R_MIPS_GOT_DISP. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a dangerous relocation. */ @@ -1716,28 +1652,19 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf64_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) +mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { - /* If we're relocating, and this is an external symbol, we don't - want to change anything. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (symbol->flags & BSF_LOCAL) != 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - if (reloc_entry->howto->partial_inplace) { reloc_entry->addend = ((reloc_entry->addend & 0x00007c0) | (reloc_entry->addend & 0x00000800) >> 9); } - return bfd_reloc_continue; + return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, + error_message); } /* Handle a mips16 jump. */ diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 49cf898..2bfbf625 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -47,14 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ECOFF_SIGNED_32 #include "ecoffswap.h" -static bfd_reloc_status_type mips_elf_generic_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_hi16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_lo16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips_elf_got16_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf_assign_gp (bfd *, bfd_vma *); static bfd_reloc_status_type mips_elf_final_gp @@ -95,10 +87,6 @@ static irix_compat_t elf_n32_mips_irix_compat extern const bfd_target bfd_elf32_nbigmips_vec; extern const bfd_target bfd_elf32_nlittlemips_vec; -static asection *prev_reloc_section = NULL; -static bfd_vma prev_reloc_address = -1; -static bfd_vma prev_reloc_addend = 0; - /* Nonzero if ABFD is using the N32 ABI. */ #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) @@ -126,7 +114,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -141,7 +129,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -156,7 +144,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -171,7 +159,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -189,7 +177,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC + 4. */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ TRUE, /* partial_inplace */ 0x03ffffff, /* src_mask */ @@ -201,13 +189,13 @@ static reloc_howto_type elf_mips_howto_table_rel[] = /* High 16 bits of symbol value. */ HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_hi16_reloc, /* special_function */ + _bfd_mips_elf_hi16_reloc, /* special_function */ "R_MIPS_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -222,7 +210,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_lo16_reloc, /* special_function */ + _bfd_mips_elf_lo16_reloc, /* special_function */ "R_MIPS_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -267,7 +255,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_got16_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -282,7 +270,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -297,7 +285,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -333,7 +321,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ TRUE, /* partial_inplace */ 0x000007c0, /* src_mask */ @@ -363,7 +351,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -378,7 +366,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -393,7 +381,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -408,7 +396,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -423,7 +411,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -438,7 +426,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -453,7 +441,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -469,7 +457,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_A", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -486,7 +474,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_B", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -502,7 +490,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_DELETE", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -526,7 +514,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -541,7 +529,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -556,7 +544,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -570,7 +558,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -590,7 +578,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_RELGOT", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -606,7 +594,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0x00000000, /* src_mask */ @@ -626,7 +614,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -641,7 +629,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -656,7 +644,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -671,7 +659,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -689,7 +677,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = /* This needs complex overflow detection, because the upper 36 bits must match the PC + 4. */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -704,7 +692,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -719,7 +707,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -764,7 +752,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -779,7 +767,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -794,7 +782,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -828,7 +816,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -858,7 +846,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -873,7 +861,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -888,7 +876,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -903,7 +891,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -918,7 +906,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -933,7 +921,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -948,7 +936,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -964,7 +952,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_A", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -981,7 +969,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_B", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -997,7 +985,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_DELETE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1012,7 +1000,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1027,7 +1015,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1042,7 +1030,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1057,7 +1045,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1072,7 +1060,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1087,7 +1075,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1107,7 +1095,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_RELGOT", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1123,7 +1111,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -1207,7 +1195,7 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -1223,224 +1211,13 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - mips_elf_generic_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ TRUE); /* pcrel_offset */ -/* This is derived from bfd_elf_generic_reloc. NewABI allows us to have - several relocations against the same address. The addend is derived - from the addends of preceding relocations. If we don't need to - do something special, we simply keep track of the addend. */ - -#define GET_RELOC_ADDEND(obfd, sym, entry, sec) \ -{ \ - /* If we're relocating, and this is an external symbol, we don't \ - want to change anything. */ \ - if ((obfd) != NULL \ - && ((sym)->flags & BSF_SECTION_SYM) == 0 \ - && (! (entry)->howto->partial_inplace \ - || (entry)->addend == 0)) \ - { \ - (entry)->address += (sec)->output_offset; \ - return bfd_reloc_ok; \ - } \ - \ - /* The addend of combined relocs is remembered and left for \ - subsequent relocs. */ \ - if (prev_reloc_address != (entry)->address \ - || prev_reloc_section != (sec)) \ - { \ - prev_reloc_section = (sec); \ - prev_reloc_address = (entry)->address; \ - prev_reloc_addend = (entry)->addend; \ - } \ - else \ - (entry)->addend = prev_reloc_addend; \ -} - -#define SET_RELOC_ADDEND(entry) \ -{ \ - prev_reloc_addend = (entry)->addend; \ -} - -static bfd_reloc_status_type -mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) -{ - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - - return bfd_reloc_continue; -} - -/* Do a R_MIPS_HI16 relocation. This has to be done in combination - with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to - the HI16. Here we just save the information we need; we do the - actual relocation when we see the LO16. - - MIPS ELF requires that the LO16 immediately follow the HI16. As a - GNU extension, for non-pc-relative relocations, we permit an - arbitrary number of HI16 relocs to be associated with a single LO16 - reloc. This extension permits gcc to output the HI and LO relocs - itself. - - This cannot be done for PC-relative relocations because both the HI16 - and LO16 parts of the relocations must be done relative to the LO16 - part, and there can be carry to or borrow from the HI16 part. */ - -struct mips_hi16 -{ - struct mips_hi16 *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi16 *mips_hi16_list; - -static bfd_reloc_status_type -mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data, asection *input_section, - bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED) -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi16 *n; - - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - - ret = bfd_reloc_ok; - - if (bfd_is_und_section (symbol->section) && output_bfd == NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let LO16 do the actual relocation. */ - n = bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_hi16_list; - mips_hi16_list = n; - - if (output_bfd != NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a R_MIPS_LO16 relocation. This is a straightforward 16 bit - inplace relocation; this function exists in order to do the - R_MIPS_HI16 relocation described above. */ - -static bfd_reloc_status_type -mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) -{ - if (mips_hi16_list != NULL) - { - struct mips_hi16 *l; - - l = mips_hi16_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi16 *next; - - /* Do the HI16 relocation. Note that we actually don't need - to know anything about the LO16 itself, except where to - find the low 16 bits of the addend needed by the LO16. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* The low order 16 bits are always treated as a signed - value. */ - vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000; - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* If PC-relative, we need to subtract out the address of the LO - half of the HI/LO. (The actual relocation is relative - to that instruction.) */ - if (reloc_entry->howto->pc_relative) - val -= reloc_entry->address; - - /* At this point, "val" has the value of the combined HI/LO - pair. If the low order 16 bits (which will be used for - the LO16 insn) are negative, then we will need an - adjustment for the high order 16 bits. */ - val += 0x8000; - val = (val >> 16) & 0xffff; - - insn &= ~ (bfd_vma) 0xffff; - insn |= val; - bfd_put_32 (abfd, insn, l->addr); - - next = l->next; - free (l); - l = next; - } - - mips_hi16_list = NULL; - } - - /* Now do the LO16 reloc in the usual way. */ - return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -static bfd_reloc_status_type -mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, - void *data, asection *input_section, bfd *output_bfd, - char **error_message) -{ - /* If we're relocating, and this is a local symbol, we can handle it - just like an R_MIPS_HI16. */ - if (output_bfd != NULL - && ((symbol->flags & BSF_SECTION_SYM) != 0 - || (symbol->flags & BSF_LOCAL) == 0)) - return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - /* Otherwise we try to handle it as R_MIPS_GOT_DISP. */ - return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a dangerous relocation. */ @@ -1542,8 +1319,6 @@ mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, bfd_reloc_status_type ret; bfd_vma gp; - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - if (output_bfd != NULL) relocatable = TRUE; else @@ -1573,8 +1348,6 @@ mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ if (output_bfd != NULL) relocatable = TRUE; @@ -1606,8 +1379,6 @@ mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 @@ -1684,36 +1455,33 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) +mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - if (reloc_entry->howto->partial_inplace) { reloc_entry->addend = ((reloc_entry->addend & 0x00007c0) | (reloc_entry->addend & 0x00000800) >> 9); } - SET_RELOC_ADDEND (reloc_entry) - - return bfd_reloc_continue; + return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, + error_message); } /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd ATTRIBUTE_UNUSED, char **error_message ATTRIBUTE_UNUSED) { static bfd_boolean warned = FALSE; - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - /* FIXME. */ if (! warned) (*_bfd_error_handler) @@ -1739,8 +1507,6 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_signed_vma val; bfd_vma relocation; - GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - if (output_bfd != NULL) relocatable = TRUE; else @@ -1804,9 +1570,6 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, return bfd_reloc_ok; } - -#undef GET_RELOC_ADDEND -#undef SET_RELOC_ADDEND /* A mapping from BFD reloc types to MIPS ELF reloc types. */ diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 1af0f98..7bcdb11 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1082,8 +1082,8 @@ _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, bfd_boolean relocatable, void *data, bfd_vma gp) { bfd_vma relocation; - unsigned long insn = 0; bfd_signed_vma val; + bfd_reloc_status_type status; if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -1099,13 +1099,7 @@ _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, /* Set val to the offset into the section or symbol. */ val = reloc_entry->addend; - if (reloc_entry->howto->partial_inplace) - { - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - val += insn & 0xffff; - } - - _bfd_mips_elf_sign_extend(val, 16); + _bfd_mips_elf_sign_extend (val, 16); /* Adjust val for the final section location and GP value. If we are producing relocatable output, we don't want to do this for @@ -1116,16 +1110,215 @@ _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, if (reloc_entry->howto->partial_inplace) { - insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + status = _bfd_relocate_contents (reloc_entry->howto, abfd, val, + (bfd_byte *) data + + reloc_entry->address); + if (status != bfd_reloc_ok) + return status; } else reloc_entry->addend = val; if (relocatable) reloc_entry->address += input_section->output_offset; - else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) - return bfd_reloc_overflow; + + return bfd_reloc_ok; +} + +/* Used to store a REL high-part relocation such as R_MIPS_HI16 or + R_MIPS_GOT16. REL is the relocation, INPUT_SECTION is the section + that contains the relocation field and DATA points to the start of + INPUT_SECTION. */ + +struct mips_hi16 +{ + struct mips_hi16 *next; + bfd_byte *data; + asection *input_section; + arelent rel; +}; + +/* FIXME: This should not be a static variable. */ + +static struct mips_hi16 *mips_hi16_list; + +/* A howto special_function for REL *HI16 relocations. We can only + calculate the correct value once we've seen the partnering + *LO16 relocation, so just save the information for later. + + The ABI requires that the *LO16 immediately follow the *HI16. + However, as a GNU extension, we permit an arbitrary number of + *HI16s to be associated with a single *LO16. This significantly + simplies the relocation handling in gcc. */ + +bfd_reloc_status_type +_bfd_mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, void *data, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + struct mips_hi16 *n; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + n = bfd_malloc (sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + + n->next = mips_hi16_list; + n->data = data; + n->input_section = input_section; + n->rel = *reloc_entry; + mips_hi16_list = n; + + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + + return bfd_reloc_ok; +} + +/* A howto special_function for REL R_MIPS_GOT16 relocations. This is just + like any other 16-bit relocation when applied to global symbols, but is + treated in the same as R_MIPS_HI16 when applied to local symbols. */ + +bfd_reloc_status_type +_bfd_mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) +{ + if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 + || bfd_is_und_section (bfd_get_section (symbol)) + || bfd_is_com_section (bfd_get_section (symbol))) + /* The relocation is against a global symbol. */ + return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, + error_message); + + return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + +/* A howto special_function for REL *LO16 relocations. The *LO16 itself + is a straightforward 16 bit inplace relocation, but we must deal with + any partnering high-part relocations as well. */ + +bfd_reloc_status_type +_bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) +{ + bfd_vma vallo; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + while (mips_hi16_list != NULL) + { + bfd_reloc_status_type ret; + struct mips_hi16 *hi; + + hi = mips_hi16_list; + + /* R_MIPS_GOT16 relocations are something of a special case. We + want to install the addend in the same way as for a R_MIPS_HI16 + relocation (with a rightshift of 16). However, since GOT16 + relocations can also be used with global symbols, their howto + has a rightshift of 0. */ + if (hi->rel.howto->type == R_MIPS_GOT16) + hi->rel.howto = MIPS_ELF_RTYPE_TO_HOWTO (abfd, R_MIPS_HI16, FALSE); + + /* VALLO is a signed 16-bit number. Bias it by 0x8000 so that any + carry or borrow will induce a change of +1 or -1 in the high part. */ + hi->rel.addend += (vallo + 0x8000) & 0xffff; + + /* R_MIPS_GNU_REL_HI16 relocations are relative to the address of the + lo16 relocation, not their own address. If we're calculating the + final value, and hence subtracting the "PC", subtract the offset + of the lo16 relocation from here. */ + if (output_bfd == NULL && hi->rel.howto->type == R_MIPS_GNU_REL_HI16) + hi->rel.addend -= reloc_entry->address - hi->rel.address; + + ret = _bfd_mips_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data, + hi->input_section, output_bfd, + error_message); + if (ret != bfd_reloc_ok) + return ret; + + mips_hi16_list = hi->next; + free (hi); + } + + return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, + error_message); +} + +/* A generic howto special_function. This calculates and installs the + relocation itself, thus avoiding the oft-discussed problems in + bfd_perform_relocation and bfd_install_relocation. */ + +bfd_reloc_status_type +_bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_signed_vma val; + bfd_reloc_status_type status; + bfd_boolean relocatable; + + relocatable = (output_bfd != NULL); + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Build up the field adjustment in VAL. */ + val = 0; + if (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) + { + /* Either we're calculating the final field value or we have a + relocation against a section symbol. Add in the section's + offset or address. */ + val += symbol->section->output_section->vma; + val += symbol->section->output_offset; + } + + if (!relocatable) + { + /* We're calculating the final field value. Add in the symbol's value + and, if pc-relative, subtract the address of the field itself. */ + val += symbol->value; + if (reloc_entry->howto->pc_relative) + { + val -= input_section->output_section->vma; + val -= input_section->output_offset; + val -= reloc_entry->address; + } + } + + /* VAL is now the final adjustment. If we're keeping this relocation + in the output file, and if the relocation uses a separate addend, + we just need to add VAL to that addend. Otherwise we need to add + VAL to the relocation field itself. */ + if (relocatable && !reloc_entry->howto->partial_inplace) + reloc_entry->addend += val; + else + { + /* Add in the separate addend, if any. */ + val += reloc_entry->addend; + + /* Add VAL to the relocation field. */ + status = _bfd_relocate_contents (reloc_entry->howto, abfd, val, + (bfd_byte *) data + + reloc_entry->address); + if (status != bfd_reloc_ok) + return status; + } + + if (relocatable) + reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; } @@ -3203,7 +3396,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, break; case R_MIPS_GNU_REL16_S2: - value = symbol + _bfd_mips_elf_sign_extend (addend << 2, 18) - p; + value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p; overflowed_p = mips_elf_overflow_p (value, 18); value = (value >> 2) & howto->dst_mask; break; @@ -3226,9 +3419,9 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, R_MIPS_26 case here. */ case R_MIPS_26: if (local_p) - value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2; + value = ((addend | ((p + 4) & 0xf0000000)) + symbol) >> 2; else - value = (_bfd_mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; + value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2; value &= howto->dst_mask; break; @@ -6067,7 +6260,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, addend = mips_elf_obtain_contents (howto, rel, input_bfd, contents); addend &= howto->src_mask; - addend <<= howto->rightshift; /* For some kinds of relocations, the ADDEND is a combination of the addend stored in two different @@ -6131,6 +6323,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ((addend & 0x7e00000) >> 16) | (addend & 0x1f)); } + else + addend <<= howto->rightshift; } else addend = rel->r_addend; @@ -6170,33 +6364,25 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* Adjust the addend appropriately. */ addend += local_sections[r_symndx]->output_offset; - if (howto->partial_inplace) + if (rela_relocation_p) + /* If this is a RELA relocation, just update the addend. */ + rel->r_addend = addend; + else { - /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, - then we only want to write out the high-order 16 bits. - The subsequent R_MIPS_LO16 will handle the low-order bits. - */ - if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 + if (r_type == R_MIPS_HI16 + || r_type == R_MIPS_GOT16 || r_type == R_MIPS_GNU_REL_HI16) addend = mips_elf_high (addend); else if (r_type == R_MIPS_HIGHER) addend = mips_elf_higher (addend); else if (r_type == R_MIPS_HIGHEST) addend = mips_elf_highest (addend); - } + else + addend >>= howto->rightshift; - if (rela_relocation_p) - /* If this is a RELA relocation, just update the addend. - We have to cast away constness for REL. */ - rel->r_addend = addend; - else - { - /* Otherwise, we have to write the value back out. Note - that we use the source mask, rather than the - destination mask because the place to which we are - writing will be source of the addend in the final - link. */ - addend >>= howto->rightshift; + /* We use the source mask, rather than the destination + mask because the place to which we are writing will be + source of the addend in the final link. */ addend &= howto->src_mask; if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)) @@ -6260,8 +6446,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else use_saved_addend_p = FALSE; - addend >>= howto->rightshift; - /* Figure out what value we are supposed to relocate. */ switch (mips_elf_calculate_relocation (output_bfd, input_bfd, input_section, info, rel, diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index aef4e7b..d3787e9 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -103,6 +103,14 @@ extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +extern bfd_reloc_status_type _bfd_mips_elf_generic_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); extern unsigned long _bfd_elf_mips_mach (flagword); extern bfd_boolean _bfd_mips_relax_section diff --git a/bfd/libbfd.h b/bfd/libbfd.h index b40a249..df4c0cf 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1168,6 +1168,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_M32R_HI16_SLO", "BFD_RELOC_M32R_LO16", "BFD_RELOC_M32R_SDA16", + "BFD_RELOC_M32R_GOT24", + "BFD_RELOC_M32R_26_PLTREL", + "BFD_RELOC_M32R_COPY", + "BFD_RELOC_M32R_GLOB_DAT", + "BFD_RELOC_M32R_JMP_SLOT", + "BFD_RELOC_M32R_RELATIVE", + "BFD_RELOC_M32R_GOTOFF", + "BFD_RELOC_M32R_GOTPC24", + "BFD_RELOC_M32R_GOT16_HI_ULO", + "BFD_RELOC_M32R_GOT16_HI_SLO", + "BFD_RELOC_M32R_GOT16_LO", + "BFD_RELOC_M32R_GOTPC_HI_ULO", + "BFD_RELOC_M32R_GOTPC_HI_SLO", + "BFD_RELOC_M32R_GOTPC_LO", "BFD_RELOC_V850_9_PCREL", "BFD_RELOC_V850_22_PCREL", "BFD_RELOC_V850_SDA_16_16_OFFSET", diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index df71a80..2fe294f 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -943,23 +943,59 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr); - /* Extra flags must be set when dealing with NT. All sections should also - have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the - .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data - sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set - (this is especially important when dealing with the .idata section since - the addresses for routines from .dlls must be overwritten). If .reloc - section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE - (0x02000000). Also, the resource data should also be read and - writable. */ - - /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */ - /* FIXME: even worse, I don't see how to get the original alignment field*/ - /* back... */ - { + /* Extra flags must be set when dealing with PE. All sections should also + have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the + .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data + sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set + (this is especially important when dealing with the .idata section since + the addresses for routines from .dlls must be overwritten). If .reloc + section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE + (0x02000000). Also, the resource data should also be read and + writable. */ + + /* FIXME: Alignment is also encoded in this field, at least on PPC and + ARM-WINCE. Although - how do we get the original alignment field + back ? */ + + typedef struct + { + const char * section_name; + unsigned long must_have; + } + pe_required_section_flags; + + pe_required_section_flags known_sections [] = + { + { ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES }, + { ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE }, + { ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE }, + { ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { NULL, 0} + }; + + pe_required_section_flags * p; int flags = scnhdr_int->s_flags; + for (p = known_sections; p->section_name; p++) + if (strcmp (scnhdr_int->s_name, p->section_name) == 0) + { + /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now + we know exactly what this specific section wants so we remove it + and then allow the must_have field to add it back in if necessary. */ + flags &= ~IMAGE_SCN_MEM_WRITE; + flags |= p->must_have; + break; + } + H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); } diff --git a/bfd/peicode.h b/bfd/peicode.h index 41fcbbc..41445e5 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -902,10 +902,40 @@ pe_ILF_build_a_bfd (bfd * abfd, symbol = symbol_name; if (import_name_type != IMPORT_NAME) - /* Skip any prefix in symbol_name. */ - while (*symbol == '@' || * symbol == '?' || * symbol == '_') - ++ symbol; - + { + bfd_boolean skipped_leading_underscore = FALSE; + bfd_boolean skipped_leading_at = FALSE; + bfd_boolean skipped_leading_question_mark = FALSE; + bfd_boolean check_again; + + /* Skip any prefix in symbol_name. */ + -- symbol; + do + { + check_again = FALSE; + ++ symbol; + + switch (*symbol) + { + case '@': + if (! skipped_leading_at) + check_again = skipped_leading_at = TRUE; + break; + case '?': + if (! skipped_leading_question_mark) + check_again = skipped_leading_question_mark = TRUE; + break; + case '_': + if (! skipped_leading_underscore) + check_again = skipped_leading_underscore = TRUE; + break; + default: + break; + } + } + while (check_again); + } + if (import_name_type == IMPORT_NAME_UNDECORATE) { /* Truncate at the first '@' */ diff --git a/bfd/reloc.c b/bfd/reloc.c index ad4963f..abbcfca 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2911,6 +2911,37 @@ ENUM ENUMDOC This is a 16-bit reloc containing the small data area offset for use in add3, load, and store instructions. +ENUM + BFD_RELOC_M32R_GOT24 +ENUMX + BFD_RELOC_M32R_26_PLTREL +ENUMX + BFD_RELOC_M32R_COPY +ENUMX + BFD_RELOC_M32R_GLOB_DAT +ENUMX + BFD_RELOC_M32R_JMP_SLOT +ENUMX + BFD_RELOC_M32R_RELATIVE +ENUMX + BFD_RELOC_M32R_GOTOFF +ENUMX + BFD_RELOC_M32R_GOTPC24 +ENUMX + BFD_RELOC_M32R_GOT16_HI_ULO +ENUMX + BFD_RELOC_M32R_GOT16_HI_SLO +ENUMX + BFD_RELOC_M32R_GOT16_LO +ENUMX + BFD_RELOC_M32R_GOTPC_HI_ULO +ENUMX + BFD_RELOC_M32R_GOTPC_HI_SLO +ENUMX + BFD_RELOC_M32R_GOTPC_LO +ENUMDOC + For PIC. + ENUM BFD_RELOC_V850_9_PCREL diff --git a/bfd/targets.c b/bfd/targets.c index 488e8e4..de4284e 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -542,6 +542,9 @@ extern const bfd_target bfd_elf32_littlearm_oabi_vec; extern const bfd_target bfd_elf32_littlearm_vec; extern const bfd_target bfd_elf32_littlemips_vec; extern const bfd_target bfd_elf32_m32r_vec; +extern const bfd_target bfd_elf32_m32rle_vec; +extern const bfd_target bfd_elf32_m32rlin_vec; +extern const bfd_target bfd_elf32_m32rlelin_vec; extern const bfd_target bfd_elf32_m68hc11_vec; extern const bfd_target bfd_elf32_m68hc12_vec; extern const bfd_target bfd_elf32_m68k_vec; @@ -831,6 +834,9 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_littlearm_vec, &bfd_elf32_littlemips_vec, &bfd_elf32_m32r_vec, + &bfd_elf32_m32rle_vec, + &bfd_elf32_m32rlin_vec, + &bfd_elf32_m32rlelin_vec, &bfd_elf32_m68hc11_vec, &bfd_elf32_m68hc12_vec, &bfd_elf32_m68k_vec, diff --git a/bfd/version.h b/bfd/version.h index d31fc6c..c5ccc1e 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20031214 +#define BFD_VERSION_DATE 20031220 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 179bffb..88be8e1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,84 @@ +2003-12-18 Michael Chastain <mec.gnu@mindspring.com> + + * hppa-tdep.c (hppa_gdbarch_init): Set long double floating + point type to floatformat_ia64_quad_big. + +2003-12-18 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (skip_prologue_using_sal): New function. Taken verbatim + from mips-tdep.c. + (frv_analyze_prologue): Rework to account for intermixed prologue / + body instructions. + +2003-12-18 Michael Chastain <mec.gnu@mindspring.com> + + * hppa-tdep.c (hppa_gdbarch_init): Set sizeof(long_double) to 128. + Document type sizes for hppa*-*-hpux* compilers available to me. + +2003-12-18 Michael Chastain <mec.gnu@mindspring.com> + + * hppam3-nat.c: Delete obsolete file. + * hppab-nat.c: Delete obsolete file. + * Makefile.in: Remove references. + +2003-12-17 Jeff Johnston <jjohnstn@redhat.com> + + * symtab.c (decode_line_spec): Change call to decode_line_1. + +2003-12-17 Jeff Johnston <jjohnstn@redhat.com> + + * linespec.h (decode_line_1): Add new not_found_ptr parameter. + * linespec.c (decode_line_1): Add new parameter. Pass on + new parameter to decode_variable and symtab_from_filename + functions. + (decode_variable): Add new not_found_ptr parameter. Throw exception + rather than failing if the not_found_ptr is non-null and the + function is not found. + (symtab_from_filename): Add new not_found_ptr parametr. Throw + exception rather than failing if the not_found_ptr is non-null and + the source file is not found. + * breakpoint.c: Change all callers of decode_line_1 to add default + extra parameter for decode_line_1 calls. + * tracepoint.c: Ditto. + * cli/cli-cmds.c: Ditto. + +2003-12-16 J. Brobecker <brobecker@gnat.com> + + * irix5-nat.c: Include mips-tdep.h. + +2003-12-16 Mark Kettenis <kettenis@gnu.org> + + * solib.h (SOLIB_CREATE_CATCH_LOAD_HOOK) + (SOLIB_CREATE_CATCH_UNLOAD_HOOK, SOLIB_LOADED_LIBRARY_PATHNAME) + (SOLIB_UNLOADED_LIBRARY_PATHNAME, SOLIB_HAVE_LOAD_EVENT) + (SOLIB_HAVE_UNLOAD_EVENT): Remove defines. + + * blockframe.c (inside_main_func): Don't treat a zero PC specially. + Needed to fix PR backtrace/1476. + +2003-12-16 David Carlton <carlton@kealia.com> + + * cp-support.c (class_name_from_physname): Add DMGL_PARAMS. + (method_name_from_physname): Ditto. + +2003-12-15 Mark Kettenis <kettenis@gnu.org> + + * i386-sol2-tdep.c (i386_sol2_gregset_reg_offset): New variable. + (i386_sol2_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs, TDEP->sizeof_gregset and + TDEP->sizeof_fpregset. + * config/i386/i386sol2.mh (XM_FILE): Set to xm-i386.h. + (XM_CLIBS): Remove. + (NATDEPFILES): Remove core-regset.o and corelow.o. + * config/i386/i386sol2.mt (TDEPFILES): Add corelow.o. + +2003-12-14 Mark Kettenis <kettenis@gnu.org> + + * proc-api.c (procfs_note): Add format string to fprintf call. + + * i386-tdep.c (i386_analyze_frame_setup): Add missing encodings + for `subl' and `xorl' instructions. + 2003-12-13 Jim Blandy <jimb@redhat.com> * dwarf2read.c (dwarf2_add_member_fn, read_structure_scope): diff --git a/gdb/Makefile.in b/gdb/Makefile.in index d18a9ef..b021243 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1277,7 +1277,7 @@ ALLDEPFILES = \ glibc-tdep.c \ go32-nat.c h8300-tdep.c \ hppa-tdep.c hppa-hpux-tdep.c \ - hppab-nat.c hppah-nat.c hpread.c \ + hppah-nat.c hpread.c \ i386-tdep.c i386b-nat.c i386v-nat.c i386-linux-nat.c \ i386v4-nat.c i386ly-tdep.c i386-cygwin-tdep.c \ i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c i386fbsd-tdep.c \ @@ -1848,13 +1848,10 @@ h8300-tdep.o: h8300-tdep.c $(defs_h) $(value_h) $(inferior_h) $(symfile_h) \ $(gdb_assert_h) $(dis_asm_h) hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \ $(gdbtypes_h) $(gdbcore_h) $(cp_abi_h) -hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(gdb_wait_h) $(regcache_h) $(gdb_string_h) hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \ $(osabi_h) $(gdb_string_h) $(frame_h) -hppam3-nat.o: hppam3-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ - $(regcache_h) hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \ $(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \ $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(infcall_h) $(dis_asm_h) \ diff --git a/gdb/blockframe.c b/gdb/blockframe.c index ac73ef2..cebc10a 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -73,18 +73,13 @@ deprecated_inside_entry_file (CORE_ADDR addr) } /* Test whether PC is in the range of addresses that corresponds to - the "main" function. - - A PC of zero is always considered to be the bottom of the stack. */ + the "main" function. */ int inside_main_func (CORE_ADDR pc) { struct minimal_symbol *msymbol; - if (pc == 0) - return 1; - if (symfile_objfile == 0) return 0; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ddf51b7..c535add 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4328,7 +4328,7 @@ solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname, int thread = -1; /* All threads. */ /* Set a breakpoint on the specified hook. */ - sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical); + sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical, NULL); addr_end = hookname; if (sals.nelts == 0) @@ -4845,9 +4845,9 @@ parse_breakpoint_sals (char **address, || ((strchr ("+-", (*address)[0]) != NULL) && ((*address)[1] != '[')))) *sals = decode_line_1 (address, 1, default_breakpoint_symtab, - default_breakpoint_line, addr_string); + default_breakpoint_line, addr_string, NULL); else - *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string); + *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string, NULL); } /* For any SAL that didn't have a canonical string, fill one in. */ if (sals->nelts > 0 && *addr_string == NULL) @@ -5293,7 +5293,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) beg_addr_string = addr_string; sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0, - (char ***) NULL); + (char ***) NULL, NULL); xfree (beg_addr_string); old_chain = make_cleanup (xfree, sals.sals); @@ -5810,10 +5810,10 @@ until_break_command (char *arg, int from_tty, int anywhere) if (default_breakpoint_valid) sals = decode_line_1 (&arg, 1, default_breakpoint_symtab, - default_breakpoint_line, (char ***) NULL); + default_breakpoint_line, (char ***) NULL, NULL); else sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, - 0, (char ***) NULL); + 0, (char ***) NULL, NULL); if (sals.nelts != 1) error ("Couldn't get information on specified line."); @@ -6273,7 +6273,7 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, trigger_func_name = xstrdup ("__cxa_throw"); nameptr = trigger_func_name; - sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL); + sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL, NULL); if (sals.nelts == 0) { xfree (trigger_func_name); @@ -6980,7 +6980,7 @@ breakpoint_re_set_one (void *bint) set_language (b->language); input_radix = b->input_radix; s = b->addr_string; - sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL); + sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL, NULL); for (i = 0; i < sals.nelts; i++) { resolve_sal_pc (&sals.sals[i]); @@ -7516,10 +7516,10 @@ decode_line_spec_1 (char *string, int funfirstline) sals = decode_line_1 (&string, funfirstline, default_breakpoint_symtab, default_breakpoint_line, - (char ***) NULL); + (char ***) NULL, NULL); else sals = decode_line_1 (&string, funfirstline, - (struct symtab *) NULL, 0, (char ***) NULL); + (struct symtab *) NULL, 0, (char ***) NULL, NULL); if (*string) error ("Junk at end of line specification: %s", string); return sals; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 6f9fe90..dcfd74f 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -557,7 +557,7 @@ edit_command (char *arg, int from_tty) /* Now should only be one argument -- decode it in SAL */ arg1 = arg; - sals = decode_line_1 (&arg1, 0, 0, 0, 0); + sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0); if (! sals.nelts) return; /* C++ */ if (sals.nelts > 1) { @@ -681,7 +681,7 @@ list_command (char *arg, int from_tty) dummy_beg = 1; else { - sals = decode_line_1 (&arg1, 0, 0, 0, 0); + sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0); if (!sals.nelts) return; /* C++ */ @@ -714,9 +714,9 @@ list_command (char *arg, int from_tty) else { if (dummy_beg) - sals_end = decode_line_1 (&arg1, 0, 0, 0, 0); + sals_end = decode_line_1 (&arg1, 0, 0, 0, 0, 0); else - sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0); + sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0, 0); if (sals_end.nelts == 0) return; if (sals_end.nelts > 1) diff --git a/gdb/config/i386/i386sol2.mh b/gdb/config/i386/i386sol2.mh index 931cc13..1245ca7 100644 --- a/gdb/config/i386/i386sol2.mh +++ b/gdb/config/i386/i386sol2.mh @@ -1,9 +1,8 @@ # Host: Intel 386 running Solaris 2 (SVR4) -XM_FILE= xm-i386v4.h -XM_CLIBS= -lsocket -lnsl +XM_FILE= xm-i386.h NAT_FILE= nm-i386sol2.h -NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o corelow.o \ +NATDEPFILES= fork-child.o i386v4-nat.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o \ solib.o solib-svr4.o solib-legacy.o diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt index 93c2d78..863f615 100644 --- a/gdb/config/i386/i386sol2.mt +++ b/gdb/config/i386/i386sol2.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running Solaris 2 (SVR4) -TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o +TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o corelow.o TM_FILE= tm-i386sol2.h diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 9b447fc..bd76fae 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -145,7 +145,7 @@ class_name_from_physname (const char *physname) char *ret = NULL; const char *end; int depth = 0; - char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + char *demangled_name = cplus_demangle (physname, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) return NULL; @@ -170,7 +170,7 @@ method_name_from_physname (const char *physname) char *ret = NULL; const char *end; int depth = 0; - char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + char *demangled_name = cplus_demangle (physname, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) return NULL; diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 4fc8740..28fbc35 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -417,6 +417,61 @@ is_argument_reg (int reg) return (8 <= reg && reg <= 13); } +/* Given PC at the function's start address, attempt to find the + prologue end using SAL information. Return zero if the skip fails. + + A non-optimized prologue traditionally has one SAL for the function + and a second for the function body. A single line function has + them both pointing at the same line. + + An optimized prologue is similar but the prologue may contain + instructions (SALs) from the instruction body. Need to skip those + while not getting into the function body. + + The functions end point and an increasing SAL line are used as + indicators of the prologue's endpoint. + + This code is based on the function refine_prologue_limit (versions + found in both ia64 and ppc). */ + +static CORE_ADDR +skip_prologue_using_sal (CORE_ADDR func_addr) +{ + struct symtab_and_line prologue_sal; + CORE_ADDR start_pc; + CORE_ADDR end_pc; + + /* Get an initial range for the function. */ + find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc); + start_pc += FUNCTION_START_OFFSET; + + prologue_sal = find_pc_line (start_pc, 0); + if (prologue_sal.line != 0) + { + while (prologue_sal.end < end_pc) + { + struct symtab_and_line sal; + + sal = find_pc_line (prologue_sal.end, 0); + if (sal.line == 0) + break; + /* Assume that a consecutive SAL for the same (or larger) + line mark the prologue -> body transition. */ + if (sal.line >= prologue_sal.line) + break; + /* The case in which compiler's optimizer/scheduler has + moved instructions into the prologue. We look ahead in + the function looking for address ranges whose + corresponding line number is less the first one that we + found for the function. This is more conservative then + refine_prologue_limit which scans a large number of SALs + looking for any in the prologue */ + prologue_sal = sal; + } + } + return prologue_sal.end; +} + /* Scan an FR-V prologue, starting at PC, until frame->PC. If FRAME is non-zero, fill in its saved_regs with appropriate addresses. @@ -474,26 +529,111 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, char gr_saved[64]; int gr_sp_offset[64]; + /* The address of the most recently scanned prologue instruction. */ + CORE_ADDR last_prologue_pc; + + /* The address of the next instruction. */ + CORE_ADDR next_pc; + + /* The upper bound to of the pc values to scan. */ + CORE_ADDR lim_pc; + memset (gr_saved, 0, sizeof (gr_saved)); - while (! next_frame || pc < frame_pc_unwind (next_frame)) + last_prologue_pc = pc; + + /* Try to compute an upper limit (on how far to scan) based on the + line number info. */ + lim_pc = skip_prologue_using_sal (pc); + /* If there's no line number info, lim_pc will be 0. In that case, + set the limit to be 100 instructions away from pc. Hopefully, this + will be far enough away to account for the entire prologue. Don't + worry about overshooting the end of the function. The scan loop + below contains some checks to avoid scanning unreasonably far. */ + if (lim_pc == 0) + lim_pc = pc + 400; + + /* If we have a frame, we don't want to scan past the frame's pc. This + will catch those cases where the pc is in the prologue. */ + if (next_frame) + { + CORE_ADDR frame_pc = frame_pc_unwind (next_frame); + if (frame_pc < lim_pc) + lim_pc = frame_pc; + } + + /* Scan the prologue. */ + while (pc < lim_pc) { LONGEST op = read_memory_integer (pc, 4); + next_pc = pc + 4; /* The tests in this chain of ifs should be in order of decreasing selectivity, so that more particular patterns get to fire before less particular patterns. */ + /* Some sort of control transfer instruction: stop scanning prologue. + Integer Conditional Branch: + X XXXX XX 0000110 XX XXXXXXXXXXXXXXXX + Floating-point / media Conditional Branch: + X XXXX XX 0000111 XX XXXXXXXXXXXXXXXX + LCR Conditional Branch to LR + X XXXX XX 0001110 XX XX 001 X XXXXXXXXXX + Integer conditional Branches to LR + X XXXX XX 0001110 XX XX 010 X XXXXXXXXXX + X XXXX XX 0001110 XX XX 011 X XXXXXXXXXX + Floating-point/Media Branches to LR + X XXXX XX 0001110 XX XX 110 X XXXXXXXXXX + X XXXX XX 0001110 XX XX 111 X XXXXXXXXXX + Jump and Link + X XXXXX X 0001100 XXXXXX XXXXXX XXXXXX + X XXXXX X 0001101 XXXXXX XXXXXX XXXXXX + Call + X XXXXXX 0001111 XXXXXXXXXXXXXXXXXX + Return from Trap + X XXXXX X 0000101 XXXXXX XXXXXX XXXXXX + Integer Conditional Trap + X XXXX XX 0000100 XXXXXX XXXX 00 XXXXXX + X XXXX XX 0011100 XXXXXX XXXXXXXXXXXX + Floating-point /media Conditional Trap + X XXXX XX 0000100 XXXXXX XXXX 01 XXXXXX + X XXXX XX 0011101 XXXXXX XXXXXXXXXXXX + Break + X XXXX XX 0000100 XXXXXX XXXX 11 XXXXXX + Media Trap + X XXXX XX 0000100 XXXXXX XXXX 10 XXXXXX */ + if ((op & 0x01d80000) == 0x00180000 /* Conditional branches and Call */ + || (op & 0x01f80000) == 0x00300000 /* Jump and Link */ + || (op & 0x01f80000) == 0x00100000 /* Return from Trap, Trap */ + || (op & 0x01f80000) == 0x00700000) /* Trap immediate */ + { + /* Stop scanning; not in prologue any longer. */ + break; + } + + /* Loading something from memory into fp probably means that + we're in the epilogue. Stop scanning the prologue. + ld @(GRi, GRk), fp + X 000010 0000010 XXXXXX 000100 XXXXXX + ldi @(GRi, d12), fp + X 000010 0110010 XXXXXX XXXXXXXXXXXX */ + else if ((op & 0x7ffc0fc0) == 0x04080100 + || (op & 0x7ffc0000) == 0x04c80000) + { + break; + } + /* Setting the FP from the SP: ori sp, 0, fp P 000010 0100010 000001 000000000000 = 0x04881000 0 111111 1111111 111111 111111111111 = 0x7fffffff . . . . . . . . We treat this as part of the prologue. */ - if ((op & 0x7fffffff) == 0x04881000) + else if ((op & 0x7fffffff) == 0x04881000) { fp_set = 1; fp_offset = 0; + last_prologue_pc = next_pc; } /* Move the link register to the scratch register grJ, before saving: @@ -508,11 +648,10 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, /* If we're moving it to a scratch register, that's fine. */ if (is_caller_saves_reg (gr_j)) - lr_save_reg = gr_j; - /* Otherwise it's not a prologue instruction that we - recognize. */ - else - break; + { + lr_save_reg = gr_j; + last_prologue_pc = next_pc; + } } /* To save multiple callee-saves registers on the stack, at @@ -550,10 +689,8 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, gr_saved[gr_k + i] = 1; gr_sp_offset[gr_k + i] = 4 * i; } + last_prologue_pc = next_pc; } - else - /* It's not a prologue instruction. */ - break; } /* Adjusting the stack pointer. (The stack pointer is GR1.) @@ -564,11 +701,22 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, We treat this as part of the prologue. */ else if ((op & 0x7ffff000) == 0x02401000) { - /* Sign-extend the twelve-bit field. - (Isn't there a better way to do this?) */ - int s = (((op & 0xfff) - 0x800) & 0xfff) - 0x800; + if (framesize == 0) + { + /* Sign-extend the twelve-bit field. + (Isn't there a better way to do this?) */ + int s = (((op & 0xfff) - 0x800) & 0xfff) - 0x800; - framesize -= s; + framesize -= s; + last_prologue_pc = pc; + } + else + { + /* If the prologue is being adjusted again, we've + likely gone too far; i.e. we're probably in the + epilogue. */ + break; + } } /* Setting the FP to a constant distance from the SP: @@ -584,6 +732,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, int s = (((op & 0xfff) - 0x800) & 0xfff) - 0x800; fp_set = 1; fp_offset = s; + last_prologue_pc = pc; } /* To spill an argument register to a scratch register: @@ -602,10 +751,10 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, { int gr_i = ((op >> 12) & 0x3f); - /* If the source isn't an arg register, then this isn't a - prologue instruction. */ - if (! is_argument_reg (gr_i)) - break; + /* Make sure that the source is an arg register; if it is, we'll + treat it as a prologue instruction. */ + if (is_argument_reg (gr_i)) + last_prologue_pc = next_pc; } /* To spill 16-bit values to the stack: @@ -625,8 +774,10 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, { int gr_k = ((op >> 25) & 0x3f); - if (! is_argument_reg (gr_k)) - break; /* Source isn't an arg register. */ + /* Make sure that GRk is really an argument register; treat + it as a prologue instruction if so. */ + if (is_argument_reg (gr_k)) + last_prologue_pc = next_pc; } /* To save multiple callee-saves register on the stack, at a @@ -667,10 +818,8 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, gr_saved[gr_k + i] = 1; gr_sp_offset[gr_k + i] = s + (4 * i); } + last_prologue_pc = next_pc; } - else - /* It's not a prologue instruction. */ - break; } /* Storing any kind of integer register at any constant offset @@ -704,13 +853,16 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, /* If the address isn't relative to the SP or FP, it's not a prologue instruction. */ if (gr_i != sp_regnum && gr_i != fp_regnum) - break; + { + /* Do nothing; not a prologue instruction. */ + } /* Saving the old FP in the new frame (relative to the SP). */ - if (gr_k == fp_regnum && gr_i == sp_regnum) + else if (gr_k == fp_regnum && gr_i == sp_regnum) { gr_saved[fp_regnum] = 1; gr_sp_offset[fp_regnum] = offset; + last_prologue_pc = next_pc; } /* Saving callee-saves register(s) on the stack, relative to @@ -723,6 +875,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, gr_sp_offset[gr_k] = offset; else gr_sp_offset[gr_k] = offset + fp_offset; + last_prologue_pc = next_pc; } /* Saving the scratch register holding the return address. */ @@ -734,24 +887,14 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, lr_sp_offset = offset; else lr_sp_offset = offset + fp_offset; + last_prologue_pc = next_pc; } /* Spilling int-sized arguments to the stack. */ else if (is_argument_reg (gr_k)) - ; - - /* It's not a store instruction we recognize, so this must - be the end of the prologue. */ - else - break; + last_prologue_pc = next_pc; } - - /* It's not any instruction we recognize, so this must be the end - of the prologue. */ - else - break; - - pc += 4; + pc = next_pc; } if (next_frame && info) @@ -790,7 +933,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, trad_frame_set_value (info->saved_regs, sp_regnum, info->prev_sp); } - return pc; + return last_prologue_pc; } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 5311316..1e51103 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -5064,6 +5064,41 @@ hppa_fetch_pointer_argument (struct frame_info *frame, int argi, return addr; } +/* Here is a table of C type sizes on hppa with various compiles + and options. I measured this on PA 9000/800 with HP-UX 11.11 + and these compilers: + + /usr/ccs/bin/cc HP92453-01 A.11.01.21 + /opt/ansic/bin/cc HP92453-01 B.11.11.28706.GP + /opt/aCC/bin/aCC B3910B A.03.45 + gcc gcc 3.3.2 native hppa2.0w-hp-hpux11.11 + + cc : 1 2 4 4 8 : 4 8 -- : 4 4 + ansic +DA1.1 : 1 2 4 4 8 : 4 8 16 : 4 4 + ansic +DA2.0 : 1 2 4 4 8 : 4 8 16 : 4 4 + ansic +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8 + acc +DA1.1 : 1 2 4 4 8 : 4 8 16 : 4 4 + acc +DA2.0 : 1 2 4 4 8 : 4 8 16 : 4 4 + acc +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8 + gcc : 1 2 4 4 8 : 4 8 16 : 4 4 + + Each line is: + + compiler and options + char, short, int, long, long long + float, double, long double + char *, void (*)() + + So all these compilers use either ILP32 or LP64 model. + TODO: gcc has more options so it needs more investigation. + + For floating point types, see: + + http://docs.hp.com/hpux/pdf/B3906-90006.pdf + HP-UX floating-point guide, hpux 11.00 + + -- chastain 2003-12-18 */ + static struct gdbarch * hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { @@ -5144,9 +5179,14 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_register_bytes (gdbarch, gdbarch_num_regs (gdbarch) * tdep->bytes_per_address); set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT); - set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT); + /* The following gdbarch vector elements are the same in both ILP32 + and LP64, but might show differences some day. */ + set_gdbarch_long_long_bit (gdbarch, 64); + set_gdbarch_long_double_bit (gdbarch, 128); + set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big); + /* The following gdbarch vector elements do not depend on the address size, or in any other gdbarch element previously set. */ set_gdbarch_function_start_offset (gdbarch, 0); diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c deleted file mode 100644 index 416db66..0000000 --- a/gdb/hppab-nat.c +++ /dev/null @@ -1,214 +0,0 @@ -/* Machine-dependent hooks for the unix child process stratum. This - code is for the HP PA-RISC cpu. - - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, - 1999, 2000, 2001 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "target.h" -#include "regcache.h" -#include <sys/ptrace.h> - -/* Use an extra level of indirection for ptrace calls. - This lets us breakpoint usefully on call_ptrace. It also - allows us to pass an extra argument to ptrace without - using an ANSI-C specific macro. */ - -#define ptrace call_ptrace - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, PIDGET (inferior_ptid), \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ - - KERNEL_U_ADDR -#endif - -/* Fetch one register. */ - -static void -fetch_register (int regno) -{ - unsigned int regaddr; - char buf[MAX_REGISTER_SIZE]; - int i; - - /* Offset of registers within the u area. */ - unsigned int offset; - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - if (errno != 0) - { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = safe_strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "reading register %s: %s", REGISTER_NAME (regno), err); - warning (msg); - goto error_exit; - } - } - supply_register (regno, buf); -error_exit:; -} - -/* Fetch all registers, or just one, from the child process. */ - -void -fetch_inferior_registers (int regno) -{ - if (regno == -1) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (int regno) -{ - unsigned int regaddr; - char buf[80]; - int i; - unsigned int offset = U_REGS_OFFSET; - int scratch; - - if (regno >= 0) - { - if (CANNOT_STORE_REGISTER (regno)) - return; - regaddr = register_addr (regno, offset); - errno = 0; - if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) - { - scratch = *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)] | 0x3; - ptrace (PT_WUREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, - scratch); - if (errno != 0) - { - /* Error, even if attached. Failing to write these two - registers is pretty serious. */ - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else - for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - ptrace (PT_WUREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, - *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = safe_strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "writing register %s: %s", - REGISTER_NAME (regno), err); - warning (msg); - return; - } - regaddr += sizeof (int); - } - } - else - for (regno = 0; regno < NUM_REGS; regno++) - store_inferior_registers (regno); -} - -/* PT_PROT is specific to the PA BSD kernel and isn't documented - anywhere (except here). - - PT_PROT allows one to enable/disable the data memory break bit - for pages of memory in an inferior process. This bit is used - to cause "Data memory break traps" to occur when the appropriate - page is written to. - - The arguments are as follows: - - PT_PROT -- The ptrace action to perform. - - INFERIOR_PID -- The pid of the process who's page table entries - will be modified. - - PT_ARGS -- The *address* of a 3 word block of memory which has - additional information: - - word 0 -- The start address to watch. This should be a page-aligned - address. - - word 1 -- The ending address to watch. Again, this should be a - page aligned address. - - word 2 -- Nonzero to enable the data memory break bit on the - given address range or zero to disable the data memory break - bit on the given address range. - - This call may fail if the given addresses are not valid in the inferior - process. This most often happens when restarting a program which - has watchpoints inserted on heap or stack memory. */ - -#define PT_PROT 21 - -int -hppa_set_watchpoint (int addr, int len, int flag) -{ - int pt_args[3]; - pt_args[0] = addr; - pt_args[1] = addr + len; - pt_args[2] = flag; - - /* Mask off the lower 12 bits since we want to work on a page basis. */ - pt_args[0] >>= 12; - pt_args[1] >>= 12; - - /* Rounding adjustments. */ - pt_args[1] -= pt_args[0]; - pt_args[1]++; - - /* Put the lower 12 bits back as zero. */ - pt_args[0] <<= 12; - pt_args[1] <<= 12; - - /* Do it. */ - return ptrace (PT_PROT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) pt_args, 0); -} diff --git a/gdb/hppam3-nat.c b/gdb/hppam3-nat.c deleted file mode 100644 index cbee288..0000000 --- a/gdb/hppam3-nat.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Low level interface to HP800 running mach 4.0 for GDB, the GNU - debugger. - - Copyright 1995, 2000, 2001, 2003 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "floatformat.h" -#include "regcache.h" - -#include <stdio.h> - -#include <mach.h> -#include <mach/message.h> -#include <mach/exception.h> -#include <mach_error.h> - -#include <target.h> - -/* - * Fetch inferiors registers for gdb. - * REGNO specifies which (as gdb views it) register, -1 for all. - */ - -void -fetch_inferior_registers (int regno) -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = TRACE_FLAVOR_SIZE; - int index; - - if (!MACH_PORT_VALID (current_thread)) - error ("fetch inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - ret = thread_get_state (current_thread, - TRACE_FLAVOR, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - warning ("fetch_inferior_registers: %s ", - mach_error_string (ret)); - else - { - for (index = 0; index < NUM_REGS; index++) - supply_register (index, (void *) &state[index]); - } - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} - -/* Store our register values back into the inferior. - * If REGNO is -1, do this for all registers. - * Otherwise, REGNO specifies which register - * - * On mach3 all registers are always saved in one call. - */ -void -store_inferior_registers (int regno) -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = TRACE_FLAVOR_SIZE; - int index; - - if (!MACH_PORT_VALID (current_thread)) - error ("store inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - /* Fetch the state of the current thread */ - ret = thread_get_state (current_thread, - TRACE_FLAVOR, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - { - warning ("store_inferior_registers (get): %s", - mach_error_string (ret)); - if (must_suspend_thread) - setup_thread (current_thread, 0); - return; - } - - - /* move gdb's registers to thread's state - - * Since we save all registers anyway, save the ones - * that gdb thinks are valid (e.g. ignore the regno - * parameter) - */ - if (regno > 0 && regno < NUM_REGS) - { - memcpy (&state[regno], &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - DEPRECATED_REGISTER_RAW_SIZE (regno)); - } - else - { - for (index = 0; index < NUM_REGS; index++) - memcpy (&state[index], &deprecated_registers[DEPRECATED_REGISTER_BYTE (index)], - DEPRECATED_REGISTER_RAW_SIZE (index)); -/* state[index] = deprecated_registers[DEPRECATED_REGISTER_BYTE (index)]; */ - - } - - /* Write gdb's current view of register to the thread - */ - ret = thread_set_state (current_thread, - TRACE_FLAVOR, - state, - TRACE_FLAVOR_SIZE); - - if (ret != KERN_SUCCESS) - warning ("store_inferior_registers (set): %s", - mach_error_string (ret)); - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c index 78487af..2aa964e 100644 --- a/gdb/i386-sol2-tdep.c +++ b/gdb/i386-sol2-tdep.c @@ -24,6 +24,27 @@ #include "i386-tdep.h" +/* From <ia32/sys/reg.h>. */ +static int i386_sol2_gregset_reg_offset[] = +{ + 11 * 4, /* %eax */ + 10 * 4, /* %ecx */ + 9 * 4, /* %edx */ + 8 * 4, /* %ebx */ + 17 * 4, /* %esp */ + 6 * 4, /* %ebp */ + 5 * 4, /* %esi */ + 4 * 4, /* %edi */ + 14 * 4, /* %eip */ + 16 * 4, /* %eflags */ + 15 * 4, /* %cs */ + 18 * 4, /* %ss */ + 3 * 4, /* %ds */ + 2 * 4, /* %es */ + 1 * 4, /* %fs */ + 0 * 4 /* %gs */ +}; + static int i386_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name) { @@ -42,6 +63,14 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Solaris is SVR4-based. */ i386_svr4_init_abi (info, gdbarch); + /* Solaris reserves space for its FPU emulator in `fpregset_t'. + There is also some space reserved for the registers of a Weitek + math coprocessor. */ + tdep->gregset_reg_offset = i386_sol2_gregset_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (i386_sol2_gregset_reg_offset); + tdep->sizeof_gregset = 19 * 4; + tdep->sizeof_fpregset = 380; + /* Signal trampolines are slightly different from SVR4. */ set_gdbarch_pc_in_sigtramp (gdbarch, i386_sol2_pc_in_sigtramp); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 973fa63..4ee9fa4 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -508,9 +508,13 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc, subl %edx, %edx subl %eax, %eax + Because of the symmetry, there are actually two ways to + encode these instructions; with opcode bytes 0x29 and 0x2b + for `subl' and opcode bytes 0x31 and 0x33 for `xorl'. + Make sure we only skip these instructions if we later see the `movl %esp, %ebp' that actually sets up the frame. */ - while (op == 0x29 || op == 0x31) + while (op == 0x29 || op == 0x2b || op == 0x31 || op == 0x33) { op = read_memory_unsigned_integer (pc + skip + 2, 1); switch (op) diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index a447389..93727a6 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -36,6 +36,7 @@ /* Prototypes for supply_gregset etc. */ #include "gregset.h" +#include "mips-tdep.h" static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR); diff --git a/gdb/linespec.c b/gdb/linespec.c index b3eb05f..741ac88 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -100,7 +100,8 @@ static struct symtabs_and_lines decode_line_2 (struct symbol *[], int, int, char ***); static struct symtab *symtab_from_filename (char **argptr, - char *p, int is_quote_enclosed); + char *p, int is_quote_enclosed, + int *not_found_ptr); static struct symtabs_and_lines decode_all_digits (char **argptr, @@ -119,7 +120,8 @@ static struct symtabs_and_lines decode_dollar (char *copy, static struct symtabs_and_lines decode_variable (char *copy, int funfirstline, char ***canonical, - struct symtab *file_symtab); + struct symtab *file_symtab, + int *not_found_ptr); static struct symtabs_and_lines symbol_found (int funfirstline, @@ -637,7 +639,12 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline, Note that it is possible to return zero for the symtab if no file is validly specified. Callers must check that. - Also, the line number returned may be invalid. */ + Also, the line number returned may be invalid. + + If NOT_FOUND_PTR is not null, store a boolean true/false value at the location, based + on whether or not failure occurs due to an unknown function or file. In the case + where failure does occur due to an unknown function or file, do not issue an error + message. */ /* We allow single quotes in various places. This is a hideous kludge, which exists because the completer can't yet deal with the @@ -646,7 +653,7 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline, struct symtabs_and_lines decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - int default_line, char ***canonical) + int default_line, char ***canonical, int *not_found_ptr) { char *p; char *q; @@ -665,6 +672,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, int is_objc_method = 0; char *saved_arg = *argptr; + if (not_found_ptr) + *not_found_ptr = 0; + /* Defaults have defaults. */ initialize_defaults (&default_symtab, &default_line); @@ -722,7 +732,8 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* No, the first part is a filename; set s to be that file's symtab. Also, move argptr past the filename. */ - file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed); + file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed, + not_found_ptr); } #if 0 /* No one really seems to know why this was added. It certainly @@ -827,7 +838,8 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* Look up that token as a variable. If file specified, use that file's per-file block to start with. */ - return decode_variable (copy, funfirstline, canonical, file_symtab); + return decode_variable (copy, funfirstline, canonical, + file_symtab, not_found_ptr); } @@ -1422,10 +1434,14 @@ collect_methods (char *copy, struct type *t, /* Return the symtab associated to the filename given by the substring - of *ARGPTR ending at P, and advance ARGPTR past that filename. */ + of *ARGPTR ending at P, and advance ARGPTR past that filename. If + NOT_FOUND_PTR is not null and the source file is not found, store + boolean true at the location pointed to and do not issue an + error message. */ static struct symtab * -symtab_from_filename (char **argptr, char *p, int is_quote_enclosed) +symtab_from_filename (char **argptr, char *p, int is_quote_enclosed, + int *not_found_ptr) { char *p1; char *copy; @@ -1450,6 +1466,11 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed) { if (!have_full_symbols () && !have_partial_symbols ()) error ("No symbol table is loaded. Use the \"file\" command."); + if (not_found_ptr) + { + *not_found_ptr = 1; + throw_exception (RETURN_ERROR); + } error ("No source file named %s.", copy); } @@ -1626,11 +1647,13 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab, /* Decode a linespec that's a variable. If FILE_SYMTAB is non-NULL, - look in that symtab's static variables first. */ + look in that symtab's static variables first. If NOT_FOUND_PTR is not NULL and + the function cannot be found, store boolean true in the location pointed to + and do not issue an error message. */ static struct symtabs_and_lines decode_variable (char *copy, int funfirstline, char ***canonical, - struct symtab *file_symtab) + struct symtab *file_symtab, int *not_found_ptr) { struct symbol *sym; /* The symtab that SYM was found in. */ @@ -1658,6 +1681,12 @@ decode_variable (char *copy, int funfirstline, char ***canonical, !have_partial_symbols () && !have_minimal_symbols ()) error ("No symbol table is loaded. Use the \"file\" command."); + if (not_found_ptr) + { + *not_found_ptr = 1; + throw_exception (RETURN_ERROR); + } + error ("Function \"%s\" not defined.", copy); } diff --git a/gdb/linespec.h b/gdb/linespec.h index 3ede4bd..38b0941 100644 --- a/gdb/linespec.h +++ b/gdb/linespec.h @@ -24,6 +24,6 @@ struct symtab; extern struct symtabs_and_lines decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, int default_line, - char ***canonical); + char ***canonical, int *not_found_ptr); #endif /* defined (LINESPEC_H) */ diff --git a/gdb/proc-api.c b/gdb/proc-api.c index 208b984..1e4a2dc 100644 --- a/gdb/proc-api.c +++ b/gdb/proc-api.c @@ -747,7 +747,7 @@ procfs_note (char *msg, char *file, int line) if (info_verbose) fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line); - fprintf (procfs_file ? procfs_file : stdout, msg); + fprintf (procfs_file ? procfs_file : stdout, "%s", msg); if (procfs_file) fflush (procfs_file); } diff --git a/gdb/solib.h b/gdb/solib.h index 01971f4..cb4ba2d 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -57,100 +57,6 @@ extern void solib_add (char *, int, struct target_ops *, int); extern void solib_create_inferior_hook (void); /* solib.c */ -/* This function is called by the "catch load" command. It allows - the debugger to be notified by the dynamic linker when a specified - library file (or any library file, if filename is NULL) is loaded. - - Presently, this functionality is not implemented. - */ -#define SOLIB_CREATE_CATCH_LOAD_HOOK(pid,tempflag,filename,cond_string) \ - error("catch of library loads/unloads not yet implemented on this platform") - -/* This function is called by the "catch unload" command. It allows - the debugger to be notified by the dynamic linker when a specified - library file (or any library file, if filename is NULL) is unloaded. - - Presently, this functionality is not implemented. - */ -#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid,tempflag,filename,cond_string) \ - error("catch of library loads/unloads not yet implemented on this platform") - -/* This function returns TRUE if the dynamic linker has just reported - a load of a library. - - This function must be used only when the inferior has stopped in - the dynamic linker hook, or undefined results are guaranteed. - - Presently, this functionality is not implemented. - */ - -/* - #define SOLIB_HAVE_LOAD_EVENT(pid) \ - error("catch of library loads/unloads not yet implemented on this platform") - */ - -#define SOLIB_HAVE_LOAD_EVENT(pid) \ -(0) - -/* This function returns a pointer to the string representation of the - pathname of the dynamically-linked library that has just been loaded. - - This function must be used only when SOLIB_HAVE_LOAD_EVENT is TRUE, - or undefined results are guaranteed. - - This string's contents are only valid immediately after the inferior - has stopped in the dynamic linker hook, and becomes invalid as soon - as the inferior is continued. Clients should make a copy of this - string if they wish to continue the inferior and then access the string. - - Presently, this functionality is not implemented. - */ - -/* - #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \ - error("catch of library loads/unloads not yet implemented on this platform") - */ - -#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \ -"" - -/* This function returns TRUE if the dynamic linker has just reported - an unload of a library. - - This function must be used only when the inferior has stopped in - the dynamic linker hook, or undefined results are guaranteed. - - Presently, this functionality is not implemented. - */ -/* - #define SOLIB_HAVE_UNLOAD_EVENT(pid) \ - error("catch of library loads/unloads not yet implemented on this platform") - */ - -#define SOLIB_HAVE_UNLOAD_EVENT(pid) \ -(0) - -/* This function returns a pointer to the string representation of the - pathname of the dynamically-linked library that has just been unloaded. - - This function must be used only when SOLIB_HAVE_UNLOAD_EVENT is TRUE, - or undefined results are guaranteed. - - This string's contents are only valid immediately after the inferior - has stopped in the dynamic linker hook, and becomes invalid as soon - as the inferior is continued. Clients should make a copy of this - string if they wish to continue the inferior and then access the string. - - Presently, this functionality is not implemented. - */ -/* - #define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \ - error("catch of library loads/unloads not yet implemented on this platform") - */ - -#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \ -"" - /* This function returns TRUE if pc is the address of an instruction that lies within the dynamic linker (such as the event hook, or the dld itself). diff --git a/gdb/symtab.c b/gdb/symtab.c index 6e35e84..1d7b396 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3868,7 +3868,7 @@ decode_line_spec (char *string, int funfirstline) sals = decode_line_1 (&string, funfirstline, cursal.symtab, cursal.line, - (char ***) NULL); + (char ***) NULL, NULL); if (*string) error ("Junk at end of line specification: %s", string); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3e7ccdb..aac4e5d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,27 @@ +2003-12-18 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/sect-cmd.exp: Handle compiling test case from multiple + source files. + +2003-12-16 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/environ.exp: Handle compiling test case from multiple + source files. + +2003-12-16 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/structs.exp: Call gdb_exit as well as gdb_start. + +2003-12-17 Jim Blandy <jimb@redhat.com> + + * gdb.base/freebpcmd.c: Add copyright notice. + + * gdb.base/freebpcmd.exp: Mark the interesting failure as known. + +2003-12-16 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/maint.exp: Add generic FAIL patterns to prevent timeouts. + 2003-12-13 Jim Blandy <jimb@redhat.com> * gdb.base/freebpcmd.exp, gdb.base/freebpcmd.c: New test. diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp index 55ff0a0..b00052b 100644 --- a/gdb/testsuite/gdb.base/environ.exp +++ b/gdb/testsuite/gdb.base/environ.exp @@ -1,5 +1,4 @@ -# Copyright 1997, 1998, 1999 Free Software Foundation, Inc. - +# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,11 +38,19 @@ if ![istarget "hppa*-*-hpux*"] then { set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit diff --git a/gdb/testsuite/gdb.base/freebpcmd.c b/gdb/testsuite/gdb.base/freebpcmd.c index 52d9f30..765e12d 100644 --- a/gdb/testsuite/gdb.base/freebpcmd.c +++ b/gdb/testsuite/gdb.base/freebpcmd.c @@ -1,3 +1,23 @@ +/* Test program for GDB crashes while doing bp commands that continue inferior. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of the gdb testsuite. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + int main (int argc, char **argv) { diff --git a/gdb/testsuite/gdb.base/freebpcmd.exp b/gdb/testsuite/gdb.base/freebpcmd.exp index f952139..fed067f 100644 --- a/gdb/testsuite/gdb.base/freebpcmd.exp +++ b/gdb/testsuite/gdb.base/freebpcmd.exp @@ -110,12 +110,12 @@ if {$i >= [llength $lines]} { gdb_run_cmd gdb_test_multiple "" "run program with breakpoint commands" { -re "warning: Invalid control type in command structure" { - fail "run program with breakpoint commands" + kfail "gdb/1489" "run program with breakpoint commands" } -re "$gdb_prompt $" { pass "run program with breakpoint commands" } eof { - fail "run program with breakpoint commands (GDB died)" + kfail "gdb/1489" "run program with breakpoint commands (GDB died)" } } diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 4864164..3e98c00 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -400,6 +400,7 @@ gdb_expect { -re ".*bss.*$gdb_prompt $" { fail "maint info sections .text" } -re ".*data.*$gdb_prompt $" { fail "maint info sections .text" } -re ".* .text .*$gdb_prompt $" { pass "maint info sections .text" } + -re ".*$gdb_prompt $" { fail "maint info sections .text" } timeout { fail "(timeout) maint info sections .text" } } @@ -409,6 +410,7 @@ send_gdb "maint info sections CODE\n" gdb_expect { -re ".* .data .*$gdb_prompt $" { fail "maint info sections CODE" } -re ".* .text .*$gdb_prompt $" { pass "maint info sections CODE" } + -re ".*$gdb_prompt $" { fail "maint info sections CODE" } timeout { fail "(timeout) maint info sections CODE" } } @@ -418,6 +420,7 @@ send_gdb "maint info sections DATA\n" gdb_expect { -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" } -re ".* .data .*$gdb_prompt $" { pass "maint info sections DATA" } + -re ".*$gdb_prompt $" { fail "maint info sections DATA" } timeout { fail "(timeout) maint info sections DATA" } } diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp index 10c0e74..0b86b79 100644 --- a/gdb/testsuite/gdb.base/sect-cmd.exp +++ b/gdb/testsuite/gdb.base/sect-cmd.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -40,9 +40,19 @@ if ![istarget "hppa*-*-hpux*"] then { set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index 7ff54c9..c0f596f 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -81,6 +81,7 @@ proc start_structs_test { types } { } # Start with a fresh gdb. + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 5c85db4..6e33841 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -392,7 +392,7 @@ trace_command (char *arg, int from_tty) printf_filtered ("TRACE %s\n", arg); addr_start = arg; - sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical); + sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical, NULL); addr_end = arg; if (!sals.nelts) return; /* ??? Presumably decode_line_1 has already warned? */ @@ -2341,7 +2341,7 @@ scope_info (char *args, int from_tty) if (args == 0 || *args == 0) error ("requires an argument (function, line or *addr) to define a scope"); - sals = decode_line_1 (&args, 1, NULL, 0, &canonical); + sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL); if (sals.nelts == 0) return; /* presumably decode_line_1 has already warned */ diff --git a/gdb/version.in b/gdb/version.in index 4f3d62b..aad1c36 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-12-13-cvs +2003-12-19-cvs diff --git a/include/ChangeLog b/include/ChangeLog index 4328b98..670fe38 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,13 @@ +2003-12-19 Andreas Tobler <a.tobler@schweiz.ch> + + * include/fibheap.h (fibnode): Use __extension__ for + bit-fields mark and degree if __GNUC__. + +2003-12-18 Kazu Hirata <kazu@cs.umass.edu> + + * include/fibheap.h (fibnode): Use unsigned long int for + bit-fields if __GNUC__ is defined. + 2003-12-04 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_link_info): Change relax_finalizing to diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 9fc3b58..713d80d 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,20 @@ +2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * elf/m32r.h : Added m32r-linux and PIC support. Add new ABI that + uses RELA. + (R_M32R_16_RELA, R_M32R_32_RELA, R_M32R_24_RELA, + R_M32R_10_PCREL_RELA, R_M32R_18_PCREL_RELA, + R_M32R_26_PCREL_RELA, R_M32R_HI16_ULO_RELA, + R_M32R_HI16_SLO_RELA, R_M32R_LO16_RELA, + R_M32R_SDA16_RELA, R_M32R_RELA_GNU_VTINHERIT, + R_M32R_RELA_GNU_VTENTRY, R_M32R_GOT24, + R_M32R_26_PLTREL, R_M32R_COPY, R_M32R_GLOB_DAT, + R_M32R_JMP_SLOT, R_M32R_RELATIVE, R_M32R_GOTOFF, + R_M32R_GOTPC24, R_M32R_GOT16_HI_ULO, + R_M32R_GOT16_HI_SLO, R_M32R_GOT16_LO, + R_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_SLO, + R_M32R_GOTPC_LO): New relocs. + 2003-12-06 Alan Modra <amodra@bigpond.net.au> From Jan Beulich <JBeulich@novell.com> diff --git a/include/elf/m32r.h b/include/elf/m32r.h index 2663f3a..709d792 100644 --- a/include/elf/m32r.h +++ b/include/elf/m32r.h @@ -25,18 +25,48 @@ /* Relocations. */ START_RELOC_NUMBERS (elf_m32r_reloc_type) RELOC_NUMBER (R_M32R_NONE, 0) - RELOC_NUMBER (R_M32R_16, 1) - RELOC_NUMBER (R_M32R_32, 2) - RELOC_NUMBER (R_M32R_24, 3) - RELOC_NUMBER (R_M32R_10_PCREL, 4) - RELOC_NUMBER (R_M32R_18_PCREL, 5) - RELOC_NUMBER (R_M32R_26_PCREL, 6) - RELOC_NUMBER (R_M32R_HI16_ULO, 7) - RELOC_NUMBER (R_M32R_HI16_SLO, 8) - RELOC_NUMBER (R_M32R_LO16, 9) - RELOC_NUMBER (R_M32R_SDA16, 10) - RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11) - RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) + /* REL relocations */ + RELOC_NUMBER (R_M32R_16, 1) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_32, 2) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_24, 3) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_10_PCREL, 4) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_18_PCREL, 5) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_26_PCREL, 6) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_HI16_ULO, 7) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_HI16_SLO, 8) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_LO16, 9) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_SDA16, 10) /* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11)/* For backwards compatibility. */ + RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) /* For backwards compatibility. */ + + /* RELA relocations */ + RELOC_NUMBER (R_M32R_16_RELA, 33) + RELOC_NUMBER (R_M32R_32_RELA, 34) + RELOC_NUMBER (R_M32R_24_RELA, 35) + RELOC_NUMBER (R_M32R_10_PCREL_RELA, 36) + RELOC_NUMBER (R_M32R_18_PCREL_RELA, 37) + RELOC_NUMBER (R_M32R_26_PCREL_RELA, 38) + RELOC_NUMBER (R_M32R_HI16_ULO_RELA, 39) + RELOC_NUMBER (R_M32R_HI16_SLO_RELA, 40) + RELOC_NUMBER (R_M32R_LO16_RELA, 41) + RELOC_NUMBER (R_M32R_SDA16_RELA, 42) + RELOC_NUMBER (R_M32R_RELA_GNU_VTINHERIT, 43) + RELOC_NUMBER (R_M32R_RELA_GNU_VTENTRY, 44) + + RELOC_NUMBER (R_M32R_GOT24, 48) + RELOC_NUMBER (R_M32R_26_PLTREL, 49) + RELOC_NUMBER (R_M32R_COPY, 50) + RELOC_NUMBER (R_M32R_GLOB_DAT, 51) + RELOC_NUMBER (R_M32R_JMP_SLOT, 52) + RELOC_NUMBER (R_M32R_RELATIVE, 53) + RELOC_NUMBER (R_M32R_GOTOFF, 54) + RELOC_NUMBER (R_M32R_GOTPC24, 55) + RELOC_NUMBER (R_M32R_GOT16_HI_ULO, 56) + RELOC_NUMBER (R_M32R_GOT16_HI_SLO, 57) + RELOC_NUMBER (R_M32R_GOT16_LO, 58) + RELOC_NUMBER (R_M32R_GOTPC_HI_ULO, 59) + RELOC_NUMBER (R_M32R_GOTPC_HI_SLO, 60) + RELOC_NUMBER (R_M32R_GOTPC_LO, 61) END_RELOC_NUMBERS (R_M32R_max) /* Processor specific section indices. These sections do not actually diff --git a/include/fibheap.h b/include/fibheap.h index fc37f9e..4eebaf1 100644 --- a/include/fibheap.h +++ b/include/fibheap.h @@ -59,8 +59,13 @@ typedef struct fibnode struct fibnode *right; fibheapkey_t key; void *data; +#ifdef __GNUC__ + __extension__ unsigned long int degree : 31; + __extension__ unsigned long int mark : 1; +#else unsigned int degree : 31; unsigned int mark : 1; +#endif } *fibnode_t; extern fibheap_t fibheap_new PARAMS ((void)); diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 42994f4..695c450 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,56 @@ +2003-12-19 Ian Lance Taylor <ian@wasabisystems.com> + + Fix for PR c++/13447: + * cp-demangle.c (enum d_comp_type): Add D_COMP_LOCAL_NAME. + (d_dump, d_make_comp): Handle D_COMP_LOCAL_NAME. + (is_ctor_dtor_or_conversion): Handle D_COMP_LOCAL_NAME like + D_COMP_QUAL_NAME. + (is_ctor_or_dtor): Likewise. + (d_local_name): Use D_COMP_LOCAL_NAME rather than + D_COMP_QUAL_NAME. + (d_print_comp) [D_COMP_LOCAL_NAME]: New. + (d_prinT_comp) [D_COMP_TYPED_NAME]: If the left tree is + D_COMP_LOCAL_NAME, pull any qualifiers off its right subtree. + (d_print_mod_list): Handle D_COMP_LOCAL_NAME. + * testsuite/demangle-expected: Add two test cases. + + * cp-demangle.c (d_print_function_type): Clear the global modifier + list when printing the modifiers, not just when printing the + function parameters. + * testsuite/demangle-expected: Add two test cases. + +2003-12-15 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_print_function_type): Print the function + parameters with no modifiers. + * testsuite/demangle-expected: Add test case. + + * cp-demangle.c (d_demangle): If DMGL_PARAMS is not set, don't + expect that we've read the entire string. + (is_ctor_or_dtor): Don't expect that we've read the entire + string--reverse patch of 2003-11-29. + +2003-12-15 Brendan Kehoe <brendan@zen.org> + + * libiberty/Makefile.in (floatformat.o): Add dependency on + config.h to accompany change of 2003-12-03. + +2003-12-15 Ian Lance Taylor <ian@wasabisystems.com> + + Fix handling of constructor/destructor of standard substitution: + * cp-demangle.c (struct d_standard_sub_info): Define. + (d_substitution): Add prefix argument. Change all callers. + Rework handling of standard substitutions to print full name when + qualifying a constructor/destructor, or when DMGL_VERBOSE is set. + * testsuite/demangle-expected: Add test case. + + Fix handling of negative literal constants: + * cp-demangle.c (enum d_comp_type): Add D_COMP_LITERAL_NEG. + (d_dump, d_make_comp): Handle D_COMP_LITERAL_NEG. + (d_expr_primary): Use D_COMP_LITERAL_NEG for a negative number. + (d_print_comp): Handle D_COMP_LITERAL_NEG. + * testsuite/demangle-expected: Add test case. + 2003-12-04 Ian Lance Taylor <ian@wasabisystems.com> * cp-demangle.c (IS_UPPER, IS_LOWER): Define. @@ -123,10 +176,6 @@ * cp-demangle.c: Complete rewrite. -2003-11-20 Ian Lance Taylor <ian@wasabisystems.com> - - * cp-demangle.c: Complete rewrite. - 2003-11-19 Mark Mitchell <mark@codesourcery.com> * cp-demangle.c (demangle_type): Correct thinko in substitution @@ -148,19 +197,19 @@ * testsuite/Makefile.in (test-demangle): Depend upon libiberty.a. -2003-11-18 Ian Lance Taylor <ian@wasabisystems.com> - - * testsuite/test-demangle.c (main): Don't pass DMGL_VERBOSE to - cplus_demangle. - - * testsuite/Makefile.in (test-demangle): Depend upon libiberty.a. - 2003-10-31 Andreas Jaeger <aj@suse.de> * floatformat.c (floatformat_always_valid): Add unused attribute. 2003-10-30 Josef Zlomek <zlomekj@suse.cz> + Jan Hubicka <jh@suse.cz> + * vasprintf.c (int_vasprintf): Pass va_list by value. + Use va_copy for copying va_list. + (vasprintf): Pass va_list by value. + +2003-10-30 Josef Zlomek <zlomekj@suse.cz> + * hashtab.c (htab_find_slot_with_hash): Decrease n_deleted instead of increasing n_elements when inserting to deleted slot. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 5d2dc3c..5fff39b 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -437,7 +437,8 @@ dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \ $(INCDIR)/libiberty.h -floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h +floatformat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h \ + $(INCDIR)/libiberty.h fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h getcwd.o: config.h getopt.o: config.h $(INCDIR)/getopt.h diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index a5835df..27e09df 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -141,6 +141,23 @@ struct d_builtin_type_info enum d_builtin_type_print print; }; +/* Information we keep for the standard substitutions. */ + +struct d_standard_sub_info +{ + /* The code for this substitution. */ + char code; + /* The simple string it expands to. */ + const char *simple_expansion; + /* The results of a full, verbose, expansion. This is used when + qualifying a constructor/destructor, or when in verbose mode. */ + const char *full_expansion; + /* What to set the last_name field of d_info to; NULL if we should + not set it. This is only relevant when qualifying a + constructor/destructor. */ + const char *set_last_name; +}; + /* Component types found in mangled names. */ enum d_comp_type @@ -149,6 +166,8 @@ enum d_comp_type D_COMP_NAME, /* A qualified name. */ D_COMP_QUAL_NAME, + /* A local name. */ + D_COMP_LOCAL_NAME, /* A typed name. */ D_COMP_TYPED_NAME, /* A template. */ @@ -239,7 +258,9 @@ enum d_comp_type D_COMP_TRINARY_ARG1, D_COMP_TRINARY_ARG2, /* A literal. */ - D_COMP_LITERAL + D_COMP_LITERAL, + /* A negative literal. */ + D_COMP_LITERAL_NEG }; /* A component of the mangled name. */ @@ -489,7 +510,7 @@ static struct d_comp *d_expr_primary PARAMS ((struct d_info *)); static struct d_comp *d_local_name PARAMS ((struct d_info *)); static int d_discriminator PARAMS ((struct d_info *)); static int d_add_substitution PARAMS ((struct d_info *, struct d_comp *)); -static struct d_comp *d_substitution PARAMS ((struct d_info *)); +static struct d_comp *d_substitution PARAMS ((struct d_info *, int)); static void d_print_resize PARAMS ((struct d_print_info *, size_t)); static void d_print_append_char PARAMS ((struct d_print_info *, int)); static void d_print_append_buffer PARAMS ((struct d_print_info *, const char *, @@ -566,6 +587,9 @@ d_dump (dc, indent) case D_COMP_QUAL_NAME: printf ("qualified name\n"); break; + case D_COMP_LOCAL_NAME: + printf ("local name\n"); + break; case D_COMP_TYPED_NAME: printf ("typed name\n"); break; @@ -683,6 +707,9 @@ d_dump (dc, indent) case D_COMP_LITERAL: printf ("literal\n"); break; + case D_COMP_LITERAL_NEG: + printf ("negative literal\n"); + break; } d_dump (d_left (dc), indent + 2); @@ -726,6 +753,7 @@ d_make_comp (di, type, left, right) { /* These types require two parameters. */ case D_COMP_QUAL_NAME: + case D_COMP_LOCAL_NAME: case D_COMP_TYPED_NAME: case D_COMP_TEMPLATE: case D_COMP_VENDOR_TYPE_QUAL: @@ -737,6 +765,7 @@ d_make_comp (di, type, left, right) case D_COMP_TRINARY_ARG1: case D_COMP_TRINARY_ARG2: case D_COMP_LITERAL: + case D_COMP_LITERAL_NEG: if (left == NULL || right == NULL) return NULL; break; @@ -1002,6 +1031,7 @@ is_ctor_dtor_or_conversion (dc) default: return 0; case D_COMP_QUAL_NAME: + case D_COMP_LOCAL_NAME: return is_ctor_dtor_or_conversion (d_right (dc)); case D_COMP_CTOR: case D_COMP_DTOR: @@ -1087,7 +1117,7 @@ d_name (di) if (d_peek_next_char (di) != 't') { - dc = d_substitution (di); + dc = d_substitution (di, 0); subst = 1; } else @@ -1202,7 +1232,7 @@ d_prefix (di) || peek == 'D') dc = d_unqualified_name (di); else if (peek == 'S') - dc = d_substitution (di); + dc = d_substitution (di, 1); else if (peek == 'I') { if (ret == NULL) @@ -1776,7 +1806,7 @@ d_type (di) || peek_next == '_' || IS_UPPER (peek_next)) { - ret = d_substitution (di); + ret = d_substitution (di, 0); /* The substituted name may have been a template name and may be followed by tepmlate args. */ if (d_peek_char (di) == 'I') @@ -2254,6 +2284,7 @@ d_expr_primary (di) else { struct d_comp *type; + enum d_comp_type t; const char *s; type = d_type (di); @@ -2269,11 +2300,16 @@ d_expr_primary (di) constant in any readable form anyhow. We don't attempt to handle these cases. */ + t = D_COMP_LITERAL; + if (d_peek_char (di) == 'n') + { + t = D_COMP_LITERAL_NEG; + d_advance (di, 1); + } s = d_str (di); while (d_peek_char (di) != 'E') d_advance (di, 1); - ret = d_make_comp (di, D_COMP_LITERAL, type, - d_make_name (di, s, d_str (di) - s)); + ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s)); } if (d_next_char (di) != 'E') return NULL; @@ -2303,7 +2339,7 @@ d_local_name (di) d_advance (di, 1); if (! d_discriminator (di)) return NULL; - return d_make_comp (di, D_COMP_QUAL_NAME, function, + return d_make_comp (di, D_COMP_LOCAL_NAME, function, d_make_name (di, "string literal", sizeof "string literal" - 1)); } @@ -2314,7 +2350,7 @@ d_local_name (di) name = d_name (di); if (! d_discriminator (di)) return NULL; - return d_make_comp (di, D_COMP_QUAL_NAME, function, name); + return d_make_comp (di, D_COMP_LOCAL_NAME, function, name); } } @@ -2363,11 +2399,39 @@ d_add_substitution (di, dc) ::= Si ::= So ::= Sd + + If PREFIX is non-zero, then this type is being used as a prefix in + a qualified name. In this case, for the standard substitutions, we + need to check whether we are being used as a prefix for a + constructor or destructor, and return a full template name. + Otherwise we will get something like std::iostream::~iostream() + which does not correspond particularly well to any function which + actually appears in the source. */ +static const struct d_standard_sub_info standard_subs[] = +{ + { 't', "std", "std", NULL }, + { 'a', "std::allocator", "std::allocator", "allocator" }, + { 'b', "std::basic_string", "std::basic_string", "basic_string" }, + { 's', "std::string", + "std::basic_string<char, std::char_traits<char>, std::allocator<char> >", + "basic_string" }, + { 'i', "std::istream", + "std::basic_istream<char, std::char_traits<char> >", + "basic_istream" }, + { 'o', "std::ostream", + "std::basic_ostream<char, std::char_traits<char> >", + "basic_ostream" }, + { 'd', "std::iostream", + "std::basic_iostream<char, std::char_traits<char> >", + "basic_iostream" } +}; + static struct d_comp * -d_substitution (di) +d_substitution (di, prefix) struct d_info *di; + int prefix; { char c; @@ -2404,31 +2468,36 @@ d_substitution (di) } else { - switch (c) + int verbose; + const struct d_standard_sub_info *p; + const struct d_standard_sub_info *pend; + + verbose = (di->options & DMGL_VERBOSE) != 0; + if (! verbose && prefix) { - case 't': - return d_make_sub (di, "std"); - case 'a': - di->last_name = d_make_sub (di, "allocator"); - return d_make_sub (di, "std::allocator"); - case 'b': - di->last_name = d_make_sub (di, "basic_string"); - return d_make_sub (di, "std::basic_string"); - case 's': - di->last_name = d_make_sub (di, "string"); - return d_make_sub (di, "std::string"); - case 'i': - di->last_name = d_make_sub (di, "istream"); - return d_make_sub (di, "std::istream"); - case 'o': - di->last_name = d_make_sub (di, "ostream"); - return d_make_sub (di, "std::ostream"); - case 'd': - di->last_name = d_make_sub (di, "iostream"); - return d_make_sub (di, "std::iostream"); - default: - return NULL; + char peek; + + peek = d_peek_char (di); + if (peek == 'C' || peek == 'D') + verbose = 1; + } + + pend = (&standard_subs[0] + + sizeof standard_subs / sizeof standard_subs[0]); + for (p = &standard_subs[0]; p < pend; ++p) + { + if (c == p->code) + { + if (p->set_last_name != NULL) + di->last_name = d_make_sub (di, p->set_last_name); + if (verbose) + return d_make_sub (di, p->full_expansion); + else + return d_make_sub (di, p->simple_expansion); + } } + + return NULL; } } @@ -2579,6 +2648,7 @@ d_print_comp (dpi, dc) return; case D_COMP_QUAL_NAME: + case D_COMP_LOCAL_NAME: d_print_comp (dpi, d_left (dc)); d_append_string (dpi, (dpi->options & DMGL_JAVA) == 0 ? "::" : "."); d_print_comp (dpi, d_right (dc)); @@ -2630,6 +2700,38 @@ d_print_comp (dpi, dc) dpt.template = typed_name; } + /* If typed_name is a D_COMP_LOCAL_NAME, then there may be + CV-qualifiers on its right argument which really apply + here; this happens when parsing a class which is local to a + function. */ + if (typed_name->type == D_COMP_LOCAL_NAME) + { + struct d_comp *local_name; + + local_name = d_right (typed_name); + while (local_name->type == D_COMP_RESTRICT_THIS + || local_name->type == D_COMP_VOLATILE_THIS + || local_name->type == D_COMP_CONST_THIS) + { + if (i >= sizeof adpm / sizeof adpm[0]) + { + d_print_error (dpi); + return; + } + + adpm[i] = adpm[i - 1]; + adpm[i].next = &adpm[i - 1]; + dpi->modifiers = &adpm[i]; + + adpm[i - 1].mod = local_name; + adpm[i - 1].printed = 0; + adpm[i - 1].templates = dpi->templates; + ++i; + + local_name = d_left (local_name); + } + } + d_print_comp (dpi, d_right (dc)); if (typed_name->type == D_COMP_TEMPLATE) @@ -3031,6 +3133,7 @@ d_print_comp (dpi, dc) return; case D_COMP_LITERAL: + case D_COMP_LITERAL_NEG: /* For some builtin types, produce simpler output. */ if (d_left (dc)->type == D_COMP_BUILTIN_TYPE) { @@ -3039,6 +3142,8 @@ d_print_comp (dpi, dc) case D_PRINT_INT: if (d_right (dc)->type == D_COMP_NAME) { + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); d_print_comp (dpi, d_right (dc)); return; } @@ -3047,6 +3152,8 @@ d_print_comp (dpi, dc) case D_PRINT_LONG: if (d_right (dc)->type == D_COMP_NAME) { + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); d_print_comp (dpi, d_right (dc)); d_append_char (dpi, 'l'); return; @@ -3055,7 +3162,8 @@ d_print_comp (dpi, dc) case D_PRINT_BOOL: if (d_right (dc)->type == D_COMP_NAME - && d_right (dc)->u.s_name.len == 1) + && d_right (dc)->u.s_name.len == 1 + && dc->type == D_COMP_LITERAL) { switch (d_right (dc)->u.s_name.s[0]) { @@ -3079,6 +3187,8 @@ d_print_comp (dpi, dc) d_append_char (dpi, '('); d_print_comp (dpi, d_left (dc)); d_append_char (dpi, ')'); + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); d_print_comp (dpi, d_right (dc)); return; @@ -3190,6 +3300,34 @@ d_print_mod_list (dpi, mods, suffix) dpi->templates = hold_dpt; return; } + else if (mods->mod->type == D_COMP_LOCAL_NAME) + { + struct d_print_mod *hold_modifiers; + struct d_comp *dc; + + /* When this is on the modifier stack, we have pulled any + qualifiers off the right argument already. Otherwise, we + print it as usual, but don't let the left argument see any + modifiers. */ + + hold_modifiers = dpi->modifiers; + dpi->modifiers = NULL; + d_print_comp (dpi, d_left (mods->mod)); + dpi->modifiers = hold_modifiers; + + d_append_string (dpi, (dpi->options & DMGL_JAVA) == 0 ? "::" : "."); + + dc = d_right (mods->mod); + while (dc->type == D_COMP_RESTRICT_THIS + || dc->type == D_COMP_VOLATILE_THIS + || dc->type == D_COMP_CONST_THIS) + dc = d_left (dc); + + d_print_comp (dpi, dc); + + dpi->templates = hold_dpt; + return; + } d_print_mod (dpi, mods->mod); @@ -3265,6 +3403,7 @@ d_print_function_type (dpi, dc, mods) int need_paren; int saw_mod; struct d_print_mod *p; + struct d_print_mod *hold_modifiers; need_paren = 0; saw_mod = 0; @@ -3318,6 +3457,9 @@ d_print_function_type (dpi, dc, mods) d_append_char (dpi, '('); } + hold_modifiers = dpi->modifiers; + dpi->modifiers = NULL; + d_print_mod_list (dpi, mods, 0); if (need_paren) @@ -3331,6 +3473,8 @@ d_print_function_type (dpi, dc, mods) d_append_char (dpi, ')'); d_print_mod_list (dpi, mods, 1); + + dpi->modifiers = hold_modifiers; } /* Print an array type, except for the element type. */ @@ -3552,9 +3696,11 @@ d_demangle (mangled, options, palc) else dc = d_type (&di); - /* If we didn't consume the entire mangled string, then we didn't - successfully demangle it. */ - if (d_peek_char (&di) != '\0') + /* If DMGL_PARAMS is set, then if we didn't consume the entire + mangled string, then we didn't successfully demangle it. If + DMGL_PARAMS is not set, we didn't look at the trailing + parameters. */ + if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0') dc = NULL; #ifdef CP_DEMANGLE_DEBUG @@ -3759,37 +3905,38 @@ is_ctor_or_dtor (mangled, ctor_kind, dtor_kind) dc = d_mangled_name (&di, 1); + /* Note that because we did not pass DMGL_PARAMS, we don't expect to + demangle the entire string. */ + ret = 0; - if (d_peek_char (&di) == '\0') + while (dc != NULL) { - while (dc != NULL) + switch (dc->type) { - switch (dc->type) - { - default: - dc = NULL; - break; - case D_COMP_TYPED_NAME: - case D_COMP_TEMPLATE: - case D_COMP_RESTRICT_THIS: - case D_COMP_VOLATILE_THIS: - case D_COMP_CONST_THIS: - dc = d_left (dc); - break; - case D_COMP_QUAL_NAME: - dc = d_right (dc); - break; - case D_COMP_CTOR: - *ctor_kind = dc->u.s_ctor.kind; - ret = 1; - dc = NULL; - break; - case D_COMP_DTOR: - *dtor_kind = dc->u.s_dtor.kind; - ret = 1; - dc = NULL; - break; - } + default: + dc = NULL; + break; + case D_COMP_TYPED_NAME: + case D_COMP_TEMPLATE: + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + dc = d_left (dc); + break; + case D_COMP_QUAL_NAME: + case D_COMP_LOCAL_NAME: + dc = d_right (dc); + break; + case D_COMP_CTOR: + *ctor_kind = dc->u.s_ctor.kind; + ret = 1; + dc = NULL; + break; + case D_COMP_DTOR: + *dtor_kind = dc->u.s_dtor.kind; + ret = 1; + dc = NULL; + break; } } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index c47c6ae..8bae90e 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2905,7 +2905,43 @@ bool std::operator< <file_path, std::string>(std::pair<file_path, std::string> c --format=gnu-v3 _Z9hairyfuncM1YKFPVPFrPA2_PM1XKFKPA3_ilEPcEiE hairyfunc(int (* const (X::** (* restrict (* volatile*(Y::*)(int) const)(char*)) [2])(long) const) [3]) -# +# +# Check that negative numbers are handled correctly. +--format=gnu-v3 +_Z1fILin1EEvv +void f<-1>() +# +# Check a destructor of a standard substitution. +--format=gnu-v3 +_ZNSdD0Ev +std::basic_iostream<char, std::char_traits<char> >::~basic_iostream() +# +# Another case where we got member function qualifiers wrong. +--format=gnu-v3 +_ZNK15nsBaseHashtableI15nsUint32HashKey8nsCOMPtrI4IFooEPS2_E13EnumerateReadEPF15PLDHashOperatorRKjS4_PvES9_ +nsBaseHashtable<nsUint32HashKey, nsCOMPtr<IFoo>, IFoo*>::EnumerateRead(PLDHashOperator (*)(unsigned int const&, IFoo*, void*), void*) const +# +# Another member function qualifier test case, when the member function +# returns a pointer to function. +--format=gnu-v3 +_ZNK1C1fIiEEPFivEv +int (*C::f<int>() const)() +# +# Another case where we got member function qualifiers wrong. +--format=gnu-v3 +_ZZ3BBdI3FooEvvENK3Fob3FabEv +void BBd<Foo>()::Fob::Fab() const +# +# The same idea one level deeper. +--format=gnu-v3 +_ZZZ3BBdI3FooEvvENK3Fob3FabEvENK3Gob3GabEv +void BBd<Foo>()::Fob::Fab() const::Gob::Gab() const +# +# Yet another member function qualifier problem. +--format=gnu-v3 +_ZNK5boost6spirit5matchI13rcs_deltatextEcvMNS0_4impl5dummyEFvvEEv +boost::spirit::match<rcs_deltatext>::operator void (boost::spirit::impl::dummy::*)()() const +# # This caused an infinite loop. # # This is generated by an EDG compiler (kcc 4.0). To demangle it diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 77d6b35..40eed6e 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,18 @@ +2003-12-15 Christian Groessler <chris@groessler.org> + + * z8k-dis.c (intr_names): Removed. + (print_intr, print_flags): New functions. + (unparse_instr): Use new functions. + +2003-12-15 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * m32r-opc.c: Regenerate. + +2003-12-14 Mark Mitchell <mark@codesourcery.com> + + * arm-opc.h (arm_opcodes): Put V6 instructions before XScale + instructions. + 2003-12-13 Hans-Peter Nilsson <hp@bitrange.com> * mmix-opc.c (mmix_opcodes): Use GO_INSN_BYTE, PUSHGO_INSN_BYTE, diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h index b59f2d3..cc59b8f 100644 --- a/opcodes/arm-opc.h +++ b/opcodes/arm-opc.h @@ -98,70 +98,6 @@ static const struct arm_opcode arm_opcodes[] = {0x00800090, 0x0fa000f0, "%22?sumull%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"}, {0x00a00090, 0x0fa000f0, "%22?sumlal%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"}, - /* V5J instruction. */ - {0x012fff20, 0x0ffffff0, "bxj%c\t%0-3r"}, - - /* XScale instructions. */ - {0x0e200010, 0x0fff0ff0, "mia%c\tacc0, %0-3r, %12-15r"}, - {0x0e280010, 0x0fff0ff0, "miaph%c\tacc0, %0-3r, %12-15r"}, - {0x0e2c0010, 0x0ffc0ff0, "mia%17'T%17`B%16'T%16`B%c\tacc0, %0-3r, %12-15r"}, - {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, - {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, - {0xf450f000, 0xfc70f000, "pld\t%a"}, - - /* Intel Wireless MMX technology instructions. */ -#define FIRST_IWMMXT_INSN 0x0e130130 -#define IWMMXT_INSN_COUNT 47 - {0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"}, - {0x0e400010, 0x0ff00f3f, "tbcst%6-7w%c\t%16-19g, %12-15r"}, - {0x0e130170, 0x0f3f0ff8, "textrc%22-23w%c\t%12-15r, #%0-2d"}, - {0x0e100070, 0x0f300ff0, "textrm%3?su%22-23w%c\t%12-15r, %16-19g, #%0-2d"}, - {0x0e600010, 0x0ff00f38, "tinsr%6-7w%c\t%16-19g, %12-15r, #%0-2d"}, - {0x0e000110, 0x0ff00fff, "tmcr%c\t%16-19G, %12-15r"}, - {0x0c400000, 0x0ff00ff0, "tmcrr%c\t%0-3g, %12-15r, %16-19r"}, - {0x0e2c0010, 0x0ffc0e10, "tmia%17?tb%16?tb%c\t%5-8g, %0-3r, %12-15r"}, - {0x0e200010, 0x0fff0e10, "tmia%c\t%5-8g, %0-3r, %12-15r"}, - {0x0e280010, 0x0fff0e10, "tmiaph%c\t%5-8g, %0-3r, %12-15r"}, - {0x0e100030, 0x0f300fff, "tmovmsk%22-23w%c\t%12-15r, %16-19g"}, - {0x0e100110, 0x0ff00ff0, "tmrc%c\t%12-15r, %16-19G"}, - {0x0c500000, 0x0ff00ff0, "tmrrc%c\t%12-15r, %16-19r, %0-3g"}, - {0x0e130150, 0x0f3f0fff, "torc%22-23w%c\t%12-15r"}, - {0x0e0001c0, 0x0f300fff, "wacc%22-23w%c\t%12-15g, %16-19g"}, - {0x0e000180, 0x0f000ff0, "wadd%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000020, 0x0f800ff0, "waligni%c\t%12-15g, %16-19g, %0-3g, #%20-22d"}, - {0x0e800020, 0x0fc00ff0, "walignr%20-21d%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e200000, 0x0fe00ff0, "wand%20'n%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e800000, 0x0fa00ff0, "wavg2%22?hb%20'r%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000060, 0x0f300ff0, "wcmpeq%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e100060, 0x0f100ff0, "wcmpgt%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0xfc100100, 0xfe500f00, "wldrw\t%12-15G, %A"}, - {0x0c100000, 0x0e100e00, "wldr%L%c\t%12-15g, %l"}, - {0x0e400100, 0x0fc00ff0, "wmac%21?su%20'z%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e800100, 0x0fd00ff0, "wmadd%21?su%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000160, 0x0f100ff0, "wmax%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e100160, 0x0f100ff0, "wmin%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000100, 0x0fc00ff0, "wmul%21?su%20?ml%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000000, 0x0ff00ff0, "wor%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000080, 0x0f000ff0, "wpack%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e300040, 0x0f300ff0, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e300148, 0x0f300ffc, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {0x0e000120, 0x0fa00ff0, "wsad%22?hb%20'z%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e0001e0, 0x0f000ff0, "wshufh%c\t%12-15g, %16-19g, #%Z"}, - {0x0e100040, 0x0f300ff0, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e100148, 0x0f300ffc, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {0x0e000040, 0x0f300ff0, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e000148, 0x0f300ffc, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {0x0e200040, 0x0f300ff0, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e200148, 0x0f300ffc, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {0xfc000100, 0xfe500f00, "wstrw\t%12-15G, %A"}, - {0x0c000000, 0x0e100e00, "wstr%L%c\t%12-15g, %l"}, - {0x0e0001a0, 0x0f000ff0, "wsub%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e0000c0, 0x0f100fff, "wunpckeh%21?su%22-23w%c\t%12-15g, %16-19g"}, - {0x0e0000e0, 0x0f100fff, "wunpckel%21?su%22-23w%c\t%12-15g, %16-19g"}, - {0x0e1000c0, 0x0f300ff0, "wunpckih%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e1000e0, 0x0f300ff0, "wunpckil%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {0x0e100000, 0x0ff00ff0, "wxor%c\t%12-15g, %16-19g, %0-3g"}, - /* ARM V6 instructions. */ {0xfc500000, 0xfff00000, "mrrc2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, {0xfc400000, 0xfff00000, "mcrr2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, @@ -288,6 +224,70 @@ static const struct arm_opcode arm_opcodes[] = {0x06e00050, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, ASR #%7-11d"}, {0x06e00f30, 0x0ff00ff0, "usat16%c\t%12-15r, #%16-19d, %0-3r"}, + /* V5J instruction. */ + {0x012fff20, 0x0ffffff0, "bxj%c\t%0-3r"}, + + /* XScale instructions. */ + {0x0e200010, 0x0fff0ff0, "mia%c\tacc0, %0-3r, %12-15r"}, + {0x0e280010, 0x0fff0ff0, "miaph%c\tacc0, %0-3r, %12-15r"}, + {0x0e2c0010, 0x0ffc0ff0, "mia%17'T%17`B%16'T%16`B%c\tacc0, %0-3r, %12-15r"}, + {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, + {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, + {0xf450f000, 0xfc70f000, "pld\t%a"}, + + /* Intel Wireless MMX technology instructions. */ +#define FIRST_IWMMXT_INSN 0x0e130130 +#define IWMMXT_INSN_COUNT 47 + {0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"}, + {0x0e400010, 0x0ff00f3f, "tbcst%6-7w%c\t%16-19g, %12-15r"}, + {0x0e130170, 0x0f3f0ff8, "textrc%22-23w%c\t%12-15r, #%0-2d"}, + {0x0e100070, 0x0f300ff0, "textrm%3?su%22-23w%c\t%12-15r, %16-19g, #%0-2d"}, + {0x0e600010, 0x0ff00f38, "tinsr%6-7w%c\t%16-19g, %12-15r, #%0-2d"}, + {0x0e000110, 0x0ff00fff, "tmcr%c\t%16-19G, %12-15r"}, + {0x0c400000, 0x0ff00ff0, "tmcrr%c\t%0-3g, %12-15r, %16-19r"}, + {0x0e2c0010, 0x0ffc0e10, "tmia%17?tb%16?tb%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e200010, 0x0fff0e10, "tmia%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e280010, 0x0fff0e10, "tmiaph%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e100030, 0x0f300fff, "tmovmsk%22-23w%c\t%12-15r, %16-19g"}, + {0x0e100110, 0x0ff00ff0, "tmrc%c\t%12-15r, %16-19G"}, + {0x0c500000, 0x0ff00ff0, "tmrrc%c\t%12-15r, %16-19r, %0-3g"}, + {0x0e130150, 0x0f3f0fff, "torc%22-23w%c\t%12-15r"}, + {0x0e0001c0, 0x0f300fff, "wacc%22-23w%c\t%12-15g, %16-19g"}, + {0x0e000180, 0x0f000ff0, "wadd%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000020, 0x0f800ff0, "waligni%c\t%12-15g, %16-19g, %0-3g, #%20-22d"}, + {0x0e800020, 0x0fc00ff0, "walignr%20-21d%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e200000, 0x0fe00ff0, "wand%20'n%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e800000, 0x0fa00ff0, "wavg2%22?hb%20'r%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000060, 0x0f300ff0, "wcmpeq%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100060, 0x0f100ff0, "wcmpgt%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0xfc100100, 0xfe500f00, "wldrw\t%12-15G, %A"}, + {0x0c100000, 0x0e100e00, "wldr%L%c\t%12-15g, %l"}, + {0x0e400100, 0x0fc00ff0, "wmac%21?su%20'z%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e800100, 0x0fd00ff0, "wmadd%21?su%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000160, 0x0f100ff0, "wmax%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100160, 0x0f100ff0, "wmin%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000100, 0x0fc00ff0, "wmul%21?su%20?ml%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000000, 0x0ff00ff0, "wor%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000080, 0x0f000ff0, "wpack%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e300040, 0x0f300ff0, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e300148, 0x0f300ffc, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e000120, 0x0fa00ff0, "wsad%22?hb%20'z%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e0001e0, 0x0f000ff0, "wshufh%c\t%12-15g, %16-19g, #%Z"}, + {0x0e100040, 0x0f300ff0, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100148, 0x0f300ffc, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e000040, 0x0f300ff0, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000148, 0x0f300ffc, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e200040, 0x0f300ff0, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e200148, 0x0f300ffc, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0xfc000100, 0xfe500f00, "wstrw\t%12-15G, %A"}, + {0x0c000000, 0x0e100e00, "wstr%L%c\t%12-15g, %l"}, + {0x0e0001a0, 0x0f000ff0, "wsub%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e0000c0, 0x0f100fff, "wunpckeh%21?su%22-23w%c\t%12-15g, %16-19g"}, + {0x0e0000e0, 0x0f100fff, "wunpckel%21?su%22-23w%c\t%12-15g, %16-19g"}, + {0x0e1000c0, 0x0f300ff0, "wunpckih%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e1000e0, 0x0f300ff0, "wunpckil%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100000, 0x0ff00ff0, "wxor%c\t%12-15g, %16-19g, %0-3g"}, + /* V5 Instructions. */ {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, {0xfa000000, 0xfe000000, "blx\t%B"}, diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c index 18d8d68..a18d5cc 100644 --- a/opcodes/m32r-opc.c +++ b/opcodes/m32r-opc.c @@ -1413,7 +1413,7 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* pop $dr */ { -1, "pop", "pop", 16, - { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } } + { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_O } } }, /* ldi $dr,$simm8 */ { diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c index 02f5dcb..0ac0fc8 100644 --- a/opcodes/z8k-dis.c +++ b/opcodes/z8k-dis.c @@ -26,7 +26,7 @@ #include "z8k-opc.h" #include <setjmp.h> - + typedef struct { /* These are all indexed by nibble number (i.e only every other entry @@ -472,12 +472,53 @@ unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info } } -static char *intr_names[] = { - "all", /* 0 */ - "vi", /* 1 */ - "nvi", /* 2 */ - "none" /* 3 */ -}; +static void +print_intr(char *tmp_str, unsigned long interrupts) +{ + int comma = 0; + + *tmp_str = 0; + if (! (interrupts & 2)) + { + strcat (tmp_str, "vi"); + comma = 1; + } + if (! (interrupts & 1)) + { + if (comma) strcat (tmp_str, ","); + strcat (tmp_str, "nvi"); + } +} + +static void +print_flags(char *tmp_str, unsigned long flags) +{ + int comma = 0; + + *tmp_str = 0; + if (flags & 8) + { + strcat (tmp_str, "c"); + comma = 1; + } + if (flags & 4) + { + if (comma) strcat (tmp_str, ","); + strcat (tmp_str, "z"); + comma = 1; + } + if (flags & 2) + { + if (comma) strcat (tmp_str, ","); + strcat (tmp_str, "s"); + comma = 1; + } + if (flags & 1) + { + if (comma) strcat (tmp_str, ","); + strcat (tmp_str, "p"); + } +} static void unparse_instr (instr_data_s *instr_data, int is_segmented) @@ -529,12 +570,12 @@ unparse_instr (instr_data_s *instr_data, int is_segmented) strcat (out_str, tmp_str); break; case CLASS_IMM: - if (datum_value == ARG_IMM2) /* True with EI/DI instructions only. */ - { - sprintf (tmp_str, "%s", intr_names[instr_data->interrupts]); - strcat (out_str, tmp_str); - break; - } + if (datum_value == ARG_IMM2) /* True with EI/DI instructions only. */ + { + print_intr (tmp_str, instr_data->interrupts); + strcat (out_str, tmp_str); + break; + } sprintf (tmp_str, "#0x%0lx", instr_data->immediate); strcat (out_str, tmp_str); break; @@ -563,7 +604,7 @@ unparse_instr (instr_data_s *instr_data, int is_segmented) strcat (out_str, tmp_str); break; case CLASS_FLAGS: - sprintf (tmp_str, "0x%0lx", instr_data->flags); + print_flags(tmp_str, instr_data->flags); strcat (out_str, tmp_str); break; case CLASS_REG_BYTE: diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb index affba35..adc733c 100644 --- a/readline/ChangeLog.gdb +++ b/readline/ChangeLog.gdb @@ -1,3 +1,10 @@ +2003-12-11 Michael Chastain <mec.gnu@mindspring.com> + + * rlmbutil.h: Require HAVE_MBSTATE_T for HANDLE_MULTIBYTE. + Revert requirement of HAVE_MBRTOWC. Delete macro definitions + that attempted to fake mbstate_t if HAVE_MBSRTOCWS is defined + and HAVE_MBSTATE_T is not defined. + 2003-06-14 H.J. Lu <hongjiu.lu@intel.com> * support/config.guess: Update to 2003-06-12 version. diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h index 9b8464a..dab954f 100644 --- a/readline/rlmbutil.h +++ b/readline/rlmbutil.h @@ -1,6 +1,6 @@ /* rlmbutil.h -- utility functions for multibyte characters. */ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. This file is part of the GNU Readline Library, a library for reading lines of text with interactive input and history editing. @@ -30,27 +30,27 @@ /************************************************/ /* For platforms which support the ISO C amendement 1 functionality we - support user defined character classes. */ + support user defined character classes. + + Some platforms have the multibyte functions such as mbsrtowcs but + are lacking the multitype type mbstate_t. BeOS (unknown version) + and HP/UX 11.23 without _XOPEN_SOURCE=500 are like this. + + We really need mbstate_t type to operate properly. For example, see + compute_lcd_of_matches, where two mbstate_t's are active at the same + time. So we require both the functions and the mbstate_t type in + order to enable multibyte support. */ + /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) # include <wchar.h> # include <wctype.h> -# if defined (HAVE_MBRTOWC) && defined (HAVE_MBSRTOWCS) +# if defined (HAVE_MBSTATE_T) && defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */ # define HANDLE_MULTIBYTE 1 # endif #endif -/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ -#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T) -# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0) -# define mbsrtowcs(dest, src, len, ps) (mbsrtowcs) (dest, src, len, 0) -# define wcrtomb(s, wc, ps) (wcrtomb) (s, wc, 0) -# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) -# define mbrlen(s, n, ps) (mbrlen) (s, n, 0) -# define mbstate_t int -#endif - /* Make sure MB_LEN_MAX is at least 16 on systems that claim to be able to handle multibyte chars (some systems define MB_LEN_MAX as 1) */ #ifdef HANDLE_MULTIBYTE diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index f95071f..c2d7584 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * sim-core.c (sim_core_trans_addr): Added for m32r-linux-run. + 2003-11-22 Kazu Hirata <kazu@cs.umass.edu> * sim-options.c (standard_options): Fix the names of H8 diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c index 586c25e..65c28d7 100644 --- a/sim/common/sim-core.c +++ b/sim/common/sim-core.c @@ -801,6 +801,25 @@ sim_core_xor_write_buffer (SIM_DESC sd, } #endif +#if EXTERN_SIM_CORE_P +void * +sim_core_trans_addr (SIM_DESC sd, + sim_cpu *cpu, + unsigned map, + address_word addr) +{ + sim_core_common *core = (cpu == NULL ? &STATE_CORE (sd)->common : &CPU_CORE (cpu)->common); + sim_core_mapping *mapping = + sim_core_find_mapping (core, map, + addr, /*nr-bytes*/1, + write_transfer, + 0 /*dont-abort*/, NULL, NULL_CIA); + if (mapping == NULL) + return NULL; + return sim_core_translate(mapping, addr); +} +#endif + /* define the read/write 1/2/4/8/16/word functions */ diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 7aa1a75..5d66c95 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,8 @@ +2003-12-16 Michael Snyder <msnyder@redhat.com> + + Patch submitted by Anil Paranjape <AnilP1@KPITCummins.com> + * sim-main.h (H8300H_MSIZE): Increase from 18 bits to 24 bits. + 2003-12-11 Dhananjay Deshpande <dhananjayd@kpitcummins.com> * compile.c (set_h8300h): Initialize globals to zero. diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h index 284a558..65cc999 100644 --- a/sim/h8300/sim-main.h +++ b/sim/h8300/sim-main.h @@ -27,7 +27,7 @@ /* avolkov: Next 2 macros are ugly for any workstation, but while they're work. Memory size MUST be configurable. */ -#define H8300H_MSIZE (1 << 18) +#define H8300H_MSIZE (1 << 24) #define H8300S_MSIZE (1 << 24) #define CSIZE 1024 diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 4096452..92cbd04 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,15 @@ +2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * configure.in: Changed for dummy simulator of m32r-linux. + * configure: Regenerate. + * Makefile.in: Added traps-linux.o for dummy simulator of m32r-linux. + * traps-linux.c: Added for dummy simulator of m32r-linux. + * syscall.h: Ditto. + * sim-if.c (sim_create_inferior): Changed to setup SP for dummy + simulator for m32r-linux. + * sim-main.h (M32R_DEFAULT_MEM_SIZE): Changed for dummy simulator of + m32r-linux. + 2003-12-11 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> * Makefile.in: Add support for new machine m32r2. diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in index ee3f7e8..eb29ab1 100644 --- a/sim/m32r/Makefile.in +++ b/sim/m32r/Makefile.in @@ -23,6 +23,7 @@ M32R_OBJS = m32r.o cpu.o decode.o sem.o model.o mloop.o M32RX_OBJS = m32rx.o cpux.o decodex.o modelx.o mloopx.o M32R2_OBJS = m32r2.o cpu2.o decode2.o model2.o mloop2.o +TRAPS_OBJ = @traps_obj@ CONFIG_DEVICES = dv-sockser.o CONFIG_DEVICES = @@ -40,7 +41,8 @@ SIM_OBJS = \ $(M32R_OBJS) \ $(M32RX_OBJS) \ $(M32R2_OBJS) \ - traps.o devices.o \ + $(TRAPS_OBJ) \ + devices.o \ $(CONFIG_DEVICES) # Extra headers included by sim-main.h. @@ -48,7 +50,7 @@ SIM_EXTRA_DEPS = \ $(CGEN_INCLUDE_DEPS) \ arch.h cpuall.h m32r-sim.h $(srcdir)/../../opcodes/m32r-desc.h -SIM_EXTRA_CFLAGS = +SIM_EXTRA_CFLAGS = @sim_extra_cflags@ SIM_RUN_OBJS = nrun.o SIM_EXTRA_CLEAN = m32r-clean @@ -65,6 +67,7 @@ sim-if.o: sim-if.c $(SIM_MAIN_DEPS) $(srcdir)/../common/sim-core.h arch.o: arch.c $(SIM_MAIN_DEPS) traps.o: traps.c targ-vals.h $(SIM_MAIN_DEPS) +traps-linux.o: traps.c syscall.h targ-vals.h $(SIM_MAIN_DEPS) devices.o: devices.c $(SIM_MAIN_DEPS) # M32R objs diff --git a/sim/m32r/configure b/sim/m32r/configure index 4a55bc1..6e8b0cd 100755 --- a/sim/m32r/configure +++ b/sim/m32r/configure @@ -3848,6 +3848,20 @@ fi + case "${target_alias}" in + m32r*-linux*) + traps_obj=traps-linux.o + sim_extra_cflags="-DM32R_LINUX" + ;; + *) + traps_obj=traps.o + sim_extra_cflags="-DM32R_ELF" + ;; + esac + + + + trap '' 1 2 15 @@ -4061,6 +4075,8 @@ s%@EXEEXT@%$EXEEXT%g s%@CGEN_MAINT@%$CGEN_MAINT%g s%@cgendir@%$cgendir%g s%@cgen@%$cgen%g +s%@traps_obj@%$traps_obj%g +s%@sim_extra_cflags@%$sim_extra_cflags%g CEOF EOF diff --git a/sim/m32r/configure.in b/sim/m32r/configure.in index f598f29..12857b9 100644 --- a/sim/m32r/configure.in +++ b/sim/m32r/configure.in @@ -14,4 +14,18 @@ SIM_AC_OPTION_ENVIRONMENT SIM_AC_OPTION_INLINE() SIM_AC_OPTION_CGEN_MAINT + case "${target_alias}" in + m32r*-linux*) + traps_obj=traps-linux.o + sim_extra_cflags="-DM32R_LINUX" + ;; + *) + traps_obj=traps.o + sim_extra_cflags="-DM32R_ELF" + ;; + esac +AC_SUBST(traps_obj) +AC_SUBST(sim_extra_cflags) + + SIM_AC_OUTPUT diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index 749c79e..f8bbece 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -214,6 +214,13 @@ sim_create_inferior (sd, abfd, argv, envp) addr = 0; sim_pc_set (current_cpu, addr); +#ifdef M32R_LINUX + m32rbf_h_cr_set (current_cpu, + m32r_decode_gdb_ctrl_regnum(SPI_REGNUM), 0x1f00000); + m32rbf_h_cr_set (current_cpu, + m32r_decode_gdb_ctrl_regnum(SPU_REGNUM), 0x1f00000); +#endif + #if 0 STATE_ARGV (sd) = sim_copy_argv (argv); STATE_ENVP (sd) = sim_copy_argv (envp); diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h index becfb62..2cbb40b 100644 --- a/sim/m32r/sim-main.h +++ b/sim/m32r/sim-main.h @@ -85,6 +85,10 @@ m32r_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) /* Default memory size. */ +#ifdef M32R_LINUX +#define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */ +#else #define M32R_DEFAULT_MEM_SIZE 0x800000 /* 8M */ +#endif #endif /* SIM_MAIN_H */ |