From 774f5a3082b9b55a7668e3a92dc847de577c4946 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 15 May 2009 08:01:09 -0700 Subject: Test DSOs for executable stack. Add a text program, built to run on the host, to check all newly built DSOs for executable stacks and fail if the stack information is missing or indicates executable stacks. --- elf/Makefile | 14 ++++- elf/check-execstack.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 elf/check-execstack.c (limited to 'elf') diff --git a/elf/Makefile b/elf/Makefile index e44ff1d382..94b9d069bf 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -93,7 +93,7 @@ distribute := rtld-Rules \ order2mod1.c order2mod2.c order2mod3.c order2mod4.c \ tst-stackguard1.c tst-stackguard1-static.c \ tst-array5.c tst-array5-static.c tst-array5dep.c \ - tst-array5.exp tst-leaks1.c + tst-array5.exp tst-leaks1.c check-execstack.c CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables @@ -842,12 +842,16 @@ check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE $(objpfx)check-textrel: check-textrel.c $(native-compile) +check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 +$(objpfx)check-execstack: check-execstack.c + $(native-compile) + check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99 $(objpfx)check-localplt: check-localplt.c $(native-compile) ifeq (yes,$(build-shared)) -tests: $(objpfx)check-textrel.out +tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out $(objpfx)check-textrel.out: $(objpfx)check-textrel $(dir $<)$(notdir $<) $(common-objpfx)libc.so \ @@ -855,6 +859,12 @@ $(objpfx)check-textrel.out: $(objpfx)check-textrel $(common-objpfx)iconvdata/*.so)) > $@ generated += check-textrel check-textrel.out +$(objpfx)check-execstack.out: $(objpfx)check-execstack + $(dir $<)$(notdir $<) $(common-objpfx)libc.so \ + $(sort $(wildcard $(common-objpfx)*/lib*.so \ + $(common-objpfx)iconvdata/*.so)) > $@ +generated += check-execstack check-execstack.out + $(objpfx)tst-dlmodcount: $(libdl) $(objpfx)tst-dlmodcount.out: $(test-modules) diff --git a/elf/check-execstack.c b/elf/check-execstack.c new file mode 100644 index 0000000000..55cf48721a --- /dev/null +++ b/elf/check-execstack.c @@ -0,0 +1,158 @@ +/* Check for executable stacks in DSOs. + Copyright (C) 2009 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contribute by Ulrich Drepper . 2009. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef BITS + +# define AB(name) _AB (name, BITS) +# define _AB(name, bits) __AB (name, bits) +# define __AB(name, bits) name##bits +# define E(name) _E (name, BITS) +# define _E(name, bits) __E (name, bits) +# define __E(name, bits) Elf##bits##_##name +# define SWAP(val) \ + ({ __typeof (val) __res; \ + if (((ehdr.e_ident[EI_DATA] == ELFDATA2MSB \ + && BYTE_ORDER == LITTLE_ENDIAN) \ + || (ehdr.e_ident[EI_DATA] == ELFDATA2LSB \ + && BYTE_ORDER == BIG_ENDIAN)) \ + && sizeof (val) != 1) \ + { \ + if (sizeof (val) == 2) \ + __res = bswap_16 (val); \ + else if (sizeof (val) == 4) \ + __res = bswap_32 (val); \ + else \ + __res = bswap_64 (val); \ + } \ + else \ + __res = (val); \ + __res; }) + + +static int +AB(handle_file) (const char *fname, int fd) +{ + E(Ehdr) ehdr; + + if (pread (fd, &ehdr, sizeof (ehdr), 0) != sizeof (ehdr)) + { + read_error: + printf ("%s: read error: %m\n", fname); + return 1; + } + + const size_t phnum = SWAP (ehdr.e_phnum); + const size_t phentsize = SWAP (ehdr.e_phentsize); + + /* Read the program header. */ + E(Phdr) *phdr = alloca (phentsize * phnum); + if (pread (fd, phdr, phentsize * phnum, SWAP (ehdr.e_phoff)) + != phentsize * phnum) + goto read_error; + + /* Search for the PT_GNU_STACK entry. */ + for (size_t cnt = 0; cnt < phnum; ++cnt) + if (SWAP (phdr[cnt].p_type) == PT_GNU_STACK) + { + unsigned int flags = SWAP(phdr[cnt].p_flags); + if (flags & PF_X) + { + printf ("%s: executable stack signaled\n", fname); + return 1; + } + + return 0; + } + + printf ("%s: no PT_GNU_STACK entry\n", fname); + return 1; +} + +# undef BITS +#else + +# define BITS 32 +# include "check-execstack.c" + +# define BITS 64 +# include "check-execstack.c" + + +static int +handle_file (const char *fname) +{ + int fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open %s: %m\n", fname); + return 1; + } + + /* Read was is supposed to be the ELF header. Read the initial + bytes to determine whether this is a 32 or 64 bit file. */ + char ident[EI_NIDENT]; + if (read (fd, ident, EI_NIDENT) != EI_NIDENT) + { + printf ("%s: read error: %m\n", fname); + close (fd); + return 1; + } + + if (memcmp (&ident[EI_MAG0], ELFMAG, SELFMAG) != 0) + { + printf ("%s: not an ELF file\n", fname); + close (fd); + return 1; + } + + int result; + if (ident[EI_CLASS] == ELFCLASS64) + result = handle_file64 (fname, fd); + else + result = handle_file32 (fname, fd); + + close (fd); + + return result; +} + + +int +main (int argc, char *argv[]) +{ + int cnt; + int result = 0; + + for (cnt = 1; cnt < argc; ++cnt) + result |= handle_file (argv[cnt]); + + return result; +} +#endif -- cgit v1.2.3 From 2e180a26222caf478f29e272c9d1b5d9c6299752 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 15 May 2009 16:47:36 +0200 Subject: rename each .cvsignore file to .gitignore --- .cvsignore | 29 ----------------------------- .gitignore | 29 +++++++++++++++++++++++++++++ assert/.cvsignore | 6 ------ assert/.gitignore | 6 ++++++ csu/.cvsignore | 7 ------- csu/.gitignore | 7 +++++++ ctype/.cvsignore | 6 ------ ctype/.gitignore | 6 ++++++ dirent/.cvsignore | 6 ------ dirent/.gitignore | 6 ++++++ elf/.cvsignore | 6 ------ elf/.gitignore | 6 ++++++ gmon/.cvsignore | 6 ------ gmon/.gitignore | 6 ++++++ gnulib/.cvsignore | 6 ------ gnulib/.gitignore | 6 ++++++ grp/.cvsignore | 6 ------ grp/.gitignore | 6 ++++++ hurd/.cvsignore | 6 ------ hurd/.gitignore | 6 ++++++ inet/.cvsignore | 6 ------ inet/.gitignore | 6 ++++++ intl/.cvsignore | 6 ------ intl/.gitignore | 6 ++++++ io/.cvsignore | 6 ------ io/.gitignore | 6 ++++++ libio/.cvsignore | 8 -------- libio/.gitignore | 8 ++++++++ locale/.cvsignore | 6 ------ locale/.gitignore | 6 ++++++ mach/.cvsignore | 6 ------ mach/.gitignore | 6 ++++++ manual/.cvsignore | 14 -------------- manual/.gitignore | 14 ++++++++++++++ math/.cvsignore | 6 ------ math/.gitignore | 6 ++++++ misc/.cvsignore | 6 ------ misc/.gitignore | 6 ++++++ po/.cvsignore | 2 -- po/.gitignore | 2 ++ posix/.cvsignore | 6 ------ posix/.gitignore | 6 ++++++ pwd/.cvsignore | 6 ------ pwd/.gitignore | 6 ++++++ resolv/.cvsignore | 6 ------ resolv/.gitignore | 6 ++++++ resource/.cvsignore | 6 ------ resource/.gitignore | 6 ++++++ setjmp/.cvsignore | 6 ------ setjmp/.gitignore | 6 ++++++ signal/.cvsignore | 6 ------ signal/.gitignore | 6 ++++++ socket/.cvsignore | 6 ------ socket/.gitignore | 6 ++++++ stdio-common/.cvsignore | 8 -------- stdio-common/.gitignore | 8 ++++++++ stdlib/.cvsignore | 8 -------- stdlib/.gitignore | 8 ++++++++ string/.cvsignore | 6 ------ string/.gitignore | 6 ++++++ sunrpc/.cvsignore | 8 -------- sunrpc/.gitignore | 8 ++++++++ sysdeps/mach/hurd/.cvsignore | 4 ---- sysdeps/mach/hurd/.gitignore | 4 ++++ sysdeps/unix/common/.cvsignore | 4 ---- sysdeps/unix/common/.gitignore | 4 ++++ sysvipc/.cvsignore | 6 ------ sysvipc/.gitignore | 6 ++++++ termios/.cvsignore | 6 ------ termios/.gitignore | 6 ++++++ time/.cvsignore | 6 ------ time/.gitignore | 6 ++++++ wcsmbs/.cvsignore | 6 ------ wcsmbs/.gitignore | 6 ++++++ wctype/.cvsignore | 6 ------ wctype/.gitignore | 6 ++++++ 76 files changed, 260 insertions(+), 260 deletions(-) delete mode 100644 .cvsignore create mode 100644 .gitignore delete mode 100644 assert/.cvsignore create mode 100644 assert/.gitignore delete mode 100644 csu/.cvsignore create mode 100644 csu/.gitignore delete mode 100644 ctype/.cvsignore create mode 100644 ctype/.gitignore delete mode 100644 dirent/.cvsignore create mode 100644 dirent/.gitignore delete mode 100644 elf/.cvsignore create mode 100644 elf/.gitignore delete mode 100644 gmon/.cvsignore create mode 100644 gmon/.gitignore delete mode 100644 gnulib/.cvsignore create mode 100644 gnulib/.gitignore delete mode 100644 grp/.cvsignore create mode 100644 grp/.gitignore delete mode 100644 hurd/.cvsignore create mode 100644 hurd/.gitignore delete mode 100644 inet/.cvsignore create mode 100644 inet/.gitignore delete mode 100644 intl/.cvsignore create mode 100644 intl/.gitignore delete mode 100644 io/.cvsignore create mode 100644 io/.gitignore delete mode 100644 libio/.cvsignore create mode 100644 libio/.gitignore delete mode 100644 locale/.cvsignore create mode 100644 locale/.gitignore delete mode 100644 mach/.cvsignore create mode 100644 mach/.gitignore delete mode 100644 manual/.cvsignore create mode 100644 manual/.gitignore delete mode 100644 math/.cvsignore create mode 100644 math/.gitignore delete mode 100644 misc/.cvsignore create mode 100644 misc/.gitignore delete mode 100644 po/.cvsignore create mode 100644 po/.gitignore delete mode 100644 posix/.cvsignore create mode 100644 posix/.gitignore delete mode 100644 pwd/.cvsignore create mode 100644 pwd/.gitignore delete mode 100644 resolv/.cvsignore create mode 100644 resolv/.gitignore delete mode 100644 resource/.cvsignore create mode 100644 resource/.gitignore delete mode 100644 setjmp/.cvsignore create mode 100644 setjmp/.gitignore delete mode 100644 signal/.cvsignore create mode 100644 signal/.gitignore delete mode 100644 socket/.cvsignore create mode 100644 socket/.gitignore delete mode 100644 stdio-common/.cvsignore create mode 100644 stdio-common/.gitignore delete mode 100644 stdlib/.cvsignore create mode 100644 stdlib/.gitignore delete mode 100644 string/.cvsignore create mode 100644 string/.gitignore delete mode 100644 sunrpc/.cvsignore create mode 100644 sunrpc/.gitignore delete mode 100644 sysdeps/mach/hurd/.cvsignore create mode 100644 sysdeps/mach/hurd/.gitignore delete mode 100644 sysdeps/unix/common/.cvsignore create mode 100644 sysdeps/unix/common/.gitignore delete mode 100644 sysvipc/.cvsignore create mode 100644 sysvipc/.gitignore delete mode 100644 termios/.cvsignore create mode 100644 termios/.gitignore delete mode 100644 time/.cvsignore create mode 100644 time/.gitignore delete mode 100644 wcsmbs/.cvsignore create mode 100644 wcsmbs/.gitignore delete mode 100644 wctype/.cvsignore create mode 100644 wctype/.gitignore (limited to 'elf') diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 213609fcc7..0000000000 --- a/.cvsignore +++ /dev/null @@ -1,29 +0,0 @@ -*.d *.o *.so *.po *.go *.bo stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz *.bz2 -=* -TODO AUTHORS copyr-* copying.* -glibc-* - -configparms - -sun[43]* i[345]86* hp300* - -ieeetest hppa-sysdeps regex - -gpl2lgpl.sed -distinfo -distinfo - -test-include -analysis -docs -releases - -libc.prj .libc.prcs_aux -libc.proj .snprj - -TODO.html - -autom4te*.cache - -rtkaio diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..213609fcc7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +*.d *.o *.so *.po *.go *.bo stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz *.bz2 +=* +TODO AUTHORS copyr-* copying.* +glibc-* + +configparms + +sun[43]* i[345]86* hp300* + +ieeetest hppa-sysdeps regex + +gpl2lgpl.sed +distinfo +distinfo + +test-include +analysis +docs +releases + +libc.prj .libc.prcs_aux +libc.proj .snprj + +TODO.html + +autom4te*.cache + +rtkaio diff --git a/assert/.cvsignore b/assert/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/assert/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/assert/.gitignore b/assert/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/assert/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/csu/.cvsignore b/csu/.cvsignore deleted file mode 100644 index da6e41b953..0000000000 --- a/csu/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo -specs diff --git a/csu/.gitignore b/csu/.gitignore new file mode 100644 index 0000000000..da6e41b953 --- /dev/null +++ b/csu/.gitignore @@ -0,0 +1,7 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo +specs diff --git a/ctype/.cvsignore b/ctype/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/ctype/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/ctype/.gitignore b/ctype/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/ctype/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/dirent/.cvsignore b/dirent/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/dirent/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/dirent/.gitignore b/dirent/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/dirent/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/elf/.cvsignore b/elf/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/elf/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/elf/.gitignore b/elf/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/elf/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/gmon/.cvsignore b/gmon/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/gmon/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/gmon/.gitignore b/gmon/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/gmon/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/gnulib/.cvsignore b/gnulib/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/gnulib/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/gnulib/.gitignore b/gnulib/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/gnulib/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/grp/.cvsignore b/grp/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/grp/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/grp/.gitignore b/grp/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/grp/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/hurd/.cvsignore b/hurd/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/hurd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/hurd/.gitignore b/hurd/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/hurd/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/inet/.cvsignore b/inet/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/inet/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/inet/.gitignore b/inet/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/inet/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/intl/.cvsignore b/intl/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/intl/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/intl/.gitignore b/intl/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/intl/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/io/.cvsignore b/io/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/io/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/io/.gitignore b/io/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/io/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/libio/.cvsignore b/libio/.cvsignore deleted file mode 100644 index 602b74c1ae..0000000000 --- a/libio/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* - -mpn-copy.mk -distinfo diff --git a/libio/.gitignore b/libio/.gitignore new file mode 100644 index 0000000000..602b74c1ae --- /dev/null +++ b/libio/.gitignore @@ -0,0 +1,8 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* + +mpn-copy.mk +distinfo diff --git a/locale/.cvsignore b/locale/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/locale/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/locale/.gitignore b/locale/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/locale/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/mach/.cvsignore b/mach/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/mach/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/mach/.gitignore b/mach/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/mach/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/manual/.cvsignore b/manual/.cvsignore deleted file mode 100644 index 54abbbb5a4..0000000000 --- a/manual/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz *.bz2 -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* - -*.dvi* *.info* *.c.texi *.ps *.pdf -*.toc *.aux *.log *.tmp -*.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs - -texis top-menu.texi chapters.texi summary.texi stamp-* -distinfo dir-add.texinfo dir-add.texi - -libm-err.texi diff --git a/manual/.gitignore b/manual/.gitignore new file mode 100644 index 0000000000..54abbbb5a4 --- /dev/null +++ b/manual/.gitignore @@ -0,0 +1,14 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz *.bz2 +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* + +*.dvi* *.info* *.c.texi *.ps *.pdf +*.toc *.aux *.log *.tmp +*.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs + +texis top-menu.texi chapters.texi summary.texi stamp-* +distinfo dir-add.texinfo dir-add.texi + +libm-err.texi diff --git a/math/.cvsignore b/math/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/math/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/math/.gitignore b/math/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/math/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/misc/.cvsignore b/misc/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/misc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/misc/.gitignore b/misc/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/misc/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/po/.cvsignore b/po/.cvsignore deleted file mode 100644 index 37752e3b33..0000000000 --- a/po/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.mo -libc.pot.files diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000000..37752e3b33 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,2 @@ +*.mo +libc.pot.files diff --git a/posix/.cvsignore b/posix/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/posix/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/posix/.gitignore b/posix/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/posix/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/pwd/.cvsignore b/pwd/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/pwd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/pwd/.gitignore b/pwd/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/pwd/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/resolv/.cvsignore b/resolv/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/resolv/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/resolv/.gitignore b/resolv/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/resolv/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/resource/.cvsignore b/resource/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/resource/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/resource/.gitignore b/resource/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/resource/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/setjmp/.cvsignore b/setjmp/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/setjmp/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/setjmp/.gitignore b/setjmp/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/setjmp/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/signal/.cvsignore b/signal/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/signal/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/signal/.gitignore b/signal/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/signal/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/socket/.cvsignore b/socket/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/socket/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/socket/.gitignore b/socket/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/socket/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/stdio-common/.cvsignore b/stdio-common/.cvsignore deleted file mode 100644 index 602b74c1ae..0000000000 --- a/stdio-common/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* - -mpn-copy.mk -distinfo diff --git a/stdio-common/.gitignore b/stdio-common/.gitignore new file mode 100644 index 0000000000..602b74c1ae --- /dev/null +++ b/stdio-common/.gitignore @@ -0,0 +1,8 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* + +mpn-copy.mk +distinfo diff --git a/stdlib/.cvsignore b/stdlib/.cvsignore deleted file mode 100644 index 602b74c1ae..0000000000 --- a/stdlib/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* - -mpn-copy.mk -distinfo diff --git a/stdlib/.gitignore b/stdlib/.gitignore new file mode 100644 index 0000000000..602b74c1ae --- /dev/null +++ b/stdlib/.gitignore @@ -0,0 +1,8 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* + +mpn-copy.mk +distinfo diff --git a/string/.cvsignore b/string/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/string/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/string/.gitignore b/string/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/string/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/sunrpc/.cvsignore b/sunrpc/.cvsignore deleted file mode 100644 index b2e79b502b..0000000000 --- a/sunrpc/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* - -rpcsrc-4.0 -distinfo diff --git a/sunrpc/.gitignore b/sunrpc/.gitignore new file mode 100644 index 0000000000..b2e79b502b --- /dev/null +++ b/sunrpc/.gitignore @@ -0,0 +1,8 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* + +rpcsrc-4.0 +distinfo diff --git a/sysdeps/mach/hurd/.cvsignore b/sysdeps/mach/hurd/.cvsignore deleted file mode 100644 index 1f69fd919a..0000000000 --- a/sysdeps/mach/hurd/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* diff --git a/sysdeps/mach/hurd/.gitignore b/sysdeps/mach/hurd/.gitignore new file mode 100644 index 0000000000..1f69fd919a --- /dev/null +++ b/sysdeps/mach/hurd/.gitignore @@ -0,0 +1,4 @@ +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* diff --git a/sysdeps/unix/common/.cvsignore b/sysdeps/unix/common/.cvsignore deleted file mode 100644 index 1f69fd919a..0000000000 --- a/sysdeps/unix/common/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* diff --git a/sysdeps/unix/common/.gitignore b/sysdeps/unix/common/.gitignore new file mode 100644 index 0000000000..1f69fd919a --- /dev/null +++ b/sysdeps/unix/common/.gitignore @@ -0,0 +1,4 @@ +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* diff --git a/sysvipc/.cvsignore b/sysvipc/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/sysvipc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/sysvipc/.gitignore b/sysvipc/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/sysvipc/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/termios/.cvsignore b/termios/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/termios/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/termios/.gitignore b/termios/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/termios/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/time/.cvsignore b/time/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/time/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/time/.gitignore b/time/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/time/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/wcsmbs/.cvsignore b/wcsmbs/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/wcsmbs/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/wcsmbs/.gitignore b/wcsmbs/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/wcsmbs/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo diff --git a/wctype/.cvsignore b/wctype/.cvsignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/wctype/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/wctype/.gitignore b/wctype/.gitignore new file mode 100644 index 0000000000..3fc9f4cdf1 --- /dev/null +++ b/wctype/.gitignore @@ -0,0 +1,6 @@ +*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* +distinfo -- cgit v1.2.3 From ff6ff38db28323c6de078614198c2d89e8e1df07 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 16 May 2009 10:18:34 +0200 Subject: Remove redundant .gitignore files. --- assert/.gitignore | 6 ------ ctype/.gitignore | 6 ------ dirent/.gitignore | 6 ------ elf/.gitignore | 6 ------ gmon/.gitignore | 6 ------ gnulib/.gitignore | 6 ------ grp/.gitignore | 6 ------ hurd/.gitignore | 6 ------ inet/.gitignore | 6 ------ intl/.gitignore | 6 ------ io/.gitignore | 6 ------ locale/.gitignore | 6 ------ mach/.gitignore | 6 ------ math/.gitignore | 6 ------ misc/.gitignore | 6 ------ posix/.gitignore | 6 ------ pwd/.gitignore | 6 ------ resolv/.gitignore | 6 ------ resource/.gitignore | 6 ------ setjmp/.gitignore | 6 ------ signal/.gitignore | 6 ------ socket/.gitignore | 6 ------ string/.gitignore | 6 ------ sysvipc/.gitignore | 6 ------ termios/.gitignore | 6 ------ time/.gitignore | 6 ------ wcsmbs/.gitignore | 6 ------ wctype/.gitignore | 6 ------ 28 files changed, 168 deletions(-) delete mode 100644 assert/.gitignore delete mode 100644 ctype/.gitignore delete mode 100644 dirent/.gitignore delete mode 100644 elf/.gitignore delete mode 100644 gmon/.gitignore delete mode 100644 gnulib/.gitignore delete mode 100644 grp/.gitignore delete mode 100644 hurd/.gitignore delete mode 100644 inet/.gitignore delete mode 100644 intl/.gitignore delete mode 100644 io/.gitignore delete mode 100644 locale/.gitignore delete mode 100644 mach/.gitignore delete mode 100644 math/.gitignore delete mode 100644 misc/.gitignore delete mode 100644 posix/.gitignore delete mode 100644 pwd/.gitignore delete mode 100644 resolv/.gitignore delete mode 100644 resource/.gitignore delete mode 100644 setjmp/.gitignore delete mode 100644 signal/.gitignore delete mode 100644 socket/.gitignore delete mode 100644 string/.gitignore delete mode 100644 sysvipc/.gitignore delete mode 100644 termios/.gitignore delete mode 100644 time/.gitignore delete mode 100644 wcsmbs/.gitignore delete mode 100644 wctype/.gitignore (limited to 'elf') diff --git a/assert/.gitignore b/assert/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/assert/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/ctype/.gitignore b/ctype/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/ctype/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/dirent/.gitignore b/dirent/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/dirent/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/elf/.gitignore b/elf/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/elf/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/gmon/.gitignore b/gmon/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/gmon/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/gnulib/.gitignore b/gnulib/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/gnulib/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/grp/.gitignore b/grp/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/grp/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/hurd/.gitignore b/hurd/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/hurd/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/inet/.gitignore b/inet/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/inet/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/intl/.gitignore b/intl/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/intl/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/io/.gitignore b/io/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/io/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/locale/.gitignore b/locale/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/locale/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/mach/.gitignore b/mach/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/mach/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/math/.gitignore b/math/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/math/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/misc/.gitignore b/misc/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/misc/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/posix/.gitignore b/posix/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/posix/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/pwd/.gitignore b/pwd/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/pwd/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/resolv/.gitignore b/resolv/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/resolv/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/resource/.gitignore b/resource/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/resource/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/setjmp/.gitignore b/setjmp/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/setjmp/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/signal/.gitignore b/signal/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/signal/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/socket/.gitignore b/socket/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/socket/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/string/.gitignore b/string/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/string/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/sysvipc/.gitignore b/sysvipc/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/sysvipc/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/termios/.gitignore b/termios/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/termios/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/time/.gitignore b/time/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/time/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/wcsmbs/.gitignore b/wcsmbs/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/wcsmbs/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo diff --git a/wctype/.gitignore b/wctype/.gitignore deleted file mode 100644 index 3fc9f4cdf1..0000000000 --- a/wctype/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps -*.gz *.Z *.tar *.tgz -=* -TODO COPYING* AUTHORS copyr-* copying.* -glibc-* -distinfo -- cgit v1.2.3 From 74414708355a922a514d5c76183eca6931c4488a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 31 May 2009 23:45:33 -0700 Subject: Finish IFUNC support for x86 and x86-64. Add support for the IRELAIVE relocation and IFUNC in static executables. --- ChangeLog | 27 +++++++++++++++++++++++++++ csu/elf-init.c | 30 ++++++++++++++++++++++++++++++ elf/elf.h | 6 ++++-- include/libc-symbols.h | 17 +++++++++++++++++ sysdeps/generic/dl-irel.h | 23 +++++++++++++++++++++++ sysdeps/i386/dl-irel.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ sysdeps/i386/dl-machine.h | 24 ++++++++++++++++++++++++ sysdeps/x86_64/dl-irel.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ sysdeps/x86_64/dl-machine.h | 12 ++++++++++++ 9 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 sysdeps/generic/dl-irel.h create mode 100644 sysdeps/i386/dl-irel.h create mode 100644 sysdeps/x86_64/dl-irel.h (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 1de4c0dd4f..65a9fb7b55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2009-05-29 H.J. Lu + + * csu/elf-init.c: Include and if LIBC_NONSHARED + is not defined. + (__rela_iplt_start): New declaration. + (__rela_iplt_end): Likewise. + (__rel_iplt_start): Likewise. + (__rel_iplt_end): Likewise. + (__libc_csu_init): Process __rela_iplt_start and __rel_iplt_start. + * elf/elf.h (R_386_IRELATIVE): New macro. + (R_X86_64_IRELATIVE): New macro. + (R_386_NUM): Updated. + (R_X86_64_NUM): Likewise. + * include/libc-symbols.h (libc_ifunc_hidden_def1): New macro. + (libc_ifunc_hidden_def): New macro. + * sysdeps/generic/dl-irel.h: New file. + * sysdeps/i386/dl-irel.h: New file. + * sysdeps/x86_64/dl-irel.h: New file. + * sysdeps/i386/dl-machine.h (elf_machine_rel): Handle R_386_IRELATIVE. + (elf_machine_rela): Check SHN_UNDEF for STT_GNU_IFUNC symbol. + Handle R_386_IRELATIVE. + (elf_machine_lazy_rel): Handle R_386_IRELATIVE. + (elf_machine_lazy_rela): Likewise. + * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Handle + R_X86_64_IRELATIVE. + (elf_machine_lazy_rel): Handle R_X86_64_IRELATIVE. + 2009-05-31 Ulrich Drepper * sysdeps/x86_64/multiarch/init-arch.h: Define COMMON_CPUID_INDEX_1 diff --git a/csu/elf-init.c b/csu/elf-init.c index 27eae1550b..5a99a3a400 100644 --- a/csu/elf-init.c +++ b/csu/elf-init.c @@ -36,6 +36,20 @@ #include +#ifndef LIBC_NONSHARED +# include +# include + +# ifdef ELF_MACHINE_IRELA +extern const ElfW(Rela) __rela_iplt_start []; +extern const ElfW(Rela) __rela_iplt_end []; +# endif + +# ifdef ELF_MACHINE_IREL +extern const ElfW(Rel) __rel_iplt_start []; +extern const ElfW(Rel) __rel_iplt_end []; +# endif +#endif /* LIBC_NONSHARED */ /* These magic symbols are provided by the linker. */ extern void (*__preinit_array_start []) (int, char **, char **) @@ -67,6 +81,22 @@ __libc_csu_init (int argc, char **argv, char **envp) the dynamic linker (before initializing any shared object. */ #ifndef LIBC_NONSHARED +# ifdef ELF_MACHINE_IRELA + { + const size_t size = __rela_iplt_end - __rela_iplt_start; + for (size_t i = 0; i < size; i++) + elf_irela (&__rela_iplt_start [i]); + } +# endif + +# ifdef ELF_MACHINE_IREL + { + const size_t size = __rel_iplt_end - __rel_iplt_start; + for (size_t i = 0; i < size; i++) + elf_irel (&__rel_iplt_start [i]); + } +# endif + /* For static executables, preinit happens rights before init. */ { const size_t size = __preinit_array_end - __preinit_array_start; diff --git a/elf/elf.h b/elf/elf.h index 062ef00f57..8fdf74b099 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -1177,8 +1177,9 @@ typedef struct pointer to code and to argument, returning the TLS offset for the symbol. */ +#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ /* Keep this the last entry. */ -#define R_386_NUM 42 +#define R_386_NUM 43 /* SUN SPARC specific definitions. */ @@ -2625,8 +2626,9 @@ typedef Elf32_Addr Elf32_Conflict; #define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS descriptor. */ #define R_X86_64_TLSDESC 36 /* TLS descriptor. */ +#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -#define R_X86_64_NUM 37 +#define R_X86_64_NUM 38 /* AM33 relocations. */ diff --git a/include/libc-symbols.h b/include/libc-symbols.h index d53bcb9b77..68da77c58e 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -845,4 +845,21 @@ for linking") } \ __asm__ (".type " #name ", %gnu_indirect_function"); +#ifdef HAVE_ASM_SET_DIRECTIVE +# define libc_ifunc_hidden_def1(local, name) \ + __asm__ (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE) \ + " " #local "\n\t" \ + ".hidden " #local "\n\t" \ + ".set " #local ", " #name); +#else +# define libc_ifunc_hidden_def1(local, name) \ + __asm__ (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE) \ + " " #local "\n\t" \ + ".hidden " #local "\n\t" \ + #local " = " #name); +#endif + +#define libc_ifunc_hidden_def(name) \ + libc_ifunc_hidden_def1 (__GI_##name, name) + #endif /* libc-symbols.h */ diff --git a/sysdeps/generic/dl-irel.h b/sysdeps/generic/dl-irel.h new file mode 100644 index 0000000000..4d7b481e81 --- /dev/null +++ b/sysdeps/generic/dl-irel.h @@ -0,0 +1,23 @@ +/* Machine-dependent ELF indirect relocation inline functions. + Copyright (C) 2009 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DL_IREL_h +#define _DL_IREL_H + +#endif /* dl-irel.h */ diff --git a/sysdeps/i386/dl-irel.h b/sysdeps/i386/dl-irel.h new file mode 100644 index 0000000000..4acb862c69 --- /dev/null +++ b/sysdeps/i386/dl-irel.h @@ -0,0 +1,44 @@ +/* Machine-dependent ELF indirect relocation inline functions. + i386 version. + Copyright (C) 2009 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DL_IREL_H +#define _DL_IREL_H + +#include + +#define ELF_MACHINE_IREL 1 + +static inline void +__attribute ((always_inline)) +elf_irel (const Elf32_Rel *reloc) +{ + Elf32_Addr *const reloc_addr = (void *) reloc->r_offset; + const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info); + + if (__builtin_expect (r_type == R_386_IRELATIVE, 1)) + { + Elf64_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) (); + *reloc_addr = value; + } + else + _exit (-1); +} + +#endif /* dl-irel.h */ diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 0e15878d4e..efa929e57f 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -345,6 +345,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; if (sym != NULL + && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)) value = ((Elf32_Addr (*) (void)) value) (); @@ -471,6 +472,11 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, memcpy (reloc_addr_arg, (void *) value, MIN (sym->st_size, refsym->st_size)); break; + case R_386_IRELATIVE: + value = map->l_addr + *reloc_addr; + value = ((Elf32_Addr (*) (void)) value) (); + *reloc_addr = value; + break; default: _dl_reloc_bad_type (map, r_type, 0); break; @@ -500,6 +506,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; if (sym != NULL + && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)) value = ((Elf32_Addr (*) (void)) value) (); @@ -609,6 +616,11 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, MIN (sym->st_size, refsym->st_size)); break; # endif /* !RESOLVE_CONFLICT_FIND_MAP */ + case R_386_IRELATIVE: + value = map->l_addr + reloc->r_addend; + value = ((Elf32_Addr (*) (void)) value) (); + *reloc_addr = value; + break; default: /* We add these checks in the version to relocate ld.so only if we are still debugging. */ @@ -703,6 +715,12 @@ elf_machine_lazy_rel (struct link_map *map, # endif } } + else if (__builtin_expect (r_type == R_386_IRELATIVE, 0)) + { + Elf32_Addr value = map->l_addr + *reloc_addr; + value = ((Elf32_Addr (*) (void)) value) (); + *reloc_addr = value; + } else _dl_reloc_bad_type (map, r_type, 1); } @@ -726,6 +744,12 @@ elf_machine_lazy_rela (struct link_map *map, td->arg = (void*)reloc; td->entry = _dl_tlsdesc_resolve_rela; } + else if (__builtin_expect (r_type == R_386_IRELATIVE, 0)) + { + Elf32_Addr value = map->l_addr + reloc->r_addend; + value = ((Elf32_Addr (*) (void)) value) (); + *reloc_addr = value; + } else _dl_reloc_bad_type (map, r_type, 1); } diff --git a/sysdeps/x86_64/dl-irel.h b/sysdeps/x86_64/dl-irel.h new file mode 100644 index 0000000000..442ab71d26 --- /dev/null +++ b/sysdeps/x86_64/dl-irel.h @@ -0,0 +1,44 @@ +/* Machine-dependent ELF indirect relocation inline functions. + x86-64 version. + Copyright (C) 2009 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DL_IREL_H +#define _DL_IREL_H + +#include + +#define ELF_MACHINE_IRELA 1 + +static inline void +__attribute ((always_inline)) +elf_irela (const Elf64_Rela *reloc) +{ + Elf64_Addr *const reloc_addr = (void *) reloc->r_offset; + const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); + + if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1)) + { + Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) (); + *reloc_addr = value; + } + else + _exit (-1); +} + +#endif /* dl-irel.h */ diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 4444ae0a71..1b5ce8e981 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -297,6 +297,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, : (Elf64_Addr) sym_map->l_addr + sym->st_value); if (sym != NULL + && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)) value = ((Elf64_Addr (*) (void)) value) (); @@ -442,6 +443,11 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } break; # endif + case R_X86_64_IRELATIVE: + value = map->l_addr + reloc->r_addend; + value = ((Elf64_Addr (*) (void)) value) (); + *reloc_addr = value; + break; default: _dl_reloc_bad_type (map, r_type, 0); break; @@ -488,6 +494,12 @@ elf_machine_lazy_rel (struct link_map *map, td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + map->l_addr); } + else if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 0)) + { + Elf64_Addr value = map->l_addr + reloc->r_addend; + value = ((Elf64_Addr (*) (void)) value) (); + *reloc_addr = value; + } else _dl_reloc_bad_type (map, r_type, 1); } -- cgit v1.2.3 From fbb04b35e7997070feec74e0fd46953faef71f9e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 3 Jun 2009 08:30:35 -0700 Subject: Terminate correct buffer. Little typo could cause additional characters to be printed. --- ChangeLog | 4 ++++ elf/dl-sysdep.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 7d30b3a15c..5e98327e14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-06-03 Ulrich Drepper + + * elf/dl-sysdep.c (_dl_show_auxv): Terminate correct string. + 2009-06-02 Ulrich Drepper [BZ #10221] diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index db1001253c..5700272f10 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -335,7 +335,7 @@ _dl_show_auxv (void) /* Unknown value: print a generic line. */ char buf2[17]; - buf[sizeof (buf2) - 1] = '\0'; + buf2[sizeof (buf2) - 1] = '\0'; const char *val2 = _itoa ((unsigned long int) av->a_un.a_val, buf2 + sizeof buf2 - 1, 16, 0); const char *val = _itoa ((unsigned long int) av->a_type, -- cgit v1.2.3 From 2f083d7511460b3beea2df165c3e43742f73f3c9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 3 Jun 2009 16:21:40 -0700 Subject: Test for ELF IFUNC functionality. --- ChangeLog | 46 ++++++++++++++++++ elf/Makefile | 94 +++++++++++++++++++++++++++++++++++- elf/ifuncdep1.c | 3 ++ elf/ifuncdep1pic.c | 3 ++ elf/ifuncdep2.c | 72 ++++++++++++++++++++++++++++ elf/ifuncdep2pic.c | 3 ++ elf/ifuncmain1.c | 66 +++++++++++++++++++++++++ elf/ifuncmain1pic.c | 3 ++ elf/ifuncmain1picstatic.c | 3 ++ elf/ifuncmain1pie.c | 3 ++ elf/ifuncmain1static.c | 3 ++ elf/ifuncmain1staticpic.c | 3 ++ elf/ifuncmain1vis.c | 89 ++++++++++++++++++++++++++++++++++ elf/ifuncmain1vispic.c | 3 ++ elf/ifuncmain1vispie.c | 3 ++ elf/ifuncmain2.c | 16 +++++++ elf/ifuncmain2pic.c | 3 ++ elf/ifuncmain2picstatic.c | 3 ++ elf/ifuncmain2static.c | 3 ++ elf/ifuncmain3.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++ elf/ifuncmain4.c | 4 ++ elf/ifuncmain4picstatic.c | 3 ++ elf/ifuncmain4static.c | 3 ++ elf/ifuncmod1.c | 114 +++++++++++++++++++++++++++++++++++++++++++ elf/ifuncmod3.c | 8 ++++ 25 files changed, 673 insertions(+), 1 deletion(-) create mode 100644 elf/ifuncdep1.c create mode 100644 elf/ifuncdep1pic.c create mode 100644 elf/ifuncdep2.c create mode 100644 elf/ifuncdep2pic.c create mode 100644 elf/ifuncmain1.c create mode 100644 elf/ifuncmain1pic.c create mode 100644 elf/ifuncmain1picstatic.c create mode 100644 elf/ifuncmain1pie.c create mode 100644 elf/ifuncmain1static.c create mode 100644 elf/ifuncmain1staticpic.c create mode 100644 elf/ifuncmain1vis.c create mode 100644 elf/ifuncmain1vispic.c create mode 100644 elf/ifuncmain1vispie.c create mode 100644 elf/ifuncmain2.c create mode 100644 elf/ifuncmain2pic.c create mode 100644 elf/ifuncmain2picstatic.c create mode 100644 elf/ifuncmain2static.c create mode 100644 elf/ifuncmain3.c create mode 100644 elf/ifuncmain4.c create mode 100644 elf/ifuncmain4picstatic.c create mode 100644 elf/ifuncmain4static.c create mode 100644 elf/ifuncmod1.c create mode 100644 elf/ifuncmod3.c (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 5e98327e14..72910ce610 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,49 @@ +2009-06-02 H.J. Lu + + * elf/Makefile (distribute): Add ifuncmain1.c, ifuncmain1pic.c, + ifuncmain1vis.c, ifuncmain1vispic.c, ifuncmain1static.c, + ifuncmain1staticpic.c, ifuncmain1picstatic.c, ifuncdep1.c, + ifuncdep1pic.c, ifuncmod1.c, ifuncmain1pie.c, ifuncmain1vispie.c, + ifuncmain2.c, ifuncmain2static.c, ifuncdep2.c, + funcmain2pic.c, ifuncmain2picstatic.c, ifuncdep2pic.c, + ifuncmain3.c, ifuncmod3.c,. + ifuncmain4.c, ifuncmain4static.c, ifuncmain4picstatic.c. + (tests-static): Add ifuncmain1static, ifuncmain1picstatic, + ifuncmain2static, ifuncmain2picstatic, ifuncmain4static, + ifuncmain4picstatic. + (tests): Add ifuncmain1, ifuncmain1pic, ifuncmain1vis, + ifuncmain1vispic, ifuncmain1staticpic, ifuncmain2, ifuncmain2pic, + ifuncmain3, ifuncmain4. + (tests): Depend on $(objpfx)ifuncmain1pie.out and + $(objpfx)ifuncmain1vispie.out. + (modules-names): Add ifuncmod1 ifuncmod3. + (generated): Add ifuncmain1pie ifuncmain1pie.out + ifuncmain1vispie ifuncmain1vispie.out. + Define rules to build and run the tests. + * elf/ifuncdep1.c: New file. + * elf/ifuncdep1pic.c: New file. + * elf/ifuncdep2.c: New file. + * elf/ifuncdep2pic.c: New file. + * elf/ifuncmain1.c: New file. + * elf/ifuncmain1pic.c: New file. + * elf/ifuncmain1picstatic.c: New file. + * elf/ifuncmain1pie.c: New file. + * elf/ifuncmain1static.c: New file. + * elf/ifuncmain1staticpic.c: New file. + * elf/ifuncmain1vis.c: New file.. + * elf/ifuncmain1vispic.c: New file.. + * elf/ifuncmain1vispie.c: New file. + * elf/ifuncmain2.c: New file. + * elf/ifuncmain2pic.c: New file. + * elf/ifuncmain2picstatic.c: New file. + * elf/ifuncmain2static.c: New file. + * elf/ifuncmain3.c: New file. + * elf/ifuncmain4.c: New file. + * elf/ifuncmain4picstatic.c: New file. + * elf/ifuncmain4static.c: New file. + * elf/ifuncmod1.c: New file. + * elf/ifuncmod3.c: New file. + 2009-06-03 Ulrich Drepper * elf/dl-sysdep.c (_dl_show_auxv): Terminate correct string. diff --git a/elf/Makefile b/elf/Makefile index 94b9d069bf..6bcbb5142f 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -93,7 +93,16 @@ distribute := rtld-Rules \ order2mod1.c order2mod2.c order2mod3.c order2mod4.c \ tst-stackguard1.c tst-stackguard1-static.c \ tst-array5.c tst-array5-static.c tst-array5dep.c \ - tst-array5.exp tst-leaks1.c check-execstack.c + tst-array5.exp tst-leaks1.c check-execstack.c \ + ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \ + ifuncmain1vispic.c ifuncmain1static.c \ + ifuncmain1staticpic.c ifuncmain1picstatic.c \ + ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \ + ifuncmain1pie.c ifuncmain1vispie.c \ + ifuncmain2.c ifuncmain2static.c ifuncdep2.c \ + ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \ + ifuncmain3.c ifuncmod3.c \ + ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables @@ -232,6 +241,22 @@ test-extras += $(modules-names) # filtmod1.so has a special rule modules-names-nobuild := filtmod1 +ifeq (yes,$(multi-arch)) +tests-static += ifuncmain1static ifuncmain1picstatic \ + ifuncmain2static ifuncmain2picstatic \ + ifuncmain4static ifuncmain4picstatic + +ifeq (yes,$(build-shared)) +tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ + ifuncmain1staticpic \ + ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 +ifeq (yes,$(have-fpie)) +tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out +endif +modules-names += ifuncmod1 ifuncmod3 +endif +endif + include ../Rules @@ -504,6 +529,7 @@ reldep8mod2.so-no-z-defs = yes reldep9mod1.so-no-z-defs = yes unload3mod4.so-no-z-defs = yes unload4mod1.so-no-z-defs = yes +ifuncmod1.so-no-z-defs = yes ifeq ($(build-shared),yes) # Build all the modules even when not actually running test programs. @@ -951,3 +977,69 @@ tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace $(objpfx)tst-addr1: $(libdl) $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library) + +CFLAGS-ifuncmain1pic.c += $(pic-ccflag) +CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag) +CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag) +CFLAGS-ifuncdep1pic.c += $(pic-ccflag) +CFLAGS-ifuncmain1vispic.c += $(pic-ccflag) +CFLAGS-ifuncmain2pic.c += $(pic-ccflag) +CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag) +CFLAGS-ifuncdep2pic.c += $(pic-ccflag) +CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag) + +LDFLAGS-ifuncmain3 = -Wl,-export-dynamic + +ifeq (yesyes,$(have-fpie)$(build-shared)) +CFLAGS-ifuncmain1pie.c += $(pie-ccflag) +CFLAGS-ifuncmain1vispie.c += $(pie-ccflag) + +$(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie + $(elf-objpfx)$(rtld-installed-name) \ + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ + $< > $@ + +$(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so + $(LINK.o) -pie -Wl,-O1 \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ + $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \ + $(LDFLAGS) $(LDFLAGS-$(@F)) \ + -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \ + -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \ + $(common-objpfx)libc_nonshared.a + +generated += ifuncmain1pie ifuncmain1pie.out + +$(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie + $(elf-objpfx)$(rtld-installed-name) \ + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ + $< > $@ + +$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so + $(LINK.o) -pie -Wl,-O1 \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ + $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \ + $(LDFLAGS) $(LDFLAGS-$(@F)) \ + -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \ + -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \ + $(common-objpfx)libc_nonshared.a + +generated += ifuncmain1vispie ifuncmain1vispie.out +endif + +$(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so) +$(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so) +$(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o) +$(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o) +$(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o) +$(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so) +$(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so) +$(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o) +$(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o) +$(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o) +$(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o) + +$(objpfx)ifuncmain3: $(libdl) +$(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so diff --git a/elf/ifuncdep1.c b/elf/ifuncdep1.c new file mode 100644 index 0000000000..77d663dcec --- /dev/null +++ b/elf/ifuncdep1.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols without -fPIC. */ + +#include "ifuncmod1.c" diff --git a/elf/ifuncdep1pic.c b/elf/ifuncdep1pic.c new file mode 100644 index 0000000000..b6381e4868 --- /dev/null +++ b/elf/ifuncdep1pic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC. */ + +#include "ifuncmod1.c" diff --git a/elf/ifuncdep2.c b/elf/ifuncdep2.c new file mode 100644 index 0000000000..fb21eef5cb --- /dev/null +++ b/elf/ifuncdep2.c @@ -0,0 +1,72 @@ +/* Test 3 STT_GNU_IFUNC symbols. */ + +extern int global; + +static int +one (void) +{ + return 1; +} + +static int +minus_one (void) +{ + return -1; +} + +static int +zero (void) +{ + return 0; +} + +void * foo1_ifunc (void) __asm__ ("foo1"); +__asm__(".type foo1, %gnu_indirect_function"); + +void * +foo1_ifunc (void) +{ + switch (global) + { + case 1: + return one; + case -1: + return minus_one; + default: + return zero; + } +} + +void * foo2_ifunc (void) __asm__ ("foo2"); +__asm__(".type foo2, %gnu_indirect_function"); + +void * +foo2_ifunc (void) +{ + switch (global) + { + case 1: + return minus_one; + case -1: + return one; + default: + return zero; + } +} + +void * foo3_ifunc (void) __asm__ ("foo3"); +__asm__(".type foo3, %gnu_indirect_function"); + +void * +foo3_ifunc (void) +{ + switch (global) + { + case 1: + return one; + case -1: + return zero; + default: + return minus_one; + } +} diff --git a/elf/ifuncdep2pic.c b/elf/ifuncdep2pic.c new file mode 100644 index 0000000000..a84253dbc4 --- /dev/null +++ b/elf/ifuncdep2pic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC. */ + +#include "ifuncdep2.c" diff --git a/elf/ifuncmain1.c b/elf/ifuncmain1.c new file mode 100644 index 0000000000..de7ffe8779 --- /dev/null +++ b/elf/ifuncmain1.c @@ -0,0 +1,66 @@ +/* Test STT_GNU_IFUNC symbols: + + 1. Direct function call. + 2. Function pointer. + 3. Visibility without override. + */ + +#include + +int global = -1; + +int ret_foo; +int ret_foo_hidden; +int ret_foo_protected; + +extern int foo (void); +extern int foo_protected (void); + +#ifndef FOO_P +typedef int (*foo_p) (void); +#endif + +foo_p foo_ptr = foo; +foo_p foo_procted_ptr = foo_protected; + +extern foo_p get_foo_p (void); +extern foo_p get_foo_hidden_p (void); +extern foo_p get_foo_protected_p (void); + +int +main (void) +{ + foo_p p; + + if (foo_ptr != foo) + abort (); + if (foo () != -1) + abort (); + if ((*foo_ptr) () != -1) + abort (); + + if (foo_procted_ptr != foo_protected) + abort (); + if (foo_protected () != 0) + abort (); + if ((*foo_procted_ptr) () != 0) + abort (); + + p = get_foo_p (); + if (p != foo) + abort (); + if (ret_foo != -1 || (*p) () != ret_foo) + abort (); + + p = get_foo_hidden_p (); + if (ret_foo_hidden != 1 || (*p) () != ret_foo_hidden) + abort (); + + p = get_foo_protected_p (); + if (p != foo_protected) + abort (); + if (ret_foo_protected != 0 || (*p) () != ret_foo_protected) + abort (); + + return 0; +} diff --git a/elf/ifuncmain1pic.c b/elf/ifuncmain1pic.c new file mode 100644 index 0000000000..db19dc9678 --- /dev/null +++ b/elf/ifuncmain1pic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC. */ + +#include "ifuncmain1.c" diff --git a/elf/ifuncmain1picstatic.c b/elf/ifuncmain1picstatic.c new file mode 100644 index 0000000000..c937933029 --- /dev/null +++ b/elf/ifuncmain1picstatic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */ + +#include "ifuncmain1.c" diff --git a/elf/ifuncmain1pie.c b/elf/ifuncmain1pie.c new file mode 100644 index 0000000000..c16ef6dd09 --- /dev/null +++ b/elf/ifuncmain1pie.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with PIE. */ + +#include "ifuncmain1.c" diff --git a/elf/ifuncmain1static.c b/elf/ifuncmain1static.c new file mode 100644 index 0000000000..fdd1e09024 --- /dev/null +++ b/elf/ifuncmain1static.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -static. */ + +#include "ifuncmain1.c" diff --git a/elf/ifuncmain1staticpic.c b/elf/ifuncmain1staticpic.c new file mode 100644 index 0000000000..39e0cbb4b8 --- /dev/null +++ b/elf/ifuncmain1staticpic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC and no DSO. */ + +#include "ifuncmain1.c" diff --git a/elf/ifuncmain1vis.c b/elf/ifuncmain1vis.c new file mode 100644 index 0000000000..a239d2dd0d --- /dev/null +++ b/elf/ifuncmain1vis.c @@ -0,0 +1,89 @@ +/* Test STT_GNU_IFUNC symbols: + + 1. Direct function call. + 2. Function pointer. + 3. Visibility with override. + */ + +#include + +int global = -1; + +int ret_foo; +int ret_foo_hidden; +int ret_foo_protected; + +extern int foo (void); +extern int foo_protected (void); + +#ifndef FOO_P +typedef int (*foo_p) (void); +#endif + +foo_p foo_ptr = foo; +foo_p foo_procted_ptr = foo_protected; + +extern foo_p get_foo_p (void); +extern foo_p get_foo_hidden_p (void); +extern foo_p get_foo_protected_p (void); + +int +__attribute__ ((noinline)) +foo (void) +{ + return -30; +} + +int +__attribute__ ((noinline)) +foo_hidden (void) +{ + return -20; +} + +int +__attribute__ ((noinline)) +foo_protected (void) +{ + return -40; +} + +int +main (void) +{ + foo_p p; + + if (foo_ptr != foo) + abort (); + if ((*foo_ptr) () != -30) + abort (); + + if (foo_procted_ptr != foo_protected) + abort (); + if ((*foo_procted_ptr) () != -40) + abort (); + + p = get_foo_p (); + if (p != foo) + abort (); + if (foo () != -30) + abort (); + if (ret_foo != -30 || (*p) () != ret_foo) + abort (); + + p = get_foo_hidden_p (); + if (foo_hidden () != -20) + abort (); + if (ret_foo_hidden != 1 || (*p) () != ret_foo_hidden) + abort (); + + p = get_foo_protected_p (); + if (p == foo_protected) + abort (); + if (foo_protected () != -40) + abort (); + if (ret_foo_protected != 0 || (*p) () != ret_foo_protected) + abort (); + + return 0; +} diff --git a/elf/ifuncmain1vispic.c b/elf/ifuncmain1vispic.c new file mode 100644 index 0000000000..f8c104d560 --- /dev/null +++ b/elf/ifuncmain1vispic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC. */ + +#include "ifuncmain1vis.c" diff --git a/elf/ifuncmain1vispie.c b/elf/ifuncmain1vispie.c new file mode 100644 index 0000000000..ad06d2ba1c --- /dev/null +++ b/elf/ifuncmain1vispie.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with PIE. */ + +#include "ifuncmain1vis.c" diff --git a/elf/ifuncmain2.c b/elf/ifuncmain2.c new file mode 100644 index 0000000000..cd9b2c8352 --- /dev/null +++ b/elf/ifuncmain2.c @@ -0,0 +1,16 @@ +/* Test calling one STT_GNU_IFUNC function with 3 different + STT_GNU_IFUNC definitions. */ + +#include + +int global = -1; + +extern int foo1 (void); + +int +main (void) +{ + if (foo1 () != -1) + abort (); + return 0; +} diff --git a/elf/ifuncmain2pic.c b/elf/ifuncmain2pic.c new file mode 100644 index 0000000000..0006012a96 --- /dev/null +++ b/elf/ifuncmain2pic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC. */ + +#include "ifuncmain2.c" diff --git a/elf/ifuncmain2picstatic.c b/elf/ifuncmain2picstatic.c new file mode 100644 index 0000000000..3e89db536d --- /dev/null +++ b/elf/ifuncmain2picstatic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */ + +#include "ifuncmain2.c" diff --git a/elf/ifuncmain2static.c b/elf/ifuncmain2static.c new file mode 100644 index 0000000000..6932ae8066 --- /dev/null +++ b/elf/ifuncmain2static.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -static. */ + +#include "ifuncmain2.c" diff --git a/elf/ifuncmain3.c b/elf/ifuncmain3.c new file mode 100644 index 0000000000..5d067cced9 --- /dev/null +++ b/elf/ifuncmain3.c @@ -0,0 +1,120 @@ +/* Test STT_GNU_IFUNC symbols with dlopen: + + 1. Direct function call. + 2. Function pointer. + 3. Visibility with override. + */ + +#include +#include +#include + +typedef int (*foo_p) (void); + +int +__attribute__ ((noinline)) +foo (void) +{ + return -30; +} + +int +__attribute__ ((noinline)) +foo_hidden (void) +{ + return -20; +} + +int +__attribute__ ((noinline)) +foo_protected (void) +{ + return -40; +} + +int +main (void) +{ + foo_p p; + foo_p (*f) (void); + int *ret; + + void *h = dlopen ("ifuncmod3.so", RTLD_LAZY); + if (h == NULL) + { + printf ("cannot load: %s\n", dlerror ()); + return 1; + } + + f = dlsym (h, "get_foo_p"); + if (f == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + ret = dlsym (h, "ret_foo"); + if (ret == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + p = (*f) (); + if (p != foo) + abort (); + if (foo () != -30) + abort (); + if (*ret != -30 || (*p) () != *ret) + abort (); + + f = dlsym (h, "get_foo_hidden_p"); + if (f == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + ret = dlsym (h, "ret_foo_hidden"); + if (ret == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + p = (*f) (); + if (foo_hidden () != -20) + abort (); + if (*ret != 1 || (*p) () != *ret) + abort (); + + f = dlsym (h, "get_foo_protected_p"); + if (f == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + ret = dlsym (h, "ret_foo_protected"); + if (ret == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + p = (*f) (); + if (p == foo_protected) + abort (); + if (foo_protected () != -40) + abort (); + if (*ret != 0 || (*p) () != *ret) + abort (); + + if (dlclose (h) != 0) + { + printf ("cannot close: %s\n", dlerror ()); + return 1; + } + + return 0; +} diff --git a/elf/ifuncmain4.c b/elf/ifuncmain4.c new file mode 100644 index 0000000000..e55fee2eb3 --- /dev/null +++ b/elf/ifuncmain4.c @@ -0,0 +1,4 @@ +/* Test STT_GNU_IFUNC symbols in a single source file. */ + +#include "ifuncmod1.c" +#include "ifuncmain1.c" diff --git a/elf/ifuncmain4picstatic.c b/elf/ifuncmain4picstatic.c new file mode 100644 index 0000000000..977d7f97fc --- /dev/null +++ b/elf/ifuncmain4picstatic.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */ + +#include "ifuncmain4.c" diff --git a/elf/ifuncmain4static.c b/elf/ifuncmain4static.c new file mode 100644 index 0000000000..c399977013 --- /dev/null +++ b/elf/ifuncmain4static.c @@ -0,0 +1,3 @@ +/* Test STT_GNU_IFUNC symbols with -static. */ + +#include "ifuncmain4.c" diff --git a/elf/ifuncmod1.c b/elf/ifuncmod1.c new file mode 100644 index 0000000000..a1697b596d --- /dev/null +++ b/elf/ifuncmod1.c @@ -0,0 +1,114 @@ +/* Test STT_GNU_IFUNC symbols: + + 1. Direct function call. + 2. Function pointer. + 3. Visibility. + */ + +extern int global; + +static int +one (void) +{ + return 1; +} + +static int +minus_one (void) +{ + return -1; +} + +static int +zero (void) +{ + return 0; +} + +void * foo_ifunc (void) __asm__ ("foo"); +__asm__(".type foo, %gnu_indirect_function"); + +void * +foo_ifunc (void) +{ + switch (global) + { + case 1: + return one; + case -1: + return minus_one; + default: + return zero; + } +} + +void * foo_hidden_ifunc (void) __asm__ ("foo_hidden"); +__asm__(".type foo_hidden, %gnu_indirect_function"); + +void * +foo_hidden_ifunc (void) +{ + switch (global) + { + case 1: + return minus_one; + case -1: + return one; + default: + return zero; + } +} + +void * foo_protected_ifunc (void) __asm__ ("foo_protected"); +__asm__(".type foo_protected, %gnu_indirect_function"); + +void * +foo_protected_ifunc (void) +{ + switch (global) + { + case 1: + return one; + case -1: + return zero; + default: + return minus_one; + } +} + +/* Test hidden indirect function. */ +__asm__(".hidden foo_hidden"); + +/* Test protected indirect function. */ +__asm__(".protected foo_protected"); + +extern int foo (void); +extern int foo_hidden (void); +extern int foo_protected (void); +extern int ret_foo; +extern int ret_foo_hidden; +extern int ret_foo_protected; + +#define FOO_P +typedef int (*foo_p) (void); + +foo_p +get_foo_p (void) +{ + ret_foo = foo (); + return foo; +} + +foo_p +get_foo_hidden_p (void) +{ + ret_foo_hidden = foo_hidden (); + return foo_hidden; +} + +foo_p +get_foo_protected_p (void) +{ + ret_foo_protected = foo_protected (); + return foo_protected; +} diff --git a/elf/ifuncmod3.c b/elf/ifuncmod3.c new file mode 100644 index 0000000000..379d2c8d53 --- /dev/null +++ b/elf/ifuncmod3.c @@ -0,0 +1,8 @@ +/* Test STT_GNU_IFUNC symbols with dlopen. */ + +#include "ifuncmod1.c" + +int ret_foo; +int ret_foo_hidden; +int ret_foo_protected; +int global = -1; -- cgit v1.2.3