Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
3551-Teach-beam_lib-strip-to-retain-new-chunk-t...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3551-Teach-beam_lib-strip-to-retain-new-chunk-types-intro.patch of Package erlang
From 8d2af55b90db5c0da812c2857b93a2a1e310929d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Mon, 4 Apr 2022 10:03:13 +0200 Subject: [PATCH] Teach beam_lib:strip/* to retain new chunk types introduced in OTP 25 When stripping BEAM files, be sure to retain the "Type" and "Meta" chunk types introduced in OTP 25. Also update the documention to make it clearer what the `strip` functions do. --- lib/stdlib/doc/src/beam_lib.xml | 47 +++++++++++++++--------------- lib/stdlib/src/beam_lib.erl | 2 +- lib/stdlib/test/beam_lib_SUITE.erl | 3 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/stdlib/doc/src/beam_lib.xml b/lib/stdlib/doc/src/beam_lib.xml index 62c9504a01..b32f80d2af 100644 --- a/lib/stdlib/doc/src/beam_lib.xml +++ b/lib/stdlib/doc/src/beam_lib.xml @@ -462,11 +462,11 @@ CryptoKeyFun(clear) -> term()</code> <func> <name name="strip" arity="1" since=""/> - <fsummary>Remove chunks not needed by the loader from a BEAM file. + <fsummary>Remove chunks not used by the loader from a BEAM file. </fsummary> <desc> <p>Removes all chunks from a BEAM - file except those needed by the loader. In particular, + file except those used by the loader. In particular, the debug information (chunk <c>debug_info</c> and <c>abstract_code</c>) is removed.</p> </desc> @@ -474,23 +474,23 @@ CryptoKeyFun(clear) -> term()</code> <func> <name name="strip" arity="2" since="OTP 22.0"/> - <fsummary>Remove chunks not needed by the loader from a BEAM file. + <fsummary>Remove chunks not used by the loader from a BEAM file. </fsummary> <desc> - <p>Removes all chunks from a BEAM - file except those needed by the loader or passed in. In particular, - the debug information (chunk <c>debug_info</c> and <c>abstract_code</c>) - is removed.</p> + <p>Removes all chunks from a BEAM file except those used by + the loader or mentioned in <c><anno>AdditionalChunks</anno></c>. In + particular, the debug information (chunk <c>debug_info</c> and + <c>abstract_code</c>) is removed.</p> </desc> </func> <func> <name name="strip_files" arity="1" since=""/> - <fsummary>Removes chunks not needed by the loader from BEAM files. + <fsummary>Removes chunks not used by the loader from BEAM files. </fsummary> <desc> <p>Removes all chunks except - those needed by the loader from BEAM files. In particular, + those used by the loader from BEAM files. In particular, the debug information (chunk <c>debug_info</c> and <c>abstract_code</c>) is removed. The returned list contains one element for each specified filename, in the same order as in <c>Files</c>.</p> @@ -499,24 +499,25 @@ CryptoKeyFun(clear) -> term()</code> <func> <name name="strip_files" arity="2" since="OTP 22.0"/> - <fsummary>Removes chunks not needed by the loader from BEAM files. + <fsummary>Removes chunks not used by the loader from BEAM files. </fsummary> <desc> - <p>Removes all chunks except - those needed by the loader or passed in from BEAM files. In particular, - the debug information (chunk <c>debug_info</c> and <c>abstract_code</c>) - is removed. The returned list contains one element for each - specified filename, in the same order as in <c>Files</c>.</p> + <p>Removes all chunks except those used by the loader or + mentioned in <c><anno>AdditionalChunks</anno></c>. In + particular, the debug information (chunk <c>debug_info</c> and + <c>abstract_code</c>) is removed. The returned list contains + one element for each specified filename, in the same order as + in <c>Files</c>.</p> </desc> </func> <func> <name name="strip_release" arity="1" since=""/> - <fsummary>Remove chunks not needed by the loader from all BEAM files of + <fsummary>Remove chunks not used by the loader from all BEAM files of a release.</fsummary> <desc> <p>Removes all chunks - except those needed by the loader from the BEAM files of a + except those used by the loader from the BEAM files of a release. <c><anno>Dir</anno></c> is to be the installation root directory. For example, the current OTP release can be stripped with the call @@ -529,12 +530,12 @@ CryptoKeyFun(clear) -> term()</code> <fsummary>Remove chunks not needed by the loader from all BEAM files of a release.</fsummary> <desc> - <p>Removes all chunks - except those needed by the loader or passed in from the BEAM files of a - release. <c><anno>Dir</anno></c> is to be the installation root - directory. For example, the current OTP release can be - stripped with the call - <c>beam_lib:strip_release(code:root_dir())</c>.</p> + <p>Removes all chunks except those used by the loader or + mentioned in <c><anno>AdditionalChunks</anno></c>. + <c><anno>Dir</anno></c> is to be the installation + root directory. For example, the current OTP release can be + stripped with the call + <c>beam_lib:strip_release(code:root_dir())</c>.</p> </desc> </func> diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl index c00edd9904..43e925f6b4 100644 --- a/lib/stdlib/src/beam_lib.erl +++ b/lib/stdlib/src/beam_lib.erl @@ -953,7 +953,7 @@ error(Reason) -> %% The following chunks must be kept when stripping a BEAM file. significant_chunks() -> - ["Attr", "Line" | md5_chunks()]. + ["Attr", "Line", "Meta" | md5_chunks()]. %% The following chunks are significant when calculating the MD5 %% for a module. They are listed in the order that they should be MD5:ed. diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl index a2e4aa6650..ef3a615699 100644 --- a/lib/stdlib/test/beam_lib_SUITE.erl +++ b/lib/stdlib/test/beam_lib_SUITE.erl @@ -453,8 +453,7 @@ strip_add_chunks(Conf) when is_list(Conf) -> compare_chunks(B1, NB1, NBId1), %% Keep all the extra chunks - ExtraChunks = ["Abst", "Dbgi", "Attr", "CInf", "LocT", "Atom", - "Meta"], + ExtraChunks = ["Abst", "Dbgi", "Attr", "CInf", "LocT", "Atom"], {ok, {simple, AB1}} = beam_lib:strip(B1, ExtraChunks), ABId1 = chunk_ids(AB1), true = length(BId1) == length(ABId1), -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor