Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a9fbc5a authored by David Duarte's avatar David Duarte
Browse files

RootCanal: Remove usage of a cc_object for devices

The single object is triggering CFI as this file doesn't
contains LTO that are required for Control Flow Integrity
to work

Bug: 228517914
Test: Run RootCanal and see that we have devices registering
Change-Id: I9289efc6e786c4ac830f65d6cc23da2c6492f350
parent fe1986fc
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -57,10 +57,12 @@ cc_binary {
        "BluetoothGeneratedPackets_h",
        "libbt_init_flags_bridge_header",
    ],
    whole_static_libs: [
        "libbt-rootcanal",
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
        "android.hardware.bluetooth-hci",
        "libbt-rootcanal",
        "libscriptedbeaconpayload-protos-lite",
    ],
    include_dirs: [
@@ -106,10 +108,12 @@ cc_library_shared {
        "BluetoothGeneratedPackets_h",
        "libbt_init_flags_bridge_header",
    ],
    whole_static_libs: [
        "libbt-rootcanal"
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
        "android.hardware.bluetooth-hci",
        "libbt-rootcanal",
        "libscriptedbeaconpayload-protos-lite",
    ],
    include_dirs: [
+17 −27
Original line number Diff line number Diff line
@@ -39,31 +39,9 @@ cc_defaults {
    ],
}

// Compile devices and device boutique into a single object to force the linker
// to pick all the symbols for static registration to work
cc_object {
    name: "libbt-rootcanal-devices",
    defaults: ["rootcanal_defaults"],
    host_supported: true,
    proprietary: true,
    cflags: ["-fPIC"],
    srcs: [
        "model/devices/beacon.cc",
        "model/devices/beacon_swarm.cc",
        "model/devices/broken_adv.cc",
        "model/devices/car_kit.cc",
        "model/devices/classic.cc",
        "model/devices/keyboard.cc",
        "model/devices/loopback.cc",
        "model/devices/scripted_beacon.cc",
        "model/devices/sniffer.cc",
        "model/setup/device_boutique.cc",
    ],
    static_libs: [
        "libscriptedbeaconpayload-protos-lite",
    ]
}

// This library should be added as `whole_static_libs`
// as it uses static registration and all object
// files needs to be linked
cc_library_static {
    name: "libbt-rootcanal",
    defaults: ["rootcanal_defaults"],
@@ -78,17 +56,27 @@ cc_library_static {
        "model/controller/link_layer_controller.cc",
        "model/controller/sco_connection.cc",
        "model/controller/security_manager.cc",
        "model/devices/beacon.cc",
        "model/devices/beacon_swarm.cc",
        "model/devices/broken_adv.cc",
        "model/devices/car_kit.cc",
        "model/devices/classic.cc",
        "model/devices/device.cc",
        "model/devices/device_properties.cc",
        "model/devices/hci_device.cc",
        "model/devices/keyboard.cc",
        "model/devices/link_layer_socket_device.cc",
        "model/devices/loopback.cc",
        "model/devices/remote_loopback_device.cc",
        "model/devices/scripted_beacon.cc",
        "model/devices/sniffer.cc",
        "model/hci/h4_data_channel_packetizer.cc",
        "model/hci/h4_packetizer.cc",
        "model/hci/h4_parser.cc",
        "model/hci/hci_protocol.cc",
        "model/hci/hci_socket_transport.cc",
        "model/setup/async_manager.cc",
        "model/setup/device_boutique.cc",
        "model/setup/phy_layer_factory.cc",
        "model/setup/test_channel_transport.cc",
        "model/setup/test_command_handler.cc",
@@ -99,7 +87,6 @@ cc_library_static {
        ":BluetoothPacketSources",
        ":BluetoothHciClassSources",
        ":BluetoothCryptoToolboxSources",
        ":libbt-rootcanal-devices",
    ],
    export_include_dirs: [
        "include",
@@ -110,6 +97,7 @@ cc_library_static {
    ],
    static_libs: [
        "libjsoncpp",
        "libscriptedbeaconpayload-protos-lite",
    ],
}

@@ -182,11 +170,13 @@ cc_binary_host {
        "liblog",
        "libbacktrace",
    ],
    whole_static_libs: [
        "libbt-rootcanal",
    ],
    static_libs: [
        "libjsoncpp",
        "libprotobuf-cpp-lite",
        "libscriptedbeaconpayload-protos-lite",
        "libbt-rootcanal",
        "breakpad_client",
        "libgflags",
    ],