This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/6766: Should "--entry foo" imply "-u foo"?
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 17 Mar 2009 14:13:27 -0700
- Subject: PATCH: PR ld/6766: Should "--entry foo" imply "-u foo"?
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch makes "--entry foo" to imply "-u foo". OK to install?
Thanks.
H.J.
----
ld/
2009-03-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/6766
* lexsup.c (parse_args): Call ldlang_add_undef for -e.
ld/testsuite/
2009-03-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/6766
* ld-undefined/dummy.s: New.
* ld-undefined/entry-1.d: Likewise.
* ld-undefined/entry-2.d: Likewise.
* ld-undefined/entry-3.d: Likewise.
* ld-undefined/entry-4.d: Likewise.
* ld-undefined/entry-5.d: Likewise.
* ld-undefined/entry-6.d: Likewise.
* ld-undefined/entry.exp: Likewise.
* ld-undefined/entry.s: Likewise.
--- ld/lexsup.c.pr6766 2009-03-17 11:56:17.000000000 -0700
+++ ld/lexsup.c 2009-03-17 14:05:23.000000000 -0700
@@ -817,6 +817,7 @@ parse_args (unsigned argc, char **argv)
break;
case 'e':
lang_add_entry (optarg, TRUE);
+ ldlang_add_undef (optarg);
break;
case 'f':
if (command_line.auxiliary_filters == NULL)
--- ld/testsuite/ld-undefined/dummy.s.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/dummy.s 2009-03-17 13:55:25.000000000 -0700
@@ -0,0 +1,2 @@
+ .text
+ .byte 0
--- ld/testsuite/ld-undefined/entry-1.d.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-1.d 2009-03-17 14:01:06.000000000 -0700
@@ -0,0 +1,8 @@
+#name: --entry foo archive
+#source: dummy.s
+#ld: --entry foo tmpdir/libentry.a
+#nm: -n
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry-2.d.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-2.d 2009-03-17 14:01:13.000000000 -0700
@@ -0,0 +1,8 @@
+#name: --entry foo -u foo archive
+#source: dummy.s
+#ld: --entry foo -u foo tmpdir/libentry.a
+#nm: -n
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry-3.d.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-3.d 2009-03-17 14:03:24.000000000 -0700
@@ -0,0 +1,9 @@
+#name: -shared --entry foo archive
+#source: dummy.s
+#ld: -shared --entry foo tmpdir/libentry.a
+#nm: -n
+#target: *-*-linux*
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry-4.d.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-4.d 2009-03-17 14:03:46.000000000 -0700
@@ -0,0 +1,9 @@
+#name: -shared --entry foo -u foo archive
+#source: dummy.s
+#ld: -shared --entry foo -u foo tmpdir/libentry.a
+#nm: -n
+#target: *-*-linux*
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry-5.d.pr6766 2009-03-17 14:07:50.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-5.d 2009-03-17 14:09:09.000000000 -0700
@@ -0,0 +1,8 @@
+#name: --entry foo
+#source: entry.s
+#ld: --entry foo
+#nm: -n
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry-6.d.pr6766 2009-03-17 14:08:38.000000000 -0700
+++ ld/testsuite/ld-undefined/entry-6.d 2009-03-17 14:08:52.000000000 -0700
@@ -0,0 +1,8 @@
+#name: --entry foo -u foo
+#source: entry.s
+#ld: --entry foo -u foo
+#nm: -n
+
+#...
+[0-9a-f]+ T +foo
+#...
--- ld/testsuite/ld-undefined/entry.exp.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry.exp 2009-03-17 13:57:14.000000000 -0700
@@ -0,0 +1,35 @@
+# Expect script for ld --entry tests
+# Copyright (C) 2009 Free Software Foundation
+#
+# This file is part of the GNU Binutils.
+#
+# 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+set build_tests {
+ {"Build libentry.a"
+ "" ""
+ {entry.s} {} "libentry.a"}
+}
+
+run_ld_link_tests $build_tests
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/entry*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
--- ld/testsuite/ld-undefined/entry.s.pr6766 2009-03-17 14:06:00.000000000 -0700
+++ ld/testsuite/ld-undefined/entry.s 2009-03-17 13:55:00.000000000 -0700
@@ -0,0 +1,4 @@
+ .text
+ .globl foo
+foo:
+ .byte 0