endif
+# -Wl,--build-id=none is needed when linking tools on Linux. Without this
+# flag newer ld versions (2.20 and later) create a .note.gnu.build-id at the
+# default text segment address, which of course means the resulting executable
+# is unusable. So we have to tell ld not to generate that, with --build-id=none.
TOOL_LDFLAGS_COMMON_LINUX = \
- -static -nodefaultlibs -nostartfiles -u _start
+ -static -nodefaultlibs -nostartfiles -u _start @FLAG_NO_BUILD_ID@
TOOL_LDFLAGS_COMMON_AIX5 = \
-static -Wl,-e_start_valgrind
TOOL_LDFLAGS_COMMON_DARWIN = \
CFLAGS=$safe_CFLAGS
+# does this compiler support -Wl,--build-id=none ?
+
+AC_MSG_CHECKING([if gcc accepts -Wl,--build-id=none])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-Wl,--build-id=none"
+
+AC_TRY_COMPILE(
+[ ],
+[return 0; ],
+[
+ AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
+ AC_MSG_RESULT([yes])
+], [
+ AC_SUBST([FLAG_NO_BUILD_ID], [""])
+ AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+
# does the ppc assembler support "mtocrf" et al?
AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
/* Scheme is simple: pass the specified command to the linker as-is,
except, add "-static" and "-Ttext=<argv[1]>" to it.
-
- Also apparently we need --build-id=none. For older ld's (2.18
- vintage) the first two flags are fine. For newer ones (2.20), a
- .note.gnu.build-id is nevertheless created at the default text
- segment address, which of course means the resulting executable is
- unusable. So we have to tell ld not to generate that, with
- --build-id=none.
-
- As to "how far back is this flag supported", it's available at
- least in ld 2.18 and 2.20 and gold 2.20.
*/
// Don't NDEBUG this; the asserts are necesary for
char ttext[100];
assert(strlen(ala) < 30);
memset(ttext, 0, sizeof(ttext));
- sprintf(ttext, " -static -Wl,-Ttext=%s -Wl,--build-id=none", ala);
+ sprintf(ttext, " -static -Wl,-Ttext=%s", ala);
strcpy(cmd, gcc);
strcat(cmd, ttext);