Tag system
Upcoming SlideShare
Loading in...5
×
 

Tag system

on

  • 456 views

Tag system

Tag system

Statistics

Views

Total Views
456
Views on SlideShare
456
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Tag system Tag system Presentation Transcript

  • Using a tag system GAYET Thierry
  • PLAN
    • Goal
    • ELF-file layout
    • Tagging process
    • Extracting a tag
    • Tools available
    • Links about
  • Goal For an ELF make by the build system (buildroot + autotools) this is possible to customize its Sections (data or others) ; it can be easily integrated into the autotools template. It could be information about the build process such as the toolchain release, the datetime, and so on. It may be only an unique ID stored in a database for tracing the build specification The aim is to add a traceability for each build objects in order to know how a binary have been compile by/with (what toolchain kind/version :version of gcc, libc, … ).
  • ELF-file layout Each ELF file is made up of one ELF header, followed by file data. The file data can include: Program header table, describing zero or more segments Section header table, describing zero or more sections Data referred to by entries in the program header table, or the section header table The segments contain information that is necessary for runtime execution of the file, while sections contain important data for linking and relocation. Each byte in the entire file is taken by no more than one section at a time, but there can be orphan bytes, which are not covered by a section. In the normal case of a Unix executable one or more sections are enclosed in one segment.
  • Tagging process
    • Example for creating a temporally TAG file:
    • touch ./myTag
    • echo "SDK = " $(NOM_PROJET) $(VERSION_PROJET) - $(RELEASE_DATE) >> ./myTag
    • echo "TOOLCHAIN = " $(TOOLCHAIN_VERSION) GCC v$(GCC_VERSION) >> ./myTag
    • echo "TARGET = " $(TARGET_ID) >> ./myTag
    • echo "BUILT = " $(shell date +"%Y/%m/%d %H:%M:%S") on $(BUILD_HOST) $(BUILD_KIND) >> ./myTag
    •  This TAG can be easily updated according to our specifications.
    • Revove any previous MYTAG section from the ELF header of the file :
    • objcopy --remove-section MYTAG ./MyElfFileToModify
    • Adding a new section called MYTAG in the ELF file and update the ELF file with the previous tag created :
    • objcopy --add-section MYTAG=./myTag --set-section-flags MYTAG=contents ./MyElfFileToModify
    • Removing the temporally file:
    • rm -f ./myTag
  • Extracting a tag (using the libELF)
    •  Example of source code available here :  http://www.nextinnovation.org/doku.php?id=search_elf_symbol&s[]=tag#source_code_searchsymc
  • Build the extraction tool
    • Compilation:
    • gcc -g -Wall -I$LIB_ELF_PATH/include -c searchsym.c -o searchsym.o
    • Linking:
    • gcc -L$LIB_ELF_PATH/lib -lelf searchsym.o -o searchsym
  • Tools available
    • Lot of tools exist for managing/extracting ELF formats :
    • Libelf
    • Objcopy
    • Objdump
    • Readelf
    • And many others...
  • Links about
    • http://manpagesfr.free.fr/man/man5/elf.5.html
    • http://elftoolchain.sourceforge.net/for-review/libelf-by-example-20100111.pdf
    • http://developers.sun.com/solaris/articles/elf.html