* [PATCH 1/2] Add a test for main () in a shared object
@ 2017-10-03 14:18 H.J. Lu
2017-10-04 21:19 ` H.J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2017-10-03 14:18 UTC (permalink / raw)
To: GNU C Library
Verify that crt1.o can be used with main () in a shared object.
Any comments?
H.J.
---
* elf/Makefile (tests): Add tst-main1.
(modules-names): Add tst-main1mod.
($(objpfx)tst-main1): New.
(CRT-tst-main1): Likewise.
(LDFLAGS-tst-main1): Likewise.
(LDLIBS-tst-main1): Likewise.
(tst-main1mod.so-no-z-defs): Likewise.
* elf/tst-main1.c: New file.
* elf/tst-main1mod.c: Likewise.
---
elf/Makefile | 11 +++++++++--
elf/tst-main1.c | 19 +++++++++++++++++++
elf/tst-main1mod.c | 25 +++++++++++++++++++++++++
3 files changed, 53 insertions(+), 2 deletions(-)
create mode 100644 elf/tst-main1.c
create mode 100644 elf/tst-main1mod.c
diff --git a/elf/Makefile b/elf/Makefile
index c6edebd4ee..0dcbf2f3de 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -185,7 +185,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
- tst-debug1
+ tst-debug1 tst-main1
# reldep9
tests-internal += loadtest unload unload2 circleload1 \
neededtest neededtest2 neededtest3 neededtest4 \
@@ -269,7 +269,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
- tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin
+ tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
+ tst-main1mod
ifeq (yes,$(have-mtls-dialect-gnu2))
tests += tst-gnu2-tls1
modules-names += tst-gnu2-tls1mod
@@ -1427,3 +1428,9 @@ $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
$(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
$(OBJCOPY) --only-keep-debug $< $@
+
+$(objpfx)tst-main1: $(objpfx)tst-main1mod.so
+CRT-tst-main1 := $(csu-objpfx)crt1.o
+LDFLAGS-tst-main1 = $(no-pie-ldflag)
+LDLIBS-tst-main1 = $(libsupport)
+tst-main1mod.so-no-z-defs = yes
diff --git a/elf/tst-main1.c b/elf/tst-main1.c
new file mode 100644
index 0000000000..1285ea22e4
--- /dev/null
+++ b/elf/tst-main1.c
@@ -0,0 +1,19 @@
+/* Unit test for main () in a shared object.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is empty. */
diff --git a/elf/tst-main1mod.c b/elf/tst-main1mod.c
new file mode 100644
index 0000000000..edbeaafacb
--- /dev/null
+++ b/elf/tst-main1mod.c
@@ -0,0 +1,25 @@
+/* Unit test for main () in a shared object.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+static int
+do_test (void)
+{
+ return 0;
+}
+
+#include <support/test-driver.c>
--
2.13.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] Add a test for main () in a shared object
2017-10-03 14:18 [PATCH 1/2] Add a test for main () in a shared object H.J. Lu
@ 2017-10-04 21:19 ` H.J. Lu
0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2017-10-04 21:19 UTC (permalink / raw)
To: GNU C Library
On 10/3/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> Verify that crt1.o can be used with main () in a shared object.
>
> Any comments?
>
> H.J.
> ---
> * elf/Makefile (tests): Add tst-main1.
> (modules-names): Add tst-main1mod.
> ($(objpfx)tst-main1): New.
> (CRT-tst-main1): Likewise.
> (LDFLAGS-tst-main1): Likewise.
> (LDLIBS-tst-main1): Likewise.
> (tst-main1mod.so-no-z-defs): Likewise.
> * elf/tst-main1.c: New file.
> * elf/tst-main1mod.c: Likewise.
> ---
> elf/Makefile | 11 +++++++++--
> elf/tst-main1.c | 19 +++++++++++++++++++
> elf/tst-main1mod.c | 25 +++++++++++++++++++++++++
> 3 files changed, 53 insertions(+), 2 deletions(-)
> create mode 100644 elf/tst-main1.c
> create mode 100644 elf/tst-main1mod.c
>
> diff --git a/elf/Makefile b/elf/Makefile
> index c6edebd4ee..0dcbf2f3de 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -185,7 +185,7 @@ tests += restest1 preloadtest loadfail multiload
> origtest resolvfail \
> tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
> tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
> tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
> - tst-debug1
> + tst-debug1 tst-main1
> # reldep9
> tests-internal += loadtest unload unload2 circleload1 \
> neededtest neededtest2 neededtest3 neededtest4 \
> @@ -269,7 +269,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4
> testobj5 testobj6 \
> tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
> tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
> tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
> - tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin
> + tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
> + tst-main1mod
> ifeq (yes,$(have-mtls-dialect-gnu2))
> tests += tst-gnu2-tls1
> modules-names += tst-gnu2-tls1mod
> @@ -1427,3 +1428,9 @@ $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
>
> $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
> $(OBJCOPY) --only-keep-debug $< $@
> +
> +$(objpfx)tst-main1: $(objpfx)tst-main1mod.so
> +CRT-tst-main1 := $(csu-objpfx)crt1.o
> +LDFLAGS-tst-main1 = $(no-pie-ldflag)
> +LDLIBS-tst-main1 = $(libsupport)
> +tst-main1mod.so-no-z-defs = yes
> diff --git a/elf/tst-main1.c b/elf/tst-main1.c
> new file mode 100644
> index 0000000000..1285ea22e4
> --- /dev/null
> +++ b/elf/tst-main1.c
> @@ -0,0 +1,19 @@
> +/* Unit test for main () in a shared object.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library 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
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +/* This is empty. */
> diff --git a/elf/tst-main1mod.c b/elf/tst-main1mod.c
> new file mode 100644
> index 0000000000..edbeaafacb
> --- /dev/null
> +++ b/elf/tst-main1mod.c
> @@ -0,0 +1,25 @@
> +/* Unit test for main () in a shared object.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library 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
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +static int
> +do_test (void)
> +{
> + return 0;
> +}
> +
> +#include <support/test-driver.c>
> --
> 2.13.6
>
>
I am checking it in.
--
H.J.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-04 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 14:18 [PATCH 1/2] Add a test for main () in a shared object H.J. Lu
2017-10-04 21:19 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).