This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/4304: ld --fatal-warnings doesn't work
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Thu, 5 Apr 2007 08:49:26 -0700
- Subject: Re: PATCH: PR ld/4304: ld --fatal-warnings doesn't work
- References: <20070405133735.GA30624@lucon.org>
On Thu, Apr 05, 2007 at 06:37:35AM -0700, H. J. Lu wrote:
> There is no way for bfd to pass if warning is generated to linker. This
> patch adds a warned field to bfd_link_info so that bfd can set it
> for linker to check.
>
>
The fix is quite simple. We just need to use einfo callback instead
of _bfd_error_handler for DT_TEXTREL warning. I will check it in
as an obvious fix.
---
bfd/
2007-04-05 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4304
* elflink.c (bfd_elf_final_link): Call einfo callback in
bfd_link_info instead of _bfd_error_handler for DT_TEXTREL
warning.
ld/testsuite/
2007-04-05 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4304
* ld-i386/i386.exp: Run "warn1".
* ld-i386/warn1.d: New file.
* ld-i386/warn1.s: Likewise.
--- binutils/bfd/elflink.c.warn 2007-04-05 08:40:25.000000000 -0700
+++ binutils/bfd/elflink.c 2007-04-05 08:45:49.000000000 -0700
@@ -10028,7 +10028,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
if (dyn.d_tag == DT_TEXTREL)
{
- _bfd_error_handler
+ info->callbacks->einfo
(_("warning: creating a DT_TEXTREL in a shared object."));
break;
}
--- binutils/ld/testsuite/ld-i386/i386.exp.warn 2007-03-22 10:27:59.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/i386.exp 2007-04-05 08:44:17.000000000 -0700
@@ -115,3 +115,4 @@ run_dump_test "pcrel8"
run_dump_test "pcrel16"
run_dump_test "pcrel16abs"
run_dump_test "alloc"
+run_dump_test "warn1"
--- binutils/ld/testsuite/ld-i386/warn1.d.warn 2007-04-05 08:44:17.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/warn1.d 2007-04-05 08:44:17.000000000 -0700
@@ -0,0 +1,4 @@
+#name: --warn-shared-textrel --fatal-warnings
+#as: --32
+#ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
+#error: .*warning: creating a DT_TEXTREL in a shared object
--- binutils/ld/testsuite/ld-i386/warn1.s.warn 2007-04-05 08:44:17.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/warn1.s 2007-04-05 08:44:17.000000000 -0700
@@ -0,0 +1,5 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ movl bar, %eax