]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: GOT is an ELF-only entity
authorJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2025 09:28:24 +0000 (10:28 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2025 09:28:24 +0000 (10:28 +0100)
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.

gas/config/tc-i386.c
gas/config/tc-i386.h

index 9adb96ff43309f5f05fe369d25660b1cdd839b0a..1d07c2f1e370b1bcabf79493c3024d8e13aa595c 100644 (file)
@@ -18033,6 +18033,7 @@ i386_target_format (void)
 
 #endif /* ELF / PE / MACH_O  */
 \f
+#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.  */
index 7cef12123e97ff9677ba11f0c6d7530aa9b5ac18..3fb7920d6082cec8911c6ab1f5f502853bae3b0b 100644 (file)
@@ -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.  */