Loading cmd/symbols_map/Android.bp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -5,17 +5,16 @@ package { blueprint_go_binary { blueprint_go_binary { name: "symbols_map", name: "symbols_map", srcs: [ srcs: [ "elf.go", "r8.go", "r8.go", "symbols_map.go", "symbols_map.go", ], ], testSrcs: [ testSrcs: [ "elf_test.go", "r8_test.go", "r8_test.go", ], ], deps: [ deps: [ "blueprint-pathtools", "blueprint-pathtools", "golang-protobuf-encoding-prototext", "golang-protobuf-encoding-prototext", "soong-elf", "soong-response", "soong-response", "symbols_map_proto", "symbols_map_proto", ], ], Loading cmd/symbols_map/symbols_map.go +2 −1 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import ( "strings" "strings" "android/soong/cmd/symbols_map/symbols_map_proto" "android/soong/cmd/symbols_map/symbols_map_proto" "android/soong/elf" "android/soong/response" "android/soong/response" "github.com/google/blueprint/pathtools" "github.com/google/blueprint/pathtools" Loading Loading @@ -116,7 +117,7 @@ func main() { if *elfFile != "" { if *elfFile != "" { typ = symbols_map_proto.Mapping_ELF typ = symbols_map_proto.Mapping_ELF location = *elfFile location = *elfFile identifier, err = elfIdentifier(*elfFile, true) identifier, err = elf.Identifier(*elfFile, true) if err != nil { if err != nil { fmt.Fprintf(os.Stderr, "error reading elf identifier: %s\n", err) fmt.Fprintf(os.Stderr, "error reading elf identifier: %s\n", err) os.Exit(1) os.Exit(1) Loading elf/Android.bp 0 → 100644 +28 −0 Original line number Original line Diff line number Diff line // Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["Android-Apache-2.0"], } bootstrap_go_package { name: "soong-elf", pkgPath: "android/soong/elf", srcs: [ "elf.go", ], testSrcs: [ "elf_test.go", ], } cmd/symbols_map/elf.go→elf/elf.go +3 −3 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // See the License for the specific language governing permissions and // limitations under the License. // limitations under the License. package main package elf import ( import ( "debug/elf" "debug/elf" Loading @@ -26,9 +26,9 @@ import ( const gnuBuildID = "GNU\x00" const gnuBuildID = "GNU\x00" // elfIdentifier extracts the elf build ID from an elf file. If allowMissing is true it returns // Identifier extracts the elf build ID from an elf file. If allowMissing is true it returns // an empty identifier if the file exists but the build ID note does not. // an empty identifier if the file exists but the build ID note does not. func elfIdentifier(filename string, allowMissing bool) (string, error) { func Identifier(filename string, allowMissing bool) (string, error) { f, err := os.Open(filename) f, err := os.Open(filename) if err != nil { if err != nil { return "", fmt.Errorf("failed to open %s: %w", filename, err) return "", fmt.Errorf("failed to open %s: %w", filename, err) Loading cmd/symbols_map/elf_test.go→elf/elf_test.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // See the License for the specific language governing permissions and // limitations under the License. // limitations under the License. package main package elf import ( import ( "bytes" "bytes" Loading Loading
cmd/symbols_map/Android.bp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -5,17 +5,16 @@ package { blueprint_go_binary { blueprint_go_binary { name: "symbols_map", name: "symbols_map", srcs: [ srcs: [ "elf.go", "r8.go", "r8.go", "symbols_map.go", "symbols_map.go", ], ], testSrcs: [ testSrcs: [ "elf_test.go", "r8_test.go", "r8_test.go", ], ], deps: [ deps: [ "blueprint-pathtools", "blueprint-pathtools", "golang-protobuf-encoding-prototext", "golang-protobuf-encoding-prototext", "soong-elf", "soong-response", "soong-response", "symbols_map_proto", "symbols_map_proto", ], ], Loading
cmd/symbols_map/symbols_map.go +2 −1 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import ( "strings" "strings" "android/soong/cmd/symbols_map/symbols_map_proto" "android/soong/cmd/symbols_map/symbols_map_proto" "android/soong/elf" "android/soong/response" "android/soong/response" "github.com/google/blueprint/pathtools" "github.com/google/blueprint/pathtools" Loading Loading @@ -116,7 +117,7 @@ func main() { if *elfFile != "" { if *elfFile != "" { typ = symbols_map_proto.Mapping_ELF typ = symbols_map_proto.Mapping_ELF location = *elfFile location = *elfFile identifier, err = elfIdentifier(*elfFile, true) identifier, err = elf.Identifier(*elfFile, true) if err != nil { if err != nil { fmt.Fprintf(os.Stderr, "error reading elf identifier: %s\n", err) fmt.Fprintf(os.Stderr, "error reading elf identifier: %s\n", err) os.Exit(1) os.Exit(1) Loading
elf/Android.bp 0 → 100644 +28 −0 Original line number Original line Diff line number Diff line // Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["Android-Apache-2.0"], } bootstrap_go_package { name: "soong-elf", pkgPath: "android/soong/elf", srcs: [ "elf.go", ], testSrcs: [ "elf_test.go", ], }
cmd/symbols_map/elf.go→elf/elf.go +3 −3 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // See the License for the specific language governing permissions and // limitations under the License. // limitations under the License. package main package elf import ( import ( "debug/elf" "debug/elf" Loading @@ -26,9 +26,9 @@ import ( const gnuBuildID = "GNU\x00" const gnuBuildID = "GNU\x00" // elfIdentifier extracts the elf build ID from an elf file. If allowMissing is true it returns // Identifier extracts the elf build ID from an elf file. If allowMissing is true it returns // an empty identifier if the file exists but the build ID note does not. // an empty identifier if the file exists but the build ID note does not. func elfIdentifier(filename string, allowMissing bool) (string, error) { func Identifier(filename string, allowMissing bool) (string, error) { f, err := os.Open(filename) f, err := os.Open(filename) if err != nil { if err != nil { return "", fmt.Errorf("failed to open %s: %w", filename, err) return "", fmt.Errorf("failed to open %s: %w", filename, err) Loading
cmd/symbols_map/elf_test.go→elf/elf_test.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // See the License for the specific language governing permissions and // limitations under the License. // limitations under the License. package main package elf import ( import ( "bytes" "bytes" Loading