This is the mail archive of the
mailing list for the glibc project.
[PATCH 0/3] eliminate native-built programs for elf/ tests
- From: Roland McGrath <roland at hack dot frob dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 1 May 2012 10:39:42 -0700 (PDT)
- Subject: [PATCH 0/3] eliminate native-built programs for elf/ tests
As promised, I've revamped the three tests in elf/Makefile that relied on
native-built programs to instead be purely implemented with scripts
(running readelf and awk).
These changes are on the roland/check-via-readelf branch.
If nobody sees any problems, I'll merge the branch soon.
I tested that the tests pass in 'make check' on x86_64-linux-gnu and
i686-linux-gnu. I tested the various failure cases in the scripts by
hand-editing the files of readelf output and feeding them to the scripts
to verify they diagnosed the expected errors.
These are tailored fairly exactly to what the output from binutils
readelf looks like, so if it changes its output details in fairly slight
ways, they could break. I think binutils maintainers know that people
write scripts like this and avoid such changes, but if it comes up we
can make the scripts smarter/more-tolerant in the future.
I dropped the "segment is executable and writable" check entirely.
We could resurrect it reasonably easily if it seems worthwhile. I
don't think it was really adding much. Except on the machines where
the check was disabled because it's the normal case, I think all it
was really doing was essentially testing for linker bugs. The
TEXTREL marker check ought to be sufficient by itself in the absence
of linker bugs.
It would be good if someone could test this on powerpc64. That's the
only configuration that might test the case of no PT_GNU_STACK marker
being acceptable, because the platform default is nonexecutable
stack. But I have no idea if in fact the normal tool arrangements
omit the marker anyway (off hand it seems unlikely).
This now has one (new) awk script that emits the same output that the
old C program emitted, piped to another (existing) awk script that
compares that to the expected output. We could merge these into one
script. But leaving it as it is seemed a little nicer, if someone
wants to run localplt.awk by hand to see the output and/or use it to
populate the data file for a new configuration.
The script makes more assumptions than the old C program did. It's
possible these are false for some machine I'm not so familiar with.
If that's the case, I can soup up the script.
1. Assumes (and checks) that the DT_JMPREL address exactly matches
the sh_addr of some reloc section (but doesn't care about its name).
2. Assumes (and doesn't check) that reloc section contains only the
PLT entries, i.e. its size matches DT_PLTRELSZ.