aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2025-02-21 10:28:24 +0100
committerJan Beulich <jbeulich@suse.com>2025-02-21 10:28:24 +0100
commit0e79ff9f50afcb9b92770ab5df4adfdc3b61a0e0 (patch)
tree7b982089c8405459800cd803d4ca0ae19819f17f
parent30b64be054a5a98b22437bfba69937513f612aab (diff)
downloadbinutils-0e79ff9f50afcb9b92770ab5df4adfdc3b61a0e0.zip
binutils-0e79ff9f50afcb9b92770ab5df4adfdc3b61a0e0.tar.gz
binutils-0e79ff9f50afcb9b92770ab5df4adfdc3b61a0e0.tar.bz2
x86: GOT is an ELF-only entity
Make md_undefined_symbol() conditional upon dealing with ELF, much like other architectures (e.g. Arm32 and Arm64) have it. This avoids errors in gas and even assertions in libbfd when "accidentally" e.g. a COFF- targeting source file uses "_GLOBAL_OFFSET_TABLE_" for whatever reason. While there also convert the final return statement to properly use NULL. NB: In principle 64-bit Mach-O knows GOT, too. Yet only an i?86-macho assembler can be built right now, as per configure.tgt. Pretty clearly adjustments to gotrel[] would also be necessary before these targets could actually work reasonably cleanly.
-rw-r--r--gas/config/tc-i386.c4
-rw-r--r--gas/config/tc-i386.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9adb96f..1d07c2f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -18033,6 +18033,7 @@ i386_target_format (void)
#endif /* ELF / PE / MACH_O */
+#ifdef OBJ_ELF
symbolS *
md_undefined_symbol (char *name)
{
@@ -18050,8 +18051,9 @@ md_undefined_symbol (char *name)
};
return GOT_symbol;
}
- return 0;
+ return NULL;
}
+#endif
#ifdef OBJ_AOUT
/* Round up a section size to the appropriate boundary. */
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 7cef121..3fb7920 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -144,6 +144,7 @@ int i386_validate_fix (struct fix *);
extern int tc_i386_fix_adjustable (struct fix *);
#else
#define tc_fix_adjustable(X) ((void)(X), 1)
+#define md_undefined_symbol(N) ((void)(N), NULL)
#endif
/* Values passed to md_apply_fix don't include the symbol value. */