-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remap symname [RT #94221] #20
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Store the symbol name along the IV ptr as SVp_POK PVX. This is needed for perlcc when thawing frozen images, where an encoding object was initialized at compile-time, pointing to an extern symbol of the shared library, and need to be remapped to the new ptr at run-time. See e.g. https://rt.cpan.org/Public/Bug/Display.html?id=94069 where Net::DNS uses an encoding via use constant, causing a segfault, and https://code.google.com/p/perl-compiler/issues/detail?id=305 for the perlcc support code. Which is something along: #include <dlfcn.h> void *handle = dlopen(sofile, RTLD_NOW|RTLD_NOLOAD); void *ascii_encoding = dlsym(handle, "ascii_encoding"); SvIV_set(&sv_list[1], PTR2IV(ascii_encoding)); Detection: https://github.com/rurban/perl-compiler/blob/ce6ce452dd8fcc9bb90605dcf47489250fd540a1/lib/B/C.pm#L2545 Remapping: https://github.com/rurban/perl-compiler/blob/ce6ce452dd8fcc9bb90605dcf47489250fd540a1/lib/B/C.pm#L4851
Tested ok on all major perl versions: $ perlall -mq maketest $ grep Result: log.test-linuxmint1-5.* log.test-linuxmint1-5.10.1d:Result: PASS log.test-linuxmint1-5.10.1-nt:Result: PASS log.test-linuxmint1-5.12.5:Result: PASS log.test-linuxmint1-5.12.5-nt:Result: PASS log.test-linuxmint1-5.14.4:Result: PASS log.test-linuxmint1-5.14.4-nt:Result: PASS log.test-linuxmint1-5.16.3:Result: PASS log.test-linuxmint1-5.16.3-nt:Result: PASS log.test-linuxmint1-5.18.2:Result: PASS log.test-linuxmint1-5.18.2-nt:Result: PASS log.test-linuxmint1-5.8.4d-nt:Result: PASS log.test-linuxmint1-5.8.5-nt:Result: PASS log.test-linuxmint1-5.8.8d-nt:Result: PASS log.test-linuxmint1-5.8.9:Result: PASS log.test-linuxmint1-5.8.9-nt:Result: PASS In particular it is safe not to use a heap copy of the PVX since it's a SVp_POK with LEN=0, which is never freed, thus freed along the shared library.
jsonn
pushed a commit
to jsonn/pkgsrc
that referenced
this pull request
Jul 16, 2014
2.62 2014/05/31 12:12:39 ! Encode.pm s/2013/2014/ on COPYRIGHT section ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode/Makefile_PL.e2x Encode.xs JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Merged from perl.git: "Fix Encode 2.60 with g++" http://perl5.git.perl.org/perl.git/commit/89c2544cd3 2.61 2014/05/31 09:48:48 ! bin/piconv Applied: piconv nit + Better error handling when the encoding name is nonexistent Message-Id: <[email protected]> ! Encode.xs Applied: RT #95466: fallback definition of SvIsCOW() is wrong (and hence breaks on 5.8.2 and earlier) https://rt.cpan.org/Ticket/Display.html?id=95466 2.60 2014/04/29 16:25:06 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode/Makefile_PL.e2x Encode/encode.h JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs encengine.c Applied: more Fix Windows build (of Encode) with VC++ 6.0 http://perl5.git.perl.org/perl.git/commit/9e9002efd1609c7d154f98af43a026320df7582c ! Unicode/Unicode.xs Addressed: sign extension issue found by Coverity #21 dankogai/p5-encode#21 ! Encode/encode.h Encode.xs Unicode/Unicode.xs removed #define U8 U8 https://rt.perl.org/Ticket/Display.html?id=121554 http://perl5.git.perl.org/perl.git/commit/2f2b4ff2c154a8e461857f2e82cb815c238d0d94 2.59 2014/04/06 17:23:55 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode.pm Encode.xs Encode/Makefile_PL.e2x JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Restored the signature of Encode_XSEncoding() to address RT#94478 * While dankogai/p5-encode#20 pulls the symnames via argument thus breaks the compatibility with Encode::XX modules with *.ucm, the restored version pulls the symanmes via enc->name[0] so the added 2nd argument is no longer needed. https://rt.cpan.org/Public/Bug/Display.html?id=94478 2.58 2014/03/28 02:37:42 ! bin/piconv Addressed: piconv bug of decoding UTF-16 (with fix) dankogai/p5-encode#19 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode.pm Encode.xs Encode/Makefile_PL.e2x JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Pulled: Remap symname [RT #94221] dankogai/p5-encode#20 https://rt.cpan.org/Public/Bug/Display.html?id=94221 ! Encode.pm Pulled: [doc] clarify that CHECK coderefs return octets #18 dankogai/p5-encode#18
jsonn
pushed a commit
to jsonn/pkgsrc
that referenced
this pull request
Oct 11, 2014
2.62 2014/05/31 12:12:39 ! Encode.pm s/2013/2014/ on COPYRIGHT section ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode/Makefile_PL.e2x Encode.xs JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Merged from perl.git: "Fix Encode 2.60 with g++" http://perl5.git.perl.org/perl.git/commit/89c2544cd3 2.61 2014/05/31 09:48:48 ! bin/piconv Applied: piconv nit + Better error handling when the encoding name is nonexistent Message-Id: <[email protected]> ! Encode.xs Applied: RT #95466: fallback definition of SvIsCOW() is wrong (and hence breaks on 5.8.2 and earlier) https://rt.cpan.org/Ticket/Display.html?id=95466 2.60 2014/04/29 16:25:06 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode/Makefile_PL.e2x Encode/encode.h JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs encengine.c Applied: more Fix Windows build (of Encode) with VC++ 6.0 http://perl5.git.perl.org/perl.git/commit/9e9002efd1609c7d154f98af43a026320df7582c ! Unicode/Unicode.xs Addressed: sign extension issue found by Coverity #21 dankogai/p5-encode#21 ! Encode/encode.h Encode.xs Unicode/Unicode.xs removed #define U8 U8 https://rt.perl.org/Ticket/Display.html?id=121554 http://perl5.git.perl.org/perl.git/commit/2f2b4ff2c154a8e461857f2e82cb815c238d0d94 2.59 2014/04/06 17:23:55 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode.pm Encode.xs Encode/Makefile_PL.e2x JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Restored the signature of Encode_XSEncoding() to address RT#94478 * While dankogai/p5-encode#20 pulls the symnames via argument thus breaks the compatibility with Encode::XX modules with *.ucm, the restored version pulls the symanmes via enc->name[0] so the added 2nd argument is no longer needed. https://rt.cpan.org/Public/Bug/Display.html?id=94478 2.58 2014/03/28 02:37:42 ! bin/piconv Addressed: piconv bug of decoding UTF-16 (with fix) dankogai/p5-encode#19 ! Byte/Makefile.PL CN/Makefile.PL EBCDIC/Makefile.PL Encode.pm Encode.xs Encode/Makefile_PL.e2x JP/Makefile.PL KR/Makefile.PL Symbol/Makefile.PL TW/Makefile.PL bin/enc2xs Pulled: Remap symname [RT #94221] dankogai/p5-encode#20 https://rt.cpan.org/Public/Bug/Display.html?id=94221 ! Encode.pm Pulled: [doc] clarify that CHECK coderefs return octets #18 dankogai/p5-encode#18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow remapping of external symbols in the shared lib at run-time for perlcc.
See https://rt.cpan.org/Public/Bug/Display.html?id=94221