CN110673850A - Method and device for obtaining size of static library - Google Patents
Method and device for obtaining size of static library Download PDFInfo
- Publication number
- CN110673850A CN110673850A CN201910804082.8A CN201910804082A CN110673850A CN 110673850 A CN110673850 A CN 110673850A CN 201910804082 A CN201910804082 A CN 201910804082A CN 110673850 A CN110673850 A CN 110673850A
- Authority
- CN
- China
- Prior art keywords
- data
- size
- static library
- obtaining
- target file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000003068 static effect Effects 0.000 title claims abstract description 219
- 238000000034 method Methods 0.000 title claims abstract description 63
- 230000000694 effects Effects 0.000 abstract description 4
- 230000006870 function Effects 0.000 description 34
- 238000012545 processing Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 10
- 238000004590 computer program Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 6
- 230000009471 action Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000005236 sound signal Effects 0.000 description 4
- 238000007726 management method Methods 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a method and a device for acquiring the size of a static library. Acquiring first data included in a section in a text section of each target file in a static library, and acquiring second data included in the section in a data section of each target file; the size of the static library is obtained based on at least the first data and the second data. According to the method and the device, the application program does not need to be operated, and the related dynamic library does not need to be introduced for project configuration, so that the operation is simplified, and the simplification effect is more obvious under the condition that more static libraries are used. Secondly, also need not the technical staff and run twice application around to the operation of technical staff can be simplified, this application also need not artifical the participation, thereby this application can save the cost of labor, has simplified manual operation, and secondly, this application need not to carry out actual linking with the static storehouse and generates the linkmap file, avoids appearing because the static storehouse is great to lead to linking for a long time longer, and then leads to obtaining the less and more inefficient condition of static storehouse.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for obtaining a size of a static library.
Background
The application program often needs to use a static library, which means that some public codes need to be repeatedly used in the application program, so that the codes can be compiled into a library file; in the linking step, the connector acquires a required code from the library file, copies the code into the application program, and then runs the code linked into the application program when the application program is executed.
However, the static library occupies a certain storage space, so that the size of the application program is increased after the static library is linked to the application program, and if the application program linked with the static library is large, the application program is likely to fail to operate normally under the condition that the system resources of the terminal are limited, which is very unfriendly for users.
Therefore, there is a need to determine the size of the static library linked into the application and adjust it in time by the technician when the size of the static library is large.
The prior art discloses a method for obtaining the size of a static library, which includes:
the method comprises the steps of running an application program which is not linked with a static library, recording the size of the application program, closing the application program, linking the static library in the application program, running the application program which is linked with the static library, recording the size of the application program which is linked with the static library, and calculating the difference value between the sizes of two records to obtain the size of the static library.
However, the inventors have found that the prior art has the following drawbacks:
in general, a benchmark project needs to be created for an application program, and then, project configuration such as a relevant dynamic library needs to be performed for the benchmark project, and in addition, a worker needs to run the application program twice, so that the operation is complicated.
Disclosure of Invention
In order to solve the above technical problem, the present application shows a method and an apparatus for obtaining the size of a static library.
In a first aspect, the present application illustrates a method of obtaining a size of a static library, the method comprising:
acquiring first data included in a section in a text section of each target file in a static library, and acquiring second data included in the section in a data section of each target file;
and acquiring the size of the static library at least according to the first data and the second data.
In an optional implementation manner, the obtaining, in the text section of each target file in the static library, first data included in the section includes:
acquiring all data included in a section from a text section of each target file in the static library;
de-duplicating the same data in all data;
determining the remaining data as the first data.
In an optional implementation manner, the obtaining, in the data section of each target file, second data included in the section includes:
acquiring all data included in a section from a data section of each target file in the static library;
de-duplicating the same data in all data;
determining the remaining data as the second data.
In an optional implementation manner, the obtaining the size of the static library according to at least the first data and the second data includes:
acquiring the size of each first data, and acquiring the size of each second data;
and summing the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation manner, the obtaining the size of the static library according to at least the first data and the second data includes:
obtaining a symbol table and a character string table of each target file in the static library;
and acquiring the size of the static library according to the symbol table, the character string table, the first data and the second data.
In an optional implementation manner, after obtaining the symbol table and the character string table of each target file in the static library, the method further includes:
respectively carrying out de-duplication on the obtained same symbol table and the same character string table;
the obtaining the size of the static library according to the symbol table, the character string table, the first data and the second data includes:
and acquiring the size of the static library according to the rest symbol tables, the rest character string tables, the first data and the second data.
In an optional implementation manner, the obtaining the size of the static library according to the remaining symbol table, the remaining string table, the first data, and the second data includes:
obtaining the size of each remaining symbol table, obtaining the size of each remaining character string table, obtaining the size of each first data, and obtaining the size of each second data;
summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation, the method further includes:
and under the condition that the target files of a plurality of frameworks exist in the static library, eliminating the target files corresponding to other frameworks except the target framework in the static library.
In an optional implementation, the method further includes:
and under the condition that the symbol table and the character string table exist in the static library, rejecting the symbol table and the character string table of the static library, wherein the symbol table and the character string table are included in the static library.
In an optional implementation, the method further includes:
and under the condition that debug debugging information exists in each target file of the static library, removing the debug debugging information in each target file of the static library.
In an optional implementation, the method further includes:
and under the condition that the intermediate code information exists in each target file of the static library, rejecting the intermediate code information in each target file of the static library.
In a second aspect, the present application illustrates an apparatus for obtaining a size of a static library, the apparatus comprising:
the first acquisition module is used for acquiring first data included in the section in the text section of each target file in the static library;
a second obtaining module, configured to obtain second data included in the section from the data segment of each target file;
and the third acquisition module is used for acquiring the size of the static library at least according to the first data and the second data.
In an optional implementation manner, the first obtaining module includes:
a first obtaining unit, configured to obtain all data included in a section from a text segment of each target file in the static library;
a first deduplication unit configured to deduplicate the same data of all data;
a first determining unit configured to determine remaining data as the first data.
In an optional implementation manner, the second obtaining module includes:
a second obtaining unit, configured to obtain all data included in the section from the data segment of each target file in the static library;
a second deduplication unit configured to deduplicate the same data of all the data;
a second determining unit configured to determine remaining data as the second data.
In an optional implementation manner, the third obtaining module includes:
a third acquiring unit configured to acquire a size of each of the first data and acquire a size of each of the second data;
and the summing unit is used for summing the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation manner, the third obtaining module includes:
a fourth obtaining unit, configured to obtain a symbol table and a character string table of each target file in the static library;
a fifth obtaining unit, configured to obtain the size of the static library according to the symbol table, the character string table, the first data, and the second data.
In an optional implementation manner, the third obtaining module further includes:
the third deduplication unit is used for respectively deduplicating the obtained same symbol table and the same character string table;
the fifth obtaining unit is specifically configured to: and acquiring the size of the static library according to the rest symbol tables, the rest character string tables, the first data and the second data.
In an optional implementation manner, the fifth obtaining unit includes:
a first obtaining subunit, configured to obtain a size of each remaining symbol table, obtain a size of each remaining character string table, obtain a size of each first data, and obtain a size of each second data;
and the summation subunit is used for summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation, the apparatus further comprises:
the first eliminating module is used for eliminating target files corresponding to other architectures except the target architecture in the static library under the condition that the target files of the plurality of architectures exist in the static library.
In an optional implementation, the apparatus further comprises:
and the second eliminating module is used for eliminating the symbol table and the character string table of the static library in the static library under the condition that the symbol table and the character string table exist in the static library.
In an optional implementation, the apparatus further comprises:
and the third eliminating module is used for eliminating debug debugging information in each target file of the static library under the condition that the debug debugging information exists in each target file of the static library.
In an optional implementation, the apparatus further comprises:
and the fourth removing module is used for removing the intermediate code information in each target file of the static library under the condition that the intermediate code information exists in each target file of the static library.
In a third aspect, the present application shows an electronic device comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of obtaining the size of a static library as described in the first aspect.
In a fourth aspect, the present application illustrates a non-transitory computer-readable storage medium having instructions which, when executed by a processor of an electronic device, enable the electronic device to perform the method of obtaining a size of a static library as described in the first aspect.
In a fifth aspect, the present application shows a computer program product, wherein instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the method of obtaining the size of a static library as described in the first aspect.
The technical scheme provided by the application can comprise the following beneficial effects:
in the method, first data included in a section is obtained from a text section of each target file in a static library, and second data included in the section is obtained from a data section of each target file; the size of the static library is obtained based on at least the first data and the second data. According to the method and the device, the application program does not need to be operated, and the related dynamic library does not need to be introduced for project configuration, so that the operation is simplified, and the simplification effect is more obvious under the condition that more static libraries are used. Secondly, also need not the technical staff and run twice application around to the operation of technical staff can be simplified, this application also need not artifical the participation, thereby this application can save the cost of labor, has simplified manual operation, and secondly, this application need not to carry out actual linking with the static storehouse and generates the linkmap file, avoids appearing because the static storehouse is great to lead to linking for a long time longer, and then leads to obtaining the less and more inefficient condition of static storehouse.
Drawings
FIG. 1 is a flow chart of the steps of a method of obtaining the size of a static library of the present application;
FIG. 2 is a block diagram of an apparatus for obtaining the size of a static library according to the present application;
FIG. 3 is a block diagram of an electronic device shown in the present application;
fig. 4 is a block diagram of an electronic device shown in the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
Referring to fig. 1, a flowchart illustrating steps of a method for obtaining a size of a static library according to the present application is shown, where the method specifically includes the following steps:
in step S101, first data included in a section is acquired in a text section of each target file in the static library, and second data included in the section is acquired in a data section of each target file;
in this application, the static library includes a plurality of target files, each target file has a text segment, the text segment includes at least one section, and each section includes at least one data, such as a string constant.
Therefore, the data in the static library may sometimes have a duplication condition, and if the duplication condition exists, although the data is repeatedly recorded in the section, the data is actually stored only once in the static library, so that the same data needs to be deduplicated, otherwise, the size of the static library acquired according to the data included in the election section is often larger than the actual size of the static library, which results in inaccurate size of the acquired static library.
Therefore, in order to improve the accuracy of the size of the static library acquired later, in another embodiment of the present application, all data included in the section may be acquired in the text section of each target file in the static library; in the case where there is some duplication of these data in the static library, the same data in all the data may be deduplicated; the remaining data is then determined as the first data.
Correspondingly, all data included in the section can be acquired from the data section of each target file in the static library; in the case where there is some duplication of these data in the static library, the same data in all the data may be deduplicated; the remaining data is then determined as second data.
In step S102, the size of the static library is obtained based on at least the first data and the second data.
In one embodiment of the present application, the size of each first data may be obtained, and the size of each second data may be obtained, and then the size of each first data and the size of each second data are summed to obtain the size of the static library.
In the method, first data included in a section is obtained from a text section of each target file in a static library, and second data included in the section is obtained from a data section of each target file; the size of the static library is obtained based on at least the first data and the second data. According to the method and the device, the application program does not need to be operated, and the related dynamic library does not need to be introduced for project configuration, so that the operation is simplified, and the simplification effect is more obvious under the condition that more static libraries are used. Secondly, also need not the technical staff and run twice application around to the operation of technical staff can be simplified, this application also need not artifical the participation, thereby this application can save the cost of labor, has simplified manual operation, and secondly, this application need not to carry out actual linking with the static storehouse and generates the linkmap file, avoids appearing because the static storehouse is great to lead to linking for a long time longer, and then leads to obtaining the less and more inefficient condition of static storehouse.
However, after the application program is put on the market, the target file linked to the static library in the application program often includes a symbol table and a character string table, which are not the symbol table and the character string of the static library, but indirectly records the relevant information of the dynamic library, such as the correspondence between the function name of the function in the dynamic library and the call address of the function.
The size of the symbol table and the size of the character string table are often low, but in order to improve the accuracy of the determined size of the static library, in another embodiment of the present application, the symbol table and the character string table of each target file in the static library may be obtained; and then obtaining the size of the static library according to the symbol table, the character string table, the first data and the second data.
For example, the size of each symbol table is obtained, the size of each character string table is obtained, the size of each first data is obtained, and the size of each second data is obtained; and then summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
Often, a static library includes a plurality of object files, each of which includes a symbol table and a string table.
In a target file, a character string table is included to store a plurality of function names, each function name has a respective index position in the character string table, and a symbol table is included to store the corresponding relation between the index position of the function name of the function in the character string table and the calling address of the function. That is, the correspondence between the function name of the function and the call address of the function is indirectly recorded through the character string table and the symbol table.
However, in a plurality of target files, there may be a case where the correspondence between the function name of the function and the call address of the function is repeatedly and indirectly recorded, and although the correspondence between the function name of the function and the call address of the function is repeatedly and indirectly recorded, in fact, the function is often stored only once in the static library, and therefore, in this case, if the size of the static library is determined from the actual string table and the symbol table, the determined size of the static library is often larger than the actual size of the static library, resulting in an inaccurate size of the determined static library.
Therefore, in order to improve the accuracy of the determined size of the static library, in another embodiment of the present application, the obtained same symbol table and the same character string table may be respectively de-duplicated.
For example, in a symbol table and a character string table of a plurality of target files in a static library, each symbol table is traversed one by one, when an index position in one symbol table is traversed, a function name is searched in the character string table corresponding to the symbol according to the index position, and then the searched function name and a call address corresponding to the index position are stored in a temporary table.
And continuously traversing the next index position, acquiring the function name and the call address according to the method, if the currently acquired function name and call address exist in the temporary table, deleting the index position and the call address corresponding to the index position in the symbol table, and deleting the function name at the index position in the character string table. If the function name and the call address which are obtained currently do not exist in the temporary table, the function name and the call address which are obtained currently are stored in the temporary table, the next index position is traversed continuously, the operation of returning is carried out on each traversed index position until the operation is completed on the last index position, and therefore the purposes of respectively carrying out deduplication on the obtained same symbol table and the same character string table are achieved.
Then, the size of the static library may be obtained from the remaining symbol table, the remaining character string table, the first data, and the second data.
For example, the size of each remaining symbol table is obtained, the size of each remaining character string table is obtained, the size of each first data is obtained, and the size of each second data is obtained; and then summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
In another embodiment of the present application, in the process of developing an application, in order to support the application to be applied to various architectures, for example, architectures such as X86 and ARMv7, a static library often includes target files of various architectures at the same time, however, an application put on the market often only needs to support one architecture, that is, only a target file corresponding to one architecture is included in a static library linked in the application put on the market. That is, only the target file corresponding to one architecture is included in the static library linked to the application program, and therefore, the size of the static library linked to the application program is not related to any target file corresponding to another architecture, and before the present application, in the case where a plurality of target files of architectures exist in the static library, the target files corresponding to other architectures except for the target architecture in the static library may be removed, and then step S101 may be executed.
The target architecture may be one of a plurality of architectures, and the specific architecture is not limited in this application.
In the application, the static library sometimes includes a symbol table and a character string table in addition to the target file, and the symbol table and the character string table of the static library indirectly record related information in the static library, for example, a correspondence between a function name of a function in the static library and a call address of the function, and if the symbol table and the character string table of the static library are loaded in the application program put on the market, a competitor may know a function call condition of the static library in the application program after the application program is decoded, so that leakage is easy to occur, and property loss is brought to the competitor.
Therefore, in general, in order to avoid property damage to the application itself, the application program put on the market does not include the symbol table and the character string table of the static library included in the static library, that is, the symbol table and the character string table of the static library are not included in the static library linked to the application program, and therefore, the size of the static library linked to the application program is irrelevant to both the symbol table and the character string table of the static library, and therefore, before the application, in the case where the symbol table and the character string table exist in the static library, the symbol table and the character string table of the static library included in the static library may be removed first, and then step S101 is executed.
In this application, the target file in the static library sometimes includes debug information in addition to the string table and symbol table of the referenced dynamic library, as well as text and data fields. debug information records various debug conditions when an application program is developed, if debug information is loaded in the application program put on the market, a competitor can know the debug conditions in the application program after deciphering the application program, thus being easy to divulge a secret and bringing property loss to the competitor,
therefore, in general, in order to avoid causing property loss to the application itself, the debug debugging information in the target file is not included in the application program put on the market, that is, the debug debugging information is not included in the target file linked to the static library in the application program, and therefore, the size of the static library linked to the application program is irrelevant to the debug debugging information in the target file, and before the application, in the case that the debug debugging information exists in each target file of the static library, the debug debugging information in each target file of the static library may be removed first, and then step S101 is executed.
In the application, the target file in the static library sometimes includes intermediate code bytecode information in addition to the character string table and the symbol table of the dynamic library to be referred, and the text segment and the data segment, and the function of the target file is to convert the code in the application program into a code corresponding to any architecture, which exists in the referring program in the development stage, and the application program put into the market does not include the intermediate code bytecode information in the target file, that is, the target file linked to the static library in the application program does not include the intermediate code bytecode information, so the size of the static library linked to the application program is irrelevant to the intermediate code bytecode information in the target file, and therefore, before the application, the intermediate code bytecode information in each target file of the static library can be removed first under the condition that the intermediate code bytecode information exists in each target file of the static library, then, step S101 is performed again.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders and concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are exemplary and that no action is necessarily required in this application.
Referring to fig. 2, a block diagram of an apparatus for obtaining the size of a static library according to the present application is shown, and the apparatus may specifically include the following modules:
a first obtaining module 11, configured to obtain first data included in a section from a text segment of each target file in a static library;
a second obtaining module 12, configured to obtain second data included in the section in the data segment of each target file;
a third obtaining module 13, configured to obtain the size of the static library according to at least the first data and the second data.
In an optional implementation manner, the first obtaining module 11 includes:
a first obtaining unit, configured to obtain all data included in a section from a text segment of each target file in the static library;
a first deduplication unit configured to deduplicate the same data of all data;
a first determining unit configured to determine remaining data as the first data.
In an optional implementation manner, the second obtaining module 12 includes:
a second obtaining unit, configured to obtain all data included in the section from the data segment of each target file in the static library;
a second deduplication unit configured to deduplicate the same data of all the data;
a second determining unit configured to determine remaining data as the second data.
In an optional implementation manner, the third obtaining module 13 includes:
a third acquiring unit configured to acquire a size of each of the first data and acquire a size of each of the second data;
and the summing unit is used for summing the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation manner, the third obtaining module 13 includes:
a fourth obtaining unit, configured to obtain a symbol table and a character string table of each target file in the static library;
a fifth obtaining unit, configured to obtain the size of the static library according to the symbol table, the character string table, the first data, and the second data.
In an optional implementation manner, the third obtaining module 13 further includes:
the third deduplication unit is used for respectively deduplicating the obtained same symbol table and the same character string table;
the fifth obtaining unit is specifically configured to: and acquiring the size of the static library according to the rest symbol tables, the rest character string tables, the first data and the second data.
In an optional implementation manner, the fifth obtaining unit includes:
a first obtaining subunit, configured to obtain a size of each remaining symbol table, obtain a size of each remaining character string table, obtain a size of each first data, and obtain a size of each second data;
and the summation subunit is used for summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
In an optional implementation, the apparatus further comprises:
the first eliminating module is used for eliminating target files corresponding to other architectures except the target architecture in the static library under the condition that the target files of the plurality of architectures exist in the static library.
In an optional implementation, the apparatus further comprises:
and the second eliminating module is used for eliminating the symbol table and the character string table of the static library in the static library under the condition that the symbol table and the character string table exist in the static library.
In an optional implementation, the apparatus further comprises:
and the third eliminating module is used for eliminating debug debugging information in each target file of the static library under the condition that the debug debugging information exists in each target file of the static library.
In an optional implementation, the apparatus further comprises:
and the fourth removing module is used for removing the intermediate code information in each target file of the static library under the condition that the intermediate code information exists in each target file of the static library.
In the method, first data included in a section is obtained from a text section of each target file in a static library, and second data included in the section is obtained from a data section of each target file; the size of the static library is obtained based on at least the first data and the second data. According to the method and the device, the application program does not need to be operated, and the related dynamic library does not need to be introduced for project configuration, so that the operation is simplified, and the simplification effect is more obvious under the condition that more static libraries are used. Secondly, also need not the technical staff and run twice application around to the operation of technical staff can be simplified, this application also need not artifical the participation, thereby this application can save the cost of labor, has simplified manual operation, and secondly, this application need not to carry out actual linking with the static storehouse and generates the linkmap file, avoids appearing because the static storehouse is great to lead to linking for a long time longer, and then leads to obtaining the less and more inefficient condition of static storehouse.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Fig. 3 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 3, electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, images, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the electronic device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 4 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 may be provided as a server.
Referring to fig. 4, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method and the device for acquiring the size of the static library provided by the application are introduced in detail, and a specific example is applied in the method to explain the principle and the implementation of the application, and the description of the embodiment is only used for helping to understand the method and the core idea of the application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (24)
1. A method of obtaining a size of a static library, the method comprising:
acquiring first data included in a section in a text section of each target file in a static library, and acquiring second data included in the section in a data section of each target file;
and acquiring the size of the static library at least according to the first data and the second data.
2. The method of claim 1, wherein the obtaining of the first data included in the section in the text section of each target file in the static library comprises:
acquiring all data included in a section from a text section of each target file in the static library;
de-duplicating the same data in all data;
determining the remaining data as the first data.
3. The method according to claim 1, wherein the obtaining of the second data included in the section in the data section of each target file comprises:
acquiring all data included in a section from a data section of each target file in the static library;
de-duplicating the same data in all data;
determining the remaining data as the second data.
4. The method of claim 1, wherein obtaining the size of the static library based on at least the first data and the second data comprises:
acquiring the size of each first data, and acquiring the size of each second data;
and summing the size of each first data and the size of each second data to obtain the size of the static library.
5. The method of claim 1, wherein obtaining the size of the static library based on at least the first data and the second data comprises:
obtaining a symbol table and a character string table of each target file in the static library;
and acquiring the size of the static library according to the symbol table, the character string table, the first data and the second data.
6. The method of claim 5, wherein after obtaining the symbol table and the character string table of each target file in the static library, further comprising:
respectively carrying out de-duplication on the obtained same symbol table and the same character string table;
the obtaining the size of the static library according to the symbol table, the character string table, the first data and the second data includes:
and acquiring the size of the static library according to the rest symbol tables, the rest character string tables, the first data and the second data.
7. The method of claim 6, wherein obtaining the size of the static library from the remaining symbol tables, the remaining string tables, the first data, and the second data comprises:
obtaining the size of each remaining symbol table, obtaining the size of each remaining character string table, obtaining the size of each first data, and obtaining the size of each second data;
summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
8. The method of claim 1, further comprising:
and under the condition that the target files of a plurality of frameworks exist in the static library, eliminating the target files corresponding to other frameworks except the target framework in the static library.
9. The method of claim 1, further comprising:
and under the condition that the symbol table and the character string table exist in the static library, rejecting the symbol table and the character string table of the static library, wherein the symbol table and the character string table are included in the static library.
10. The method of claim 1, further comprising:
and under the condition that debug debugging information exists in each target file of the static library, removing the debug debugging information in each target file of the static library.
11. The method of claim 1, further comprising:
and under the condition that the intermediate code information exists in each target file of the static library, rejecting the intermediate code information in each target file of the static library.
12. An apparatus for obtaining a size of a static library, the apparatus comprising:
the first acquisition module is used for acquiring first data included in the section in the text section of each target file in the static library;
a second obtaining module, configured to obtain second data included in the section from the data segment of each target file;
and the third acquisition module is used for acquiring the size of the static library at least according to the first data and the second data.
13. The apparatus of claim 12, wherein the first obtaining module comprises:
a first obtaining unit, configured to obtain all data included in a section from a text segment of each target file in the static library;
a first deduplication unit configured to deduplicate the same data of all data;
a first determining unit configured to determine remaining data as the first data.
14. The apparatus of claim 12, wherein the second obtaining module comprises:
a second obtaining unit, configured to obtain all data included in the section from the data segment of each target file in the static library;
a second deduplication unit configured to deduplicate the same data of all the data;
a second determining unit configured to determine remaining data as the second data.
15. The apparatus of claim 12, wherein the third obtaining module comprises:
a third acquiring unit configured to acquire a size of each of the first data and acquire a size of each of the second data;
and the summing unit is used for summing the size of each first data and the size of each second data to obtain the size of the static library.
16. The apparatus of claim 12, wherein the third obtaining module comprises:
a fourth obtaining unit, configured to obtain a symbol table and a character string table of each target file in the static library;
a fifth obtaining unit, configured to obtain the size of the static library according to the symbol table, the character string table, the first data, and the second data.
17. The apparatus of claim 16, wherein the third obtaining module further comprises:
the third deduplication unit is used for respectively deduplicating the obtained same symbol table and the same character string table;
the fifth obtaining unit is specifically configured to: and acquiring the size of the static library according to the rest symbol tables, the rest character string tables, the first data and the second data.
18. The apparatus of claim 17, wherein the fifth obtaining unit comprises:
a first obtaining subunit, configured to obtain a size of each remaining symbol table, obtain a size of each remaining character string table, obtain a size of each first data, and obtain a size of each second data;
and the summation subunit is used for summing the size of each remaining symbol table, the size of each remaining character string table, the size of each first data and the size of each second data to obtain the size of the static library.
19. The apparatus of claim 12, further comprising:
the first eliminating module is used for eliminating target files corresponding to other architectures except the target architecture in the static library under the condition that the target files of the plurality of architectures exist in the static library.
20. The apparatus of claim 12, further comprising:
and the second eliminating module is used for eliminating the symbol table and the character string table of the static library in the static library under the condition that the symbol table and the character string table exist in the static library.
21. The apparatus of claim 12, further comprising:
and the third eliminating module is used for eliminating debug debugging information in each target file of the static library under the condition that the debug debugging information exists in each target file of the static library.
22. The apparatus of claim 12, further comprising:
and the fourth removing module is used for removing the intermediate code information in each target file of the static library under the condition that the intermediate code information exists in each target file of the static library.
23. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of obtaining the size of a static library of any of claims 1-3.
24. A non-transitory computer readable storage medium, instructions in which, when executed by a processor of an electronic device, enable the electronic device to perform the method of obtaining the size of a static library of any of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910804082.8A CN110673850A (en) | 2019-08-28 | 2019-08-28 | Method and device for obtaining size of static library |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910804082.8A CN110673850A (en) | 2019-08-28 | 2019-08-28 | Method and device for obtaining size of static library |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110673850A true CN110673850A (en) | 2020-01-10 |
Family
ID=69076414
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910804082.8A Pending CN110673850A (en) | 2019-08-28 | 2019-08-28 | Method and device for obtaining size of static library |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110673850A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112230979A (en) * | 2020-09-28 | 2021-01-15 | 北京五八信息技术有限公司 | Dependency relationship detection method and device, electronic equipment and storage medium |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101930377A (en) * | 2009-06-22 | 2010-12-29 | 深圳市融创天下科技发展有限公司 | Link library compiling method by dynamically acquiring UID |
CN102194080A (en) * | 2011-06-13 | 2011-09-21 | 西安交通大学 | Rootkit detection mechanism and detection method based on kernel-based virtual machine |
CN105224370A (en) * | 2015-10-21 | 2016-01-06 | 安一恒通(北京)科技有限公司 | A kind of method and apparatus of loading ELF document |
CN105683990A (en) * | 2013-10-10 | 2016-06-15 | Inka安特沃客有限公司 | Method and apparatus for protecting dynamic libraries |
CN108021590A (en) * | 2016-10-28 | 2018-05-11 | 阿里巴巴集团控股有限公司 | A kind of destination object attribute determining method, attribute update method and device |
US20180203676A1 (en) * | 2015-04-09 | 2018-07-19 | Longsand Limited | Removing library objects from a static library |
CN109684284A (en) * | 2018-12-29 | 2019-04-26 | 南方电网科学研究院有限责任公司 | Sliding block repeated data deleting method based on edge calculation |
CN109710230A (en) * | 2018-12-12 | 2019-05-03 | 平安科技(深圳)有限公司 | It is a kind of to realize target program generation method and device using static library |
CN110069459A (en) * | 2019-03-14 | 2019-07-30 | 北京字节跳动网络技术有限公司 | File monitor method, apparatus and electronic equipment |
CN110175155A (en) * | 2019-06-03 | 2019-08-27 | 武汉纺织大学 | A kind of method and system of file duplicate removal processing |
-
2019
- 2019-08-28 CN CN201910804082.8A patent/CN110673850A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101930377A (en) * | 2009-06-22 | 2010-12-29 | 深圳市融创天下科技发展有限公司 | Link library compiling method by dynamically acquiring UID |
CN102194080A (en) * | 2011-06-13 | 2011-09-21 | 西安交通大学 | Rootkit detection mechanism and detection method based on kernel-based virtual machine |
CN105683990A (en) * | 2013-10-10 | 2016-06-15 | Inka安特沃客有限公司 | Method and apparatus for protecting dynamic libraries |
US20180203676A1 (en) * | 2015-04-09 | 2018-07-19 | Longsand Limited | Removing library objects from a static library |
CN105224370A (en) * | 2015-10-21 | 2016-01-06 | 安一恒通(北京)科技有限公司 | A kind of method and apparatus of loading ELF document |
CN108021590A (en) * | 2016-10-28 | 2018-05-11 | 阿里巴巴集团控股有限公司 | A kind of destination object attribute determining method, attribute update method and device |
CN109710230A (en) * | 2018-12-12 | 2019-05-03 | 平安科技(深圳)有限公司 | It is a kind of to realize target program generation method and device using static library |
CN109684284A (en) * | 2018-12-29 | 2019-04-26 | 南方电网科学研究院有限责任公司 | Sliding block repeated data deleting method based on edge calculation |
CN110069459A (en) * | 2019-03-14 | 2019-07-30 | 北京字节跳动网络技术有限公司 | File monitor method, apparatus and electronic equipment |
CN110175155A (en) * | 2019-06-03 | 2019-08-27 | 武汉纺织大学 | A kind of method and system of file duplicate removal processing |
Non-Patent Citations (4)
Title |
---|
欧阳大哥2013: "深入iOS系统底层之静态库", 《简书》 * |
欧阳大哥2013: "深入iOS系统底层之静态库", 《简书》, 6 February 2019 (2019-02-06), pages 1 - 23 * |
蔡伯峰等: "ARM Cortex-M0+机器码系列文件分析及应用研究", 《福州大学学报(自然科学版)》, vol. 46, no. 06, 7 December 2018 (2018-12-07) * |
黄贤武等: "《数字图像处理与压缩编码技术》", 电子科技大学出版社, pages: 211 - 212 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112230979A (en) * | 2020-09-28 | 2021-01-15 | 北京五八信息技术有限公司 | Dependency relationship detection method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105845124B (en) | Audio processing method and device | |
EP3176709A1 (en) | Video categorization method and apparatus, computer program and recording medium | |
CN104679599A (en) | Application program duplicating method and device | |
CN106991018B (en) | Interface skin changing method and device | |
CN105094904A (en) | Application program installation method and device | |
CN107885571B (en) | Display page control method and device | |
CN112559309B (en) | Page performance acquisition algorithm adjusting method and device | |
CN114546992A (en) | Database migration method and device, storage medium and electronic equipment | |
CN110673850A (en) | Method and device for obtaining size of static library | |
CN105630486B (en) | Typesetting method and device for desktop of intelligent terminal equipment | |
CN106293683B (en) | Project compiling method and device | |
CN111832455A (en) | Method, device, storage medium and electronic equipment for acquiring content image | |
CN110874259A (en) | Program execution method, device, equipment and storage medium | |
CN110457084B (en) | Loading method and device | |
CN114840524A (en) | Graph data storage method and device and electronic equipment | |
CN108762944B (en) | Processing method, device, equipment and medium of business system | |
CN113946346B (en) | Data processing method and device, electronic equipment and storage medium | |
CN107526683B (en) | Method and device for detecting functional redundancy of application program and storage medium | |
CN110493298B (en) | Information synchronization method and device | |
CN107193622B (en) | Code compiling processing method and device and terminal | |
CN111221593A (en) | Dynamic loading method and device | |
CN113934452B (en) | Data processing method and device, electronic equipment and storage medium | |
CN114416085B (en) | Data processing method and device, electronic equipment and storage medium | |
CN111061633A (en) | Method, device, terminal and medium for detecting first screen time of webpage | |
CN112346968B (en) | Automatic detection method and device for definition of multimedia file |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200110 |