]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: move SWIFT error_handler out-of-line to fix link failure 69166/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Fri, 29 May 2026 10:39:51 +0000 (18:39 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Fri, 29 May 2026 10:51:31 +0000 (18:51 +0800)
The two error_handler overrides are defined inline in rgw_rest_swift.h
and delegate to RGWSwiftWebsiteHandler::error_handler, a non-virtual
function defined in rgw_rest_swift.cc (librgw_a.a). Because the header
is included by rgw_rest.cc, the inline bodies are emitted in
librgw_common.a, which then ODR-uses that symbol across archives.

The link line lists librgw_a.a before librgw_common.a, and GNU ld only
pulls archive members on demand: when librgw_a.a is scanned nothing yet
references RGWSwiftWebsiteHandler::error_handler, so rgw_rest_swift.cc.o
is dropped and the symbol is later unresolved. This shows up as a link
failure with gcc 16 -O2.

Move the two bodies into rgw_rest_swift.cc next to the function they
call, so the ODR-use stays within the same object and the build no
longer depends on archive scan order. No functional change.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h

index f779175eff45a1714ea43e7d250db5e8ef2d0fdb..b3645b90fccd2ede3b0b330ea8a1afd661f016b8 100644 (file)
@@ -3256,3 +3256,17 @@ RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler(
   const auto& auth_strategy = auth_registry.get_swift();
   return new RGWHandler_REST_SWIFT_Info(auth_strategy);
 }
+
+int RGWHandler_REST_Bucket_SWIFT::error_handler(int err_no,
+                                               std::string *error_content,
+                                               optional_yield y)
+{
+  return website_handler->error_handler(err_no, error_content, y);
+}
+
+int RGWHandler_REST_Obj_SWIFT::error_handler(int err_no,
+                                            std::string *error_content,
+                                            optional_yield y)
+{
+  return website_handler->error_handler(err_no, error_content, y);
+}
index 0fdf055e95a19c5807af43171a5b7985a56a7728..cafcda234341dc45f3d3f4d2504e7da34acc5e68 100644 (file)
@@ -374,9 +374,7 @@ public:
   using RGWHandler_REST_SWIFT::RGWHandler_REST_SWIFT;
   ~RGWHandler_REST_Bucket_SWIFT() override = default;
 
-  int error_handler(int err_no, std::string *error_content, optional_yield y) override {
-    return website_handler->error_handler(err_no, error_content, y);
-  }
+  int error_handler(int err_no, std::string *error_content, optional_yield y) override;
 
   int retarget(RGWOp* op, RGWOp** new_op, optional_yield) override {
     return website_handler->retarget_bucket(op, new_op);
@@ -412,10 +410,7 @@ public:
   using RGWHandler_REST_SWIFT::RGWHandler_REST_SWIFT;
   ~RGWHandler_REST_Obj_SWIFT() override = default;
 
-  int error_handler(int err_no, std::string *error_content,
-                   optional_yield y) override {
-    return website_handler->error_handler(err_no, error_content, y);
-  }
+  int error_handler(int err_no, std::string *error_content, optional_yield y) override;
 
   int retarget(RGWOp* op, RGWOp** new_op, optional_yield) override {
     return website_handler->retarget_object(op, new_op);